diff --git a/mixer/src/DPM.C b/mixer/src/DPM.C index 0873165..2fc6d32 100644 --- a/mixer/src/DPM.C +++ b/mixer/src/DPM.C @@ -71,7 +71,15 @@ DPM::DPM ( int X, int Y, int W, int H, const char *L ) : DPM::blend( 6, breaks, cols, color() ); } + { + smoothing.cutoff(25); + smoothing.sample_rate(1500); + /* clear initial hump */ + sample_t t[1500]; + smoothing.apply(t,1500,-70); + } + resize( X,Y,W,H); } @@ -86,7 +94,7 @@ DPM::draw_label ( void ) if ( parent()->child( 0 ) == this ) { fl_font( FL_TIMES, 8 ); - fl_color( FL_WHITE ); + fl_color( FL_FOREGROUND_COLOR ); /* draw marks */ char pat[5]; if ( type() == FL_HORIZONTAL ) @@ -238,7 +246,7 @@ DPM::draw ( void ) /* if ( _pixels_per_segment >= 3 ) */ /* { */ - /* fl_color( FL_DARK1 ); */ + /* fl_color( FL_CYAN ); */ /* if ( type() == FL_HORIZONTAL ) */ /* { */ @@ -260,5 +268,19 @@ DPM::draw ( void ) /* } */ } + /* fl_color( fl_color_add_alpha( FL_WHITE, 127 ) ); */ + + /* for ( int i = 0; i < 50; i++ ) */ + /* { */ + /* int yy = Y + i * H / 50; */ + + /* if ( type() == FL_VERTICAL ) */ + /* { */ + /* int ww = i % 2 == 0 ? W : W / 2; */ + + /* fl_line( X + ((W/2) - ww/2), yy, X + ww - 1, yy ); */ + /* } */ + /* } */ + fl_pop_clip(); } diff --git a/mixer/src/DPM.H b/mixer/src/DPM.H index 18e694a..70ebb33 100644 --- a/mixer/src/DPM.H +++ b/mixer/src/DPM.H @@ -22,6 +22,7 @@ #include // for FL_HORIZONTAL and FL_VERTICAL #include "Meter.H" +#include "dsp.h" class DPM : public Meter { @@ -31,6 +32,8 @@ class DPM : public Meter int _pixels_per_segment; int _last_drawn_hi_segment; + Value_Smoothing_Filter smoothing; + float _value; int pos ( float v ) @@ -71,6 +74,11 @@ public: void value ( float v ) { + sample_t buf[100]; + + if ( smoothing.apply( buf, 1, v ) ) + v = buf[0]; + if ( _value != v ) { if ( pos( v ) != pos( _value ) ) diff --git a/nonlib/dsp.C b/nonlib/dsp.C index e77ae45..e6d4fe3 100644 --- a/nonlib/dsp.C +++ b/nonlib/dsp.C @@ -237,6 +237,7 @@ Value_Smoothing_Filter::sample_rate ( nframes_t n ) w = _cutoff / (FS * T); } +/* FIXME: need a method that just returns a single value, skipping the within-buffer interpolation */ bool Value_Smoothing_Filter::apply( sample_t * __restrict__ dst, nframes_t nframes, float gt ) {