added some TODO comments

This commit is contained in:
Volker Fischer 2015-03-15 07:24:11 +00:00
parent f8fe133dcd
commit f3eaa95da5

View file

@ -101,8 +101,10 @@ void CSound::OpenJack()
// running // running
// try to connect physical input ports // try to connect physical input ports
if ( ( ports = jack_get_ports ( pJackClient, NULL, NULL, if ( ( ports = jack_get_ports ( pJackClient,
JackPortIsPhysical | JackPortIsOutput ) ) != NULL ) NULL,
NULL,
JackPortIsPhysical | JackPortIsOutput ) ) != NULL )
{ {
if ( jack_connect ( pJackClient, ports[0], jack_port_name ( input_port_left ) ) ) if ( jack_connect ( pJackClient, ports[0], jack_port_name ( input_port_left ) ) )
{ {
@ -111,6 +113,10 @@ void CSound::OpenJack()
// before connecting the second stereo channel, check if the input is not // before connecting the second stereo channel, check if the input is not
// mono // mono
// TODO who checks if ports[1] actually exists??? I assume that if we have mono, the
// ports array is only one item long...?
if ( ports[1] ) if ( ports[1] )
{ {
if ( jack_connect ( pJackClient, ports[1], jack_port_name ( input_port_right ) ) ) if ( jack_connect ( pJackClient, ports[1], jack_port_name ( input_port_right ) ) )
@ -119,12 +125,15 @@ void CSound::OpenJack()
} }
} }
// TODO shouldn't we call jack_free() function instead?
free ( ports ); free ( ports );
} }
// try to connect physical output ports // try to connect physical output ports
if ( ( ports = jack_get_ports ( pJackClient, NULL, NULL, if ( ( ports = jack_get_ports ( pJackClient,
JackPortIsPhysical | JackPortIsInput ) ) != NULL ) NULL,
NULL,
JackPortIsPhysical | JackPortIsInput ) ) != NULL )
{ {
if ( jack_connect ( pJackClient, jack_port_name ( output_port_left ), ports[0] ) ) if ( jack_connect ( pJackClient, jack_port_name ( output_port_left ), ports[0] ) )
{ {
@ -133,6 +142,10 @@ void CSound::OpenJack()
// before connecting the second stereo channel, check if the output is not // before connecting the second stereo channel, check if the output is not
// mono // mono
// TODO who checks if ports[1] actually exists??? I assume that if we have mono, the
// ports array is only one item long...?
if ( ports[1] ) if ( ports[1] )
{ {
if ( jack_connect ( pJackClient, jack_port_name ( output_port_right ), ports[1] ) ) if ( jack_connect ( pJackClient, jack_port_name ( output_port_right ), ports[1] ) )
@ -141,6 +154,7 @@ void CSound::OpenJack()
} }
} }
// TODO shouldn't we call jack_free() function instead?
free ( ports ); free ( ports );
} }
} }
@ -174,10 +188,18 @@ void CSound::Stop()
int CSound::Init ( const int /* iNewPrefMonoBufferSize */ ) int CSound::Init ( const int /* iNewPrefMonoBufferSize */ )
{ {
// try setting buffer size // try setting buffer size
// TODO seems not to work! -> no audio after this operation! // TODO seems not to work! -> no audio after this operation!
// Doesn't this give an infinite loop? The set buffer size function will call our
// registerd callback which calls "EmitReinitRequestSignal()". In that function
// this CSound::Init() function is called...
//jack_set_buffer_size ( pJackClient, iNewPrefMonoBufferSize ); //jack_set_buffer_size ( pJackClient, iNewPrefMonoBufferSize );
// get actual buffer size // get actual buffer size
iJACKBufferSizeMono = jack_get_buffer_size ( pJackClient ); iJACKBufferSizeMono = jack_get_buffer_size ( pJackClient );
@ -264,10 +286,12 @@ int CSound::process ( jack_nframes_t nframes, void* arg )
if ( out_left != 0 && out_right != 0 ) if ( out_left != 0 && out_right != 0 )
{ {
memset ( out_left, memset ( out_left,
0, sizeof ( jack_default_audio_sample_t ) * nframes ); 0,
sizeof ( jack_default_audio_sample_t ) * nframes );
memset ( out_right, memset ( out_right,
0, sizeof ( jack_default_audio_sample_t ) * nframes ); 0,
sizeof ( jack_default_audio_sample_t ) * nframes );
} }
} }