FxMixer, FxMixerView: cache maximum peak until next display update
We lost short peaks because the display update rate usually is much lower than the number of audio buffers processed per second which lead to lost peaks. We mitigate this issue by caching the maximum peak value until the next display update where it is reset.
This commit is contained in:
@@ -123,10 +123,17 @@ void FxMixer::processChannel( fx_ch_t _ch, sampleFrame * _buf )
|
||||
{
|
||||
m_fxChannels[_ch]->m_fxChain.startRunning();
|
||||
m_fxChannels[_ch]->m_stillRunning = m_fxChannels[_ch]->m_fxChain.processAudioBuffer( _buf, f );
|
||||
m_fxChannels[_ch]->m_peakLeft = engine::mixer()->peakValueLeft( _buf, f ) *
|
||||
m_fxChannels[_ch]->m_volumeModel.value();
|
||||
m_fxChannels[_ch]->m_peakRight = engine::mixer()->peakValueRight( _buf, f ) *
|
||||
m_fxChannels[_ch]->m_volumeModel.value();
|
||||
float peakLeft = engine::mixer()->peakValueLeft( _buf, f ) * m_fxChannels[_ch]->m_volumeModel.value();
|
||||
float peakRight = engine::mixer()->peakValueRight( _buf, f ) * m_fxChannels[_ch]->m_volumeModel.value();
|
||||
|
||||
if( peakLeft > m_fxChannels[_ch]->m_peakLeft )
|
||||
{
|
||||
m_fxChannels[_ch]->m_peakLeft = peakLeft;
|
||||
}
|
||||
if( peakRight > m_fxChannels[_ch]->m_peakRight )
|
||||
{
|
||||
m_fxChannels[_ch]->m_peakRight = peakRight;
|
||||
}
|
||||
}
|
||||
m_fxChannels[_ch]->m_used = true;
|
||||
}
|
||||
|
||||
@@ -340,17 +340,18 @@ void FxMixerView::updateFaders()
|
||||
const float fall_off = 1.2;
|
||||
if( m->m_fxChannels[i]->m_peakLeft > opl )
|
||||
{
|
||||
m_fxChannelViews[i].m_fader->setPeak_L(
|
||||
m->m_fxChannels[i]->m_peakLeft );
|
||||
m_fxChannelViews[i].m_fader->setPeak_L( m->m_fxChannels[i]->m_peakLeft );
|
||||
m->m_fxChannels[i]->m_peakLeft = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fxChannelViews[i].m_fader->setPeak_L( opl/fall_off );
|
||||
}
|
||||
|
||||
if( m->m_fxChannels[i]->m_peakRight > opr )
|
||||
{
|
||||
m_fxChannelViews[i].m_fader->setPeak_R(
|
||||
m->m_fxChannels[i]->m_peakRight );
|
||||
m_fxChannelViews[i].m_fader->setPeak_R( m->m_fxChannels[i]->m_peakRight );
|
||||
m->m_fxChannels[i]->m_peakRight = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user