Browse Source

Display an error message when the JACK transport is broken.

tags/non-sequencer-v1.9.4
Jonathan Moore Liles 17 years ago
parent
commit
529a003fe3
3 changed files with 21 additions and 6 deletions
  1. +14
    -4
      jack.C
  2. +3
    -0
      main.C
  3. +4
    -2
      transport.C

+ 14
- 4
jack.C View File

@@ -368,7 +368,10 @@ midi_init ( void )
{ {
MESSAGE( "Initializing Jack MIDI" ); 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; return 0;


/* create output ports */ /* create output ports */
@@ -406,9 +409,6 @@ midi_init ( void )
//1 jack_set_buffer_size_callback( client, bufsize, 0 ); //1 jack_set_buffer_size_callback( client, bufsize, 0 );
jack_set_process_callback( client, process, 0 ); jack_set_process_callback( client, process, 0 );


jack_activate( client );

sample_rate = jack_get_sample_rate( client );


/* /\* initialize buffer size *\/ */ /* /\* initialize buffer size *\/ */
/* transport_poll(); */ /* transport_poll(); */
@@ -422,6 +422,16 @@ midi_init ( void )
else else
WARNING( "could not take over as timebase master" ); 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; return 1;
} }




+ 3
- 0
main.C View File

@@ -164,6 +164,9 @@ main ( int argc, char **argv )
if ( ! midi_init() ) if ( ! midi_init() )
ASSERTION( "Could not initialize MIDI system! (is Jack running and with MIDI ports enabled?)" ); 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" ); MESSAGE( "Initializing GUI" );


init_colors(); init_colors();


+ 4
- 2
transport.C View File

@@ -33,7 +33,7 @@ extern jack_client_t *client;


Transport transport; Transport transport;


static bool _done;
static volatile bool _done;


/** callback for when we're Timebase Master, mostly taken from /** callback for when we're Timebase Master, mostly taken from
* transport.c in Jack's example clients. */ * transport.c in Jack's example clients. */
@@ -100,7 +100,9 @@ Transport::poll ( void )
ts = jack_transport_query( client, &pos ); ts = jack_transport_query( client, &pos );


rolling = ts == JackTransportRolling; rolling = ts == JackTransportRolling;
valid = pos.valid == JackPositionBBT;

valid = pos.valid & JackPositionBBT;

bar = pos.bar; bar = pos.bar;
beat = pos.beat; beat = pos.beat;
tick = pos.tick; tick = pos.tick;


Loading…
Cancel
Save