Mixer: Fix -3db error in meter display.
This commit is contained in:
parent
89d26989f3
commit
c53cb2e7fe
|
@ -131,6 +131,8 @@ DPM::draw ( void )
|
||||||
int v = pos( value() );
|
int v = pos( value() );
|
||||||
int pv = pos( peak() );
|
int pv = pos( peak() );
|
||||||
|
|
||||||
|
int clipv = pos( 0 );
|
||||||
|
|
||||||
int bh = h() / _segments;
|
int bh = h() / _segments;
|
||||||
int bw = w() / _segments;
|
int bw = w() / _segments;
|
||||||
|
|
||||||
|
@ -172,10 +174,14 @@ DPM::draw ( void )
|
||||||
|
|
||||||
for ( int p = lo; p <= hi; p++ )
|
for ( int p = lo; p <= hi; p++ )
|
||||||
{
|
{
|
||||||
Fl_Color c = DPM::div_color( p );
|
Fl_Color c;
|
||||||
|
|
||||||
if ( p > v && p != pv )
|
if ( p > v && p != pv )
|
||||||
c = dim_div_color( p );
|
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 )
|
if ( ! active )
|
||||||
c = fl_inactive( c );
|
c = fl_inactive( c );
|
||||||
|
|
|
@ -192,11 +192,7 @@ get_peak_sample ( const sample_t* buf, nframes_t nframes )
|
||||||
|
|
||||||
for ( int j = nframes; j--; ++f )
|
for ( int j = nframes; j--; ++f )
|
||||||
{
|
{
|
||||||
float s = *f;
|
const float s = fabs( *f );
|
||||||
|
|
||||||
/* rectify */
|
|
||||||
if ( s < 0.0f )
|
|
||||||
s = 0 - s;
|
|
||||||
|
|
||||||
if ( s > p )
|
if ( s > p )
|
||||||
p = s;
|
p = s;
|
||||||
|
@ -212,7 +208,8 @@ Meter_Module::process ( nframes_t nframes )
|
||||||
{
|
{
|
||||||
if ( audio_input[i].connected() )
|
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;
|
((float*)control_output[0].buffer())[i] = dB;
|
||||||
control_value[i] = dB;
|
control_value[i] = dB;
|
||||||
|
|
Loading…
Reference in New Issue