none
+ jackrack
+
+ Description
+
+ Creates Jack ports and runs a JackRack project to process audio
+ through a stack of LADSPA filters.
+
+ Constructor Argument
+
+ src - a JackRack file
+
+ Details
+
+ If you are using a consumer that uses ALSA, then you should start
+ jacks with the dummy driver: jackd -d dummy.
+ I also recommend using a period size of 2048: -p 2048.
+
+ jackd -ddummy -r48000 -p2048
+
+ Initialisation Properties
+
+ int in - in point
+ int out - out point
+
+ The following can be used without a rack file in order to connect
+ filter_jackrack to a running instance of JackRack:
+ string out_1 - Jack port to connect MLT's output port (JackRack's input)
+ string out_2 - Jack port to connect MLT's output port (JackRack's input)
+ string in_1 - Jack port to connect MLT's input port (JackRack's output)
+ string in_2 - Jack port to connect MLT's input port (JackRack's output)
+
+ Read Only Properties
+
+ none
+
+ Mutable Properties
+
+ none
+
+ Dependencies
+
+ Jack, LADSPA, glib-2.0, libxml2
+
+ Known Bugs
+
+ no encapsulated resampling and jack runs at a fixed frequency
+
luma
Description
total_size += ring_size;
if ( first_ring_size == -sizeof(float) || total_size >= first_ring_size )
{
- // Set flag to skip this henceforth
- mlt_properties_set_int( properties, "_samples", -1 );
-
// Return audio through in port
jack_input_buffers[i] = jack_port_get_buffer( jack_input_ports[i], frames );
if ( ! jack_input_buffers[i] )
jack_ringbuffer_write( input_buffers[i], ( char * )jack_input_buffers[i], ring_size < jack_size ? ring_size : jack_size );
// Tell mlt that audio is available
- if ( i == ( channels - 1 ) && pthread_mutex_trylock( output_lock) == 0 )
+ if ( first_ring_size != -sizeof(float) && i == ( channels - 1 )
+ && pthread_mutex_trylock( output_lock) == 0 )
{
pthread_cond_signal( output_ready );
pthread_mutex_unlock( output_lock );
}
+
+ // Set flag to skip this henceforth
+ mlt_properties_set_int( properties, "_samples", -1 );
}
}
// fprintf( stderr, "%s: out buffer size %d\n", __FUNCTION__, jack_ringbuffer_write_space( output_buffers[0] ) );
// Read from input ringbuffer and convert from floats
- while ( jack_ringbuffer_read_space( input_buffers[ *channels - 1 ] ) < ( *samples * sizeof(float) ) )
+ while ( mlt_properties_get_int( filter_properties, "_samples" ) != -1
+ && jack_ringbuffer_read_space( input_buffers[ *channels - 1 ] ) < ( *samples * sizeof(float) ) )
pthread_cond_wait( output_ready, output_lock );
- {
- q = *buffer;
-
- // Initialise to silence, but repeat last frame if available in case of
- // buffer underrun
- sample = 0;
+
+ q = *buffer;
- for ( i = 0; i < *samples; i++ )
- for ( j = 0; j < *channels; j++ )
- {
- jack_ringbuffer_read( input_buffers[j], ( char * )&sample, sizeof(float) );
+ // Initialise to silence, but repeat last frame if available in case of
+ // buffer underrun
+ sample = 0;
+
+ for ( i = 0; i < *samples; i++ )
+ for ( j = 0; j < *channels; j++ )
+ {
+ jack_ringbuffer_read( input_buffers[j], ( char * )&sample, sizeof(float) );
- if ( sample > 1.0 )
- sample = 1.0;
- else if ( sample < -1.0 )
- sample = -1.0;
-
- if ( sample > 0 )
- *q ++ = 32767 * sample;
- else
- *q ++ = 32768 * sample;
- }
- }
- //else
- // fprintf( stderr, "%s: in buffer size %d\n", __FUNCTION__, jack_ringbuffer_read_space( output_buffers[0] ) );
+ if ( sample > 1.0 )
+ sample = 1.0;
+ else if ( sample < -1.0 )
+ sample = -1.0;
+
+ if ( sample > 0 )
+ *q ++ = 32767 * sample;
+ else
+ *q ++ = 32768 * sample;
+ }
return 0;
}