Mixer: Fix -3db error in meter display.

pull/3/head
Jonathan Moore Liles 2012-06-28 18:01:44 -07:00
parent 89d26989f3
commit c53cb2e7fe
2 changed files with 11 additions and 8 deletions

View File

@ -131,6 +131,8 @@ DPM::draw ( void )
int v = pos( value() );
int pv = pos( peak() );
int clipv = pos( 0 );
int bh = h() / _segments;
int bw = w() / _segments;
@ -172,11 +174,15 @@ DPM::draw ( void )
for ( int p = lo; p <= hi; p++ )
{
Fl_Color c = DPM::div_color( p );
Fl_Color c;
if ( p > v && p != pv )
c = dim_div_color( p );
else if ( p != clipv )
c = div_color( p );
else
c = fl_color_average( FL_YELLOW, div_color( p ), 0.40 );
if ( ! active )
c = fl_inactive( c );

View File

@ -192,11 +192,7 @@ get_peak_sample ( const sample_t* buf, nframes_t nframes )
for ( int j = nframes; j--; ++f )
{
float s = *f;
/* rectify */
if ( s < 0.0f )
s = 0 - s;
const float s = fabs( *f );
if ( s > p )
p = s;
@ -212,7 +208,8 @@ Meter_Module::process ( nframes_t nframes )
{
if ( audio_input[i].connected() )
{
float dB = 20 * log10( get_peak_sample( (float*)audio_input[i].buffer(), nframes ) / 2.0f );
// float dB = 20 * log10( get_peak_sample( (float*)audio_input[i].buffer(), nframes ) / 2.0f );
float dB = 20 * log10( get_peak_sample( (float*)audio_input[i].buffer(), nframes ) );
((float*)control_output[0].buffer())[i] = dB;
control_value[i] = dB;