Mixer/DPM: Quick hack to add smoothing to meter values.
This commit is contained in:
parent
dd274db49b
commit
830823a226
|
@ -71,6 +71,14 @@ DPM::DPM ( int X, int Y, int W, int H, const char *L ) :
|
||||||
DPM::blend( 6, breaks, cols, color() );
|
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);
|
resize( X,Y,W,H);
|
||||||
}
|
}
|
||||||
|
@ -86,7 +94,7 @@ DPM::draw_label ( void )
|
||||||
if ( parent()->child( 0 ) == this )
|
if ( parent()->child( 0 ) == this )
|
||||||
{
|
{
|
||||||
fl_font( FL_TIMES, 8 );
|
fl_font( FL_TIMES, 8 );
|
||||||
fl_color( FL_WHITE );
|
fl_color( FL_FOREGROUND_COLOR );
|
||||||
/* draw marks */
|
/* draw marks */
|
||||||
char pat[5];
|
char pat[5];
|
||||||
if ( type() == FL_HORIZONTAL )
|
if ( type() == FL_HORIZONTAL )
|
||||||
|
@ -238,7 +246,7 @@ DPM::draw ( void )
|
||||||
|
|
||||||
/* if ( _pixels_per_segment >= 3 ) */
|
/* if ( _pixels_per_segment >= 3 ) */
|
||||||
/* { */
|
/* { */
|
||||||
/* fl_color( FL_DARK1 ); */
|
/* fl_color( FL_CYAN ); */
|
||||||
|
|
||||||
/* if ( type() == FL_HORIZONTAL ) */
|
/* 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();
|
fl_pop_clip();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <FL/Fl_Valuator.H> // for FL_HORIZONTAL and FL_VERTICAL
|
#include <FL/Fl_Valuator.H> // for FL_HORIZONTAL and FL_VERTICAL
|
||||||
|
|
||||||
#include "Meter.H"
|
#include "Meter.H"
|
||||||
|
#include "dsp.h"
|
||||||
|
|
||||||
class DPM : public Meter
|
class DPM : public Meter
|
||||||
{
|
{
|
||||||
|
@ -31,6 +32,8 @@ class DPM : public Meter
|
||||||
int _pixels_per_segment;
|
int _pixels_per_segment;
|
||||||
int _last_drawn_hi_segment;
|
int _last_drawn_hi_segment;
|
||||||
|
|
||||||
|
Value_Smoothing_Filter smoothing;
|
||||||
|
|
||||||
float _value;
|
float _value;
|
||||||
|
|
||||||
int pos ( float v )
|
int pos ( float v )
|
||||||
|
@ -71,6 +74,11 @@ public:
|
||||||
|
|
||||||
void value ( float v )
|
void value ( float v )
|
||||||
{
|
{
|
||||||
|
sample_t buf[100];
|
||||||
|
|
||||||
|
if ( smoothing.apply( buf, 1, v ) )
|
||||||
|
v = buf[0];
|
||||||
|
|
||||||
if ( _value != v )
|
if ( _value != v )
|
||||||
{
|
{
|
||||||
if ( pos( v ) != pos( _value ) )
|
if ( pos( v ) != pos( _value ) )
|
||||||
|
|
|
@ -237,6 +237,7 @@ Value_Smoothing_Filter::sample_rate ( nframes_t n )
|
||||||
w = _cutoff / (FS * T);
|
w = _cutoff / (FS * T);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: need a method that just returns a single value, skipping the within-buffer interpolation */
|
||||||
bool
|
bool
|
||||||
Value_Smoothing_Filter::apply( sample_t * __restrict__ dst, nframes_t nframes, float gt )
|
Value_Smoothing_Filter::apply( sample_t * __restrict__ dst, nframes_t nframes, float gt )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue