Mixer: Add group DSP meters.

pull/116/head
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 "Module.H"
#include <unistd.h>
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<Mixer_Strip*>::iterator i = strips.begin();
i != strips.end();
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 *\/ */
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; }

View File

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

View File

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