Browse Source

Notify user when JACK disconnects us.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
957eed1f15
3 changed files with 34 additions and 5 deletions
  1. +16
    -0
      Timeline/Engine/Engine.C
  2. +5
    -0
      Timeline/Engine/Engine.H
  3. +13
    -5
      Timeline/TLE.fl

+ 16
- 0
Timeline/Engine/Engine.C View File

@@ -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();


+ 5
- 0
Timeline/Engine/Engine.H View File

@@ -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 ); }
};


+ 13
- 5
Timeline/TLE.fl View File

@@ -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();} {}
}
}



Loading…
Cancel
Save