diff --git a/src/jack.C b/src/jack.C index 7e501a7..76a7ff8 100644 --- a/src/jack.C +++ b/src/jack.C @@ -412,7 +412,7 @@ schedule: return 0; } -int +const char * midi_init ( void ) { MESSAGE( "Initializing Jack MIDI" ); @@ -421,7 +421,7 @@ midi_init ( void ) /* return 0; */ if (( client = jack_client_open ( APP_NAME, (jack_options_t)0, NULL )) == 0 ) - return 0; + return NULL; /* create output ports */ for ( int i = 0; i < MAX_PORT; i++ ) @@ -484,7 +484,7 @@ midi_init ( void ) MESSAGE( "Waiting for JACK..." ); usleep( 500000 ); - return 1; + return (const char *) jack_get_client_name(client); } void diff --git a/src/jack.H b/src/jack.H index 30d07cc..10cc692 100644 --- a/src/jack.H +++ b/src/jack.H @@ -11,6 +11,6 @@ midievent * midi_input_event ( int port ); void midi_output_event ( int port, const midievent *e ); void midi_output_event ( int port, const midievent *e, tick_t duration ); void midi_all_sound_off ( void ); -int midi_init ( void ); +const char * midi_init ( void ); void midi_shutdown ( void ); void midi_output_immediate_event ( int port, const midievent *e ); diff --git a/src/lash.C b/src/lash.C index f6c92d8..a16686f 100644 --- a/src/lash.C +++ b/src/lash.C @@ -27,7 +27,7 @@ #ifndef HAVE_LASH Lash::Lash ( ) {} -bool Lash::init ( int *argc, char ***argv ) { return true; } +bool Lash::init ( int *argc, char ***argv, const char *jack_name ) { return true; } void Lash::process ( void ) {} #else @@ -38,7 +38,7 @@ Lash::Lash ( ) } bool -Lash::init ( int *argc, char ***argv ) +Lash::init ( int *argc, char ***argv, const char *jack_name ) { MESSAGE( "Initializing LASH" ); @@ -47,7 +47,7 @@ Lash::init ( int *argc, char ***argv ) return false; /* register name */ - lash_jack_client_name( _client, APP_NAME ); + lash_jack_client_name( _client, jack_name ); lash_event_t *e = lash_event_new_with_type( LASH_Client_Name ); lash_event_set_string( e, APP_TITLE ); diff --git a/src/lash.H b/src/lash.H index 5067374..df8f6ca 100644 --- a/src/lash.H +++ b/src/lash.H @@ -34,7 +34,7 @@ class Lash public: Lash ( ); - bool init ( int *argc, char ***argv ); + bool init ( int *argc, char ***argv, const char *jack_name ); void process ( void ); }; diff --git a/src/main.C b/src/main.C index 21af1fa..588c137 100644 --- a/src/main.C +++ b/src/main.C @@ -167,17 +167,10 @@ main ( int argc, char **argv ) pattern::signal_create_destroy.connect( mem_fun( song, &song_settings::set_dirty ) ); phrase::signal_create_destroy.connect( mem_fun( song, &song_settings::set_dirty ) ); - if ( ! lash.init( &argc, &argv ) ) - WARNING( "error initializing LASH" ); + const char *jack_name; - if ( argc > 1 ) - { - /* maybe a filename on the commandline */ - if ( ! load_song( argv[ 1 ] ) ) - ASSERTION( "Could not load song \"%s\" specified on command line", argv[ 1 ] ); - } - - if ( ! midi_init() ) + jack_name = midi_init(); + if ( ! jack_name ) ASSERTION( "Could not initialize MIDI system! (is Jack running and with MIDI ports enabled?)" ); if ( ! transport.valid ) @@ -188,6 +181,16 @@ main ( int argc, char **argv ) ASSERTION( "Either the version of JACK you are using does pass BBT information, or the current timebase master does not provide it." ); } + if ( ! lash.init( &argc, &argv, jack_name ) ) + WARNING( "error initializing LASH" ); + + if ( argc > 1 ) + { + /* maybe a filename on the commandline */ + if ( ! load_song( argv[ 1 ] ) ) + ASSERTION( "Could not load song \"%s\" specified on command line", argv[ 1 ] ); + } + song.dirty( false ); MESSAGE( "Initializing GUI" );