Display an error message when the JACK transport is broken.

This commit is contained in:
Jonathan Moore Liles 2008-03-18 20:54:31 -05:00
parent eca26e797c
commit 529a003fe3
3 changed files with 21 additions and 6 deletions

18
jack.C
View File

@ -368,7 +368,10 @@ midi_init ( void )
{
MESSAGE( "Initializing Jack MIDI" );
if (( client = jack_client_new ( APP_NAME )) == 0 )
/* if (( client = jack_client_new ( APP_NAME )) == 0 ) */
/* return 0; */
if (( client = jack_client_open ( APP_NAME, (jack_options_t)0, NULL )) == 0 )
return 0;
/* create output ports */
@ -406,9 +409,6 @@ midi_init ( void )
//1 jack_set_buffer_size_callback( client, bufsize, 0 );
jack_set_process_callback( client, process, 0 );
jack_activate( client );
sample_rate = jack_get_sample_rate( client );
/* /\* initialize buffer size *\/ */
/* transport_poll(); */
@ -422,6 +422,16 @@ midi_init ( void )
else
WARNING( "could not take over as timebase master" );
jack_activate( client );
sample_rate = jack_get_sample_rate( client );
/* FIXME: hack! we need to wait until jack finally calls our
* timebase and process callbacks in order to be able to test for
* valid transport info. */
MESSAGE( "Waiting for JACK..." );
usleep( 500000 );
return 1;
}

3
main.C
View File

@ -164,6 +164,9 @@ main ( int argc, char **argv )
if ( ! midi_init() )
ASSERTION( "Could not initialize MIDI system! (is Jack running and with MIDI ports enabled?)" );
if ( ! transport.valid )
ASSERTION( "The version of JACK you are using does not appear to be capable of passing BBT positional information." );
MESSAGE( "Initializing GUI" );
init_colors();

View File

@ -33,7 +33,7 @@ extern jack_client_t *client;
Transport transport;
static bool _done;
static volatile bool _done;
/** callback for when we're Timebase Master, mostly taken from
* transport.c in Jack's example clients. */
@ -100,7 +100,9 @@ Transport::poll ( void )
ts = jack_transport_query( client, &pos );
rolling = ts == JackTransportRolling;
valid = pos.valid == JackPositionBBT;
valid = pos.valid & JackPositionBBT;
bar = pos.bar;
beat = pos.beat;
tick = pos.tick;