diff --git a/src/core/EffectChain.cpp b/src/core/EffectChain.cpp index a1aea9d3a..efadca525 100644 --- a/src/core/EffectChain.cpp +++ b/src/core/EffectChain.cpp @@ -202,11 +202,8 @@ bool EffectChain::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames, b { return false; } - const bool exporting = Engine::getSong()->isExporting(); - if( exporting ) // strip infs/nans if exporting - { - MixHelpers::sanitize( _buf, _frames ); - } + + MixHelpers::sanitize( _buf, _frames ); bool moreEffects = false; for( EffectList::Iterator it = m_effects.begin(); it != m_effects.end(); ++it ) @@ -214,10 +211,7 @@ bool EffectChain::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames, b if( hasInputNoise || ( *it )->isRunning() ) { moreEffects |= ( *it )->processAudioBuffer( _buf, _frames ); - if( exporting ) // strip infs/nans if exporting - { - MixHelpers::sanitize( _buf, _frames ); - } + MixHelpers::sanitize( _buf, _frames ); } } diff --git a/src/core/FxMixer.cpp b/src/core/FxMixer.cpp index 5ac23639a..62b68b7a3 100644 --- a/src/core/FxMixer.cpp +++ b/src/core/FxMixer.cpp @@ -117,7 +117,6 @@ void FxChannel::unmuteForSolo() void FxChannel::doProcessing() { const fpp_t fpp = Engine::mixer()->framesPerPeriod(); - const bool exporting = Engine::getSong()->isExporting(); if( m_muted == false ) { @@ -140,25 +139,21 @@ void FxChannel::doProcessing() if( ! volBuf && ! sendBuf ) // neither volume nor send has sample-exact data... { const float v = sender->m_volumeModel.value() * sendModel->value(); - if( exporting ) { MixHelpers::addSanitizedMultiplied( m_buffer, ch_buf, v, fpp ); } - else { MixHelpers::addMultiplied( m_buffer, ch_buf, v, fpp ); } + MixHelpers::addSanitizedMultiplied( m_buffer, ch_buf, v, fpp ); } else if( volBuf && sendBuf ) // both volume and send have sample-exact data { - if( exporting ) { MixHelpers::addSanitizedMultipliedByBuffers( m_buffer, ch_buf, volBuf, sendBuf, fpp ); } - else { MixHelpers::addMultipliedByBuffers( m_buffer, ch_buf, volBuf, sendBuf, fpp ); } + MixHelpers::addSanitizedMultipliedByBuffers( m_buffer, ch_buf, volBuf, sendBuf, fpp ); } else if( volBuf ) // volume has sample-exact data but send does not { const float v = sendModel->value(); - if( exporting ) { MixHelpers::addSanitizedMultipliedByBuffer( m_buffer, ch_buf, v, volBuf, fpp ); } - else { MixHelpers::addMultipliedByBuffer( m_buffer, ch_buf, v, volBuf, fpp ); } + MixHelpers::addSanitizedMultipliedByBuffer( m_buffer, ch_buf, v, volBuf, fpp ); } else // vice versa { const float v = sender->m_volumeModel.value(); - if( exporting ) { MixHelpers::addSanitizedMultipliedByBuffer( m_buffer, ch_buf, v, sendBuf, fpp ); } - else { MixHelpers::addMultipliedByBuffer( m_buffer, ch_buf, v, sendBuf, fpp ); } + MixHelpers::addSanitizedMultipliedByBuffer( m_buffer, ch_buf, v, sendBuf, fpp ); } m_hasInput = true; } diff --git a/src/core/MixHelpers.cpp b/src/core/MixHelpers.cpp index 001aa05cc..60fa778af 100644 --- a/src/core/MixHelpers.cpp +++ b/src/core/MixHelpers.cpp @@ -82,6 +82,10 @@ bool sanitize( sampleFrame * src, int frames ) src[f][c] = 0.0f; found = true; } + else + { + src[f][c] = qBound( -4.0f, src[f][c], 4.0f ); + } } } return found;