Make sure that every highest peak value is drawn
As process is usually called more often than update_cb, we should store the highest peak value until it is consumed by update_cb.
This commit is contained in:
parent
e6e101fc67
commit
ec8bfcba63
|
@ -183,6 +183,7 @@ Meter_Indicator_Module::update_cb ( void )
|
|||
for ( int i = 0; i < dpm_pack->children(); ++i )
|
||||
{
|
||||
((DPM*)dpm_pack->child( i ))->value( control_value[i] );
|
||||
control_value[i] = -70.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +276,9 @@ Meter_Indicator_Module::process ( nframes_t )
|
|||
|
||||
for ( int i = 0; i < p->hints.dimensions; ++i )
|
||||
{
|
||||
control_value[i] = ((float*)control_input[0].buffer())[i];
|
||||
float dB = ((float*)control_input[0].buffer())[i];
|
||||
if ( dB > control_value[i])
|
||||
control_value[i] = dB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,10 @@ Meter_Module::update_cb ( void )
|
|||
Fl::repeat_timeout( METER_UPDATE_FREQ, update_cb, this );
|
||||
|
||||
for ( int i = dpm_pack->children(); i--; )
|
||||
{
|
||||
((DPM*)dpm_pack->child( i ))->value( control_value[i] );
|
||||
control_value[i] = -70.0f;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -212,6 +215,7 @@ Meter_Module::process ( nframes_t nframes )
|
|||
float dB = 20 * log10( get_peak_sample( (float*)audio_input[i].buffer(), nframes ) );
|
||||
|
||||
((float*)control_output[0].buffer())[i] = dB;
|
||||
if (dB > control_value[i])
|
||||
control_value[i] = dB;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue