Mixer: Add group DSP meters.

This commit is contained in:
Jonathan Moore Liles 2013-08-08 23:32:44 -07:00
parent 5ccc6e7595
commit dd21a18c81
4 changed files with 37 additions and 0 deletions

View File

@ -23,18 +23,21 @@
#include "Mixer_Strip.H" #include "Mixer_Strip.H"
#include "Module.H" #include "Module.H"
#include <unistd.h>
extern char *instance_name; extern char *instance_name;
Group::Group ( ) Group::Group ( )
{ {
_single =false; _single =false;
_name = NULL; _name = NULL;
_dsp_load = _load_coef = 0;
} }
Group::Group ( const char *name, bool single ) : Loggable ( !single ) Group::Group ( const char *name, bool single ) : Loggable ( !single )
{ {
_single = single; _single = single;
_name = strdup(name); _name = strdup(name);
_dsp_load = _load_coef = 0;
// this->name( name ); // this->name( name );
@ -117,6 +120,8 @@ Group::freewheel ( bool starting )
int int
Group::buffer_size ( nframes_t nframes ) Group::buffer_size ( nframes_t nframes )
{ {
recal_load_coef();
/* JACK calls this in the RT thread, even though it's a /* JACK calls this in the RT thread, even though it's a
* non-realtime operation. This mucks up our ability to do * non-realtime operation. This mucks up our ability to do
* THREAD_ASSERT, so just lie and say this is the UI thread... */ * 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 int
Group::process ( nframes_t nframes ) Group::process ( nframes_t nframes )
{ {
jack_time_t then = jack_get_time();
/* FIXME: wrong place for this */ /* FIXME: wrong place for this */
_thread.set( "RT" ); _thread.set( "RT" );
@ -167,6 +174,7 @@ Group::process ( nframes_t nframes )
return 0; return 0;
} }
/* since feedback loops are forbidden and outputs are /* since feedback loops are forbidden and outputs are
* summed, we don't care what order these are processed * summed, we don't care what order these are processed
* in */ * in */
@ -180,12 +188,21 @@ Group::process ( nframes_t nframes )
unlock(); unlock();
_dsp_load = (float)(jack_get_time() - then ) * _load_coef;
return 0; return 0;
} }
void
Group::recal_load_coef ( void )
{
_load_coef = 1.0f / ( nframes() / (float)sample_rate() * 1000000.0 );
}
int int
Group::sample_rate_changed ( nframes_t srate ) Group::sample_rate_changed ( nframes_t srate )
{ {
recal_load_coef();
for ( std::list<Mixer_Strip*>::iterator i = strips.begin(); for ( std::list<Mixer_Strip*>::iterator i = strips.begin();
i != strips.end(); i != strips.end();
i++ ) i++ )

View File

@ -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 */
/* 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 ); int sample_rate_changed ( nframes_t srate );
void shutdown ( void ); void shutdown ( void );
int process ( nframes_t nframes ); 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 request_locate ( nframes_t frame );
void recal_load_coef ( void );
protected: protected:
@ -71,6 +75,7 @@ public:
LOG_CREATE_FUNC( Group ); LOG_CREATE_FUNC( Group );
float dsp_load ( void ) const { return _dsp_load; }
int nstrips ( void ) const { return strips.size(); } int nstrips ( void ) const { return strips.size(); }
int dropped ( void ) const { return _buffers_dropped; } int dropped ( void ) const { return _buffers_dropped; }

View File

@ -458,7 +458,11 @@ Mixer_Strip::update ( void )
meter_indicator->update(); meter_indicator->update();
gain_controller->update(); gain_controller->update();
if ( _chain ) if ( _chain )
{
_chain->update(); _chain->update();
}
if ( group() )
dsp_load_progress->value( group()->dsp_load() );
} }
void void
@ -527,6 +531,15 @@ Mixer_Strip::init ( )
o->end(); o->end();
} // Fl_Group* o } // 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); { Fl_Choice* o = group_choice = new Fl_Choice(61, 183, 45, 22);
o->labeltype(FL_NO_LABEL); o->labeltype(FL_NO_LABEL);
o->labelsize(10); o->labelsize(10);

View File

@ -111,6 +111,8 @@ private:
Controller_Module *spatialization_controller; Controller_Module *spatialization_controller;
Meter_Indicator_Module *meter_indicator; Meter_Indicator_Module *meter_indicator;
Fl_Progress *dsp_load_progress;
Fl_Box *color_box; Fl_Box *color_box;
nframes_t nframes; nframes_t nframes;