Add xrun display to GUI.
This commit is contained in:
parent
1fae0b89d7
commit
a213dd2c66
|
@ -33,21 +33,30 @@ Engine::Engine ( )
|
|||
_buffers_dropped = 0;
|
||||
}
|
||||
|
||||
/*******************/
|
||||
/* Static Wrappers */
|
||||
/*******************/
|
||||
|
||||
/* static wrapper */
|
||||
int
|
||||
Engine::process ( nframes_t nframes, void *arg )
|
||||
{
|
||||
return ((Engine*)arg)->process( nframes );
|
||||
}
|
||||
|
||||
/* static wrapper */
|
||||
int
|
||||
Engine::sync ( jack_transport_state_t state, jack_position_t *pos, void *arg )
|
||||
{
|
||||
return ((Engine*)arg)->sync( state, pos );
|
||||
}
|
||||
|
||||
int
|
||||
Engine::xrun ( void *arg )
|
||||
{
|
||||
return ((Engine*)arg)->xrun( arg );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
Engine::request_locate ( nframes_t frame )
|
||||
{
|
||||
|
@ -55,6 +64,16 @@ Engine::request_locate ( nframes_t frame )
|
|||
timeline->seek( frame );
|
||||
}
|
||||
|
||||
/* THREAD: RT */
|
||||
/** This is the jack xrun callback */
|
||||
int
|
||||
Engine::xrun ( void )
|
||||
{
|
||||
++_xruns;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* THREAD: RT */
|
||||
/** This is the jack slow-sync callback. */
|
||||
int
|
||||
|
@ -140,11 +159,13 @@ Engine::init ( void )
|
|||
if (( _client = jack_client_open ( APP_NAME, (jack_options_t)0, NULL )) == 0 )
|
||||
return 0;
|
||||
|
||||
jack_set_process_callback( _client, &Engine::process, this );
|
||||
#define set_callback( name ) jack_set_ ## name ## _callback( _client, &Engine:: name , this )
|
||||
|
||||
set_callback( process );
|
||||
set_callback( xrun );
|
||||
/* FIXME: should we wait to register this until after the session
|
||||
has been loaded (and we have disk threads running)? */
|
||||
jack_set_sync_callback( _client, &Engine::sync, this );
|
||||
set_callback( sync );
|
||||
|
||||
jack_activate( _client );
|
||||
|
||||
|
|
|
@ -41,11 +41,15 @@ class Engine : public Mutex
|
|||
blocking operations. */
|
||||
|
||||
int _buffers_dropped; /* buffers dropped because of locking */
|
||||
nframes_t _sample_rate;
|
||||
volatile int _xruns;
|
||||
|
||||
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 );
|
||||
int sync ( jack_transport_state_t state, jack_position_t *pos );
|
||||
static int xrun ( void *arg );
|
||||
int xrun ( void );
|
||||
|
||||
private:
|
||||
|
||||
|
@ -53,7 +57,6 @@ private:
|
|||
friend class Transport;
|
||||
jack_client_t * client ( void ) { return _client; }
|
||||
|
||||
nframes_t _sample_rate;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -66,6 +69,7 @@ public:
|
|||
nframes_t nframes ( void ) const { return jack_get_buffer_size( _client ); }
|
||||
float frame_rate ( void ) const { return jack_get_sample_rate( _client ); }
|
||||
nframes_t sample_rate ( void ) const { return _sample_rate; }
|
||||
int xruns ( void ) const { return _xruns; };
|
||||
|
||||
float cpu_load ( void ) const { return jack_cpu_load( _client ); }
|
||||
};
|
||||
|
|
|
@ -112,9 +112,9 @@ free( path );} {}
|
|||
} {
|
||||
Fl_Window main_window {
|
||||
label {Non-DAW - Timeline} open
|
||||
xywh {577 50 1024 768} type Double resizable xclass {Non-DAW} visible
|
||||
xywh {577 94 1024 768} type Double resizable xclass {Non-DAW} visible
|
||||
} {
|
||||
Fl_Menu_Bar menubar {open selected
|
||||
Fl_Menu_Bar menubar {
|
||||
xywh {0 0 1024 25}
|
||||
} {
|
||||
Submenu {} {
|
||||
|
@ -509,6 +509,10 @@ delete win;}
|
|||
code0 {timeline = o;}
|
||||
class Timeline
|
||||
}
|
||||
Fl_Value_Output xruns_output {
|
||||
label {xruns:} selected
|
||||
xywh {980 2 44 20} maximum 40000 step 1
|
||||
}
|
||||
}
|
||||
}
|
||||
Function {update_progress( Fl_Progress *p, char *s, float v )} {open private return_type {static void}
|
||||
|
@ -525,7 +529,10 @@ p->label( s );} {}
|
|||
|
||||
update_progress( capture_buffer_progress, cbp, timeline->total_input_buffer_percent() );
|
||||
update_progress( playback_buffer_progress, pbp, timeline->total_output_buffer_percent() );
|
||||
update_progress( cpu_load_progress, clp, engine->cpu_load() );} {}
|
||||
update_progress( cpu_load_progress, clp, engine->cpu_load() );
|
||||
|
||||
|
||||
xruns_output->value( engine->xruns() );} {}
|
||||
}
|
||||
Function {update_cb( void *v )} {open return_type {static void}
|
||||
} {
|
||||
|
|
Loading…
Reference in New Issue