diff --git a/Timeline/Engine/Engine.C b/Timeline/Engine/Engine.C index 6516c57..7bc4bad 100644 --- a/Timeline/Engine/Engine.C +++ b/Timeline/Engine/Engine.C @@ -33,6 +33,7 @@ Engine::Engine ( ) : _thread( "RT" ) { _freewheeling = false; + _zombified = false; _client = NULL; _buffers_dropped = 0; _xruns = 0; @@ -254,6 +255,19 @@ Engine::thread_init ( void ) _thread.set( "RT" ); } + +void +Engine::shutdown ( void *arg ) +{ + ((Engine*)arg)->shutdown(); +} + +void +Engine::shutdown ( void ) +{ + _zombified = true; +} + int Engine::init ( void ) { @@ -274,6 +288,8 @@ Engine::init ( void ) jack_set_timebase_callback( _client, 0, &Engine::timebase, this ); + jack_on_shutdown( _client, &Engine::shutdown, this ); + jack_activate( _client ); _sample_rate = frame_rate(); diff --git a/Timeline/Engine/Engine.H b/Timeline/Engine/Engine.H index 4b5076b..1bfae37 100644 --- a/Timeline/Engine/Engine.H +++ b/Timeline/Engine/Engine.H @@ -49,7 +49,11 @@ class Engine : public Mutex nframes_t _sample_rate; volatile int _xruns; volatile bool _freewheeling; + volatile bool _zombified; + + static void shutdown ( void *arg ); + void shutdown ( void ); static int process ( nframes_t nframes, void *arg ); int process ( nframes_t nframes ); static int sync ( jack_transport_state_t state, jack_position_t *pos, void *arg ); @@ -90,6 +94,7 @@ public: int dropped ( void ) const { return _buffers_dropped; } bool freewheeling ( void ) const { return _freewheeling; } void freewheeling ( bool yes ); + bool zombified ( void ) const { return _zombified; } float cpu_load ( void ) const { return jack_cpu_load( _client ); } }; diff --git a/Timeline/TLE.fl b/Timeline/TLE.fl index 02d5f5e..7cd9c3b 100644 --- a/Timeline/TLE.fl +++ b/Timeline/TLE.fl @@ -161,9 +161,9 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {} } { Fl_Window main_window { label Timeline open - xywh {177 137 1025 770} type Double resizable xclass Non_DAW visible + xywh {894 189 1025 770} type Double resizable xclass Non_DAW visible } { - Fl_Menu_Bar menubar {open + Fl_Menu_Bar menubar { xywh {0 0 1024 25} } { Submenu {} { @@ -696,7 +696,16 @@ if ( timeline->total_playback_xruns() ) -xruns_output->value( engine->xruns() );} {} +xruns_output->value( engine->xruns() ); + +static bool zombie = false; + +if ( engine->zombified() && ! zombie ) +{ + zombie = true; + fl_alert( "Disconnected from JACK!" ); +}} {selected + } } Function {update_cb( void *v )} {return_type {static void} } { @@ -825,8 +834,7 @@ update_progress( progress, pat, p ); progress->redraw(); -Fl::check();} {selected - } +Fl::check();} {} } }