Browse Source

Mixer: Fix -3db error in meter display.

tags/non-daw-v1.2.0
Jonathan Moore Liles 13 years ago
parent
commit
c53cb2e7fe
2 changed files with 11 additions and 8 deletions
  1. +8
    -2
      mixer/src/DPM.C
  2. +3
    -6
      mixer/src/Meter_Module.C

+ 8
- 2
mixer/src/DPM.C 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 );



+ 3
- 6
mixer/src/Meter_Module.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;


Loading…
Cancel
Save