diff --git a/mixer/src/Group.C b/mixer/src/Group.C index ce21a18..9c199fa 100644 --- a/mixer/src/Group.C +++ b/mixer/src/Group.C @@ -23,18 +23,21 @@ #include "Mixer_Strip.H" #include "Module.H" +#include extern char *instance_name; Group::Group ( ) { _single =false; _name = NULL; + _dsp_load = _load_coef = 0; } Group::Group ( const char *name, bool single ) : Loggable ( !single ) { _single = single; _name = strdup(name); + _dsp_load = _load_coef = 0; // this->name( name ); @@ -117,6 +120,8 @@ Group::freewheel ( bool starting ) int Group::buffer_size ( nframes_t nframes ) { + recal_load_coef(); + /* JACK calls this in the RT thread, even though it's a * non-realtime operation. This mucks up our ability to do * THREAD_ASSERT, so just lie and say this is the UI thread... */ @@ -154,6 +159,8 @@ Group::port_connect( jack_port_id_t a, jack_port_id_t b, int connect ) int Group::process ( nframes_t nframes ) { + jack_time_t then = jack_get_time(); + /* FIXME: wrong place for this */ _thread.set( "RT" ); @@ -167,6 +174,7 @@ Group::process ( nframes_t nframes ) return 0; } + /* since feedback loops are forbidden and outputs are * summed, we don't care what order these are processed * in */ @@ -180,12 +188,21 @@ Group::process ( nframes_t nframes ) unlock(); + _dsp_load = (float)(jack_get_time() - then ) * _load_coef; + return 0; } +void +Group::recal_load_coef ( void ) +{ + _load_coef = 1.0f / ( nframes() / (float)sample_rate() * 1000000.0 ); +} int Group::sample_rate_changed ( nframes_t srate ) { + recal_load_coef(); + for ( std::list::iterator i = strips.begin(); i != strips.end(); i++ ) diff --git a/mixer/src/Group.H b/mixer/src/Group.H index 1d1ec72..818596e 100644 --- a/mixer/src/Group.H +++ b/mixer/src/Group.H @@ -41,6 +41,9 @@ class Group : public Loggable, public JACK::Client, public Mutex int _buffers_dropped; /* buffers dropped because of locking */ /* int _buffers_dropped; /\* buffers dropped because of locking *\/ */ + volatile float _dsp_load; + float _load_coef; + int sample_rate_changed ( nframes_t srate ); void shutdown ( void ); int process ( nframes_t nframes ); @@ -56,6 +59,7 @@ class Group : public Loggable, public JACK::Client, public Mutex void request_locate ( nframes_t frame ); + void recal_load_coef ( void ); protected: @@ -71,6 +75,7 @@ public: LOG_CREATE_FUNC( Group ); + float dsp_load ( void ) const { return _dsp_load; } int nstrips ( void ) const { return strips.size(); } int dropped ( void ) const { return _buffers_dropped; } diff --git a/mixer/src/Mixer_Strip.C b/mixer/src/Mixer_Strip.C index 935ad5e..aef016f 100644 --- a/mixer/src/Mixer_Strip.C +++ b/mixer/src/Mixer_Strip.C @@ -458,7 +458,11 @@ Mixer_Strip::update ( void ) meter_indicator->update(); gain_controller->update(); if ( _chain ) + { _chain->update(); + } + if ( group() ) + dsp_load_progress->value( group()->dsp_load() ); } void @@ -527,6 +531,15 @@ Mixer_Strip::init ( ) o->end(); } // Fl_Group* o + { Fl_Progress* o = dsp_load_progress = new Fl_Progress(61, 183, 45, 10, "group dsp"); + o->box(FL_FLAT_BOX); + o->type(FL_HORIZONTAL); + o->labelsize( 9 ); + o->minimum( 0 ); +// o->maximum( 0.25f ); + o->maximum( 1 ); + o->color2(FL_CYAN); + } { Fl_Choice* o = group_choice = new Fl_Choice(61, 183, 45, 22); o->labeltype(FL_NO_LABEL); o->labelsize(10); diff --git a/mixer/src/Mixer_Strip.H b/mixer/src/Mixer_Strip.H index 4f40ae1..7b43ee5 100644 --- a/mixer/src/Mixer_Strip.H +++ b/mixer/src/Mixer_Strip.H @@ -111,6 +111,8 @@ private: Controller_Module *spatialization_controller; Meter_Indicator_Module *meter_indicator; + Fl_Progress *dsp_load_progress; + Fl_Box *color_box; nframes_t nframes;