Skip to content

Commit

Permalink
Fix LMMS#5461 and ensure consistent use of check gate (LMMS#5475)
Browse files Browse the repository at this point in the history
* Multiple effects: Calculation of `outSum` should be after D/W mixing
* CrossoverEQ.cpp: `outSum` must be divided by frames in the end 
* CrossoverEQ.cpp: don't overwrite `outSum` in for loop, but increment it
  • Loading branch information
thmueller64 authored May 6, 2020
1 parent 8f0f28e commit eb376a0
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion plugins/Amplifier/Amplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ bool AmplifierEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
for( fpp_t f = 0; f < frames; ++f )
{
// qDebug( "offset %d, value %f", f, m_ampControls.m_volumeModel.value( f ) );
outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1];

sample_t s[2] = { buf[f][0], buf[f][1] };

Expand Down Expand Up @@ -123,6 +122,7 @@ bool AmplifierEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )

buf[f][0] = d * buf[f][0] + w * s[0];
buf[f][1] = d * buf[f][1] + w * s[1];
outSum += buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1];
}

checkGate( outSum / frames );
Expand Down
2 changes: 1 addition & 1 deletion plugins/BassBooster/BassBooster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ bool BassBoosterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames
//float gain = gainBuffer ? gainBuffer[f] : gain;
m_bbFX.leftFX().setGain( gain );
m_bbFX.rightFX().setGain( gain);
outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1];

sample_t s[2] = { buf[f][0], buf[f][1] };
m_bbFX.nextSample( s[0], s[1] );

buf[f][0] = d * buf[f][0] + w * s[0];
buf[f][1] = d * buf[f][1] + w * s[1];
outSum += buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1];
}

checkGate( outSum / frames );
Expand Down
4 changes: 2 additions & 2 deletions plugins/CrossoverEQ/CrossoverEQ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ bool CrossoverEQEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames
double outSum = 0.0;
for( int f = 0; f < frames; ++f )
{
outSum = buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1];
buf[f][0] = d * buf[f][0] + w * m_work[f][0];
buf[f][1] = d * buf[f][1] + w * m_work[f][1];
outSum += buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1];
}

checkGate( outSum );
checkGate( outSum / frames );

return isRunning();
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/DualFilter/DualFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ bool DualFilterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames
s[0] += ( s2[0] * mix2 );
s[1] += ( s2[1] * mix2 );
}
outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1];

// do another mix with dry signal
buf[f][0] = d * buf[f][0] + w * s[0];
buf[f][1] = d * buf[f][1] + w * s[1];
outSum += buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1];

//increment pointers
cut1Ptr += cut1Inc;
Expand Down
2 changes: 1 addition & 1 deletion plugins/dynamics_processor/dynamics_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ bool dynProcEffect::processAudioBuffer( sampleFrame * _buf,
s[0] *= outputGain;
s[1] *= outputGain;

out_sum += _buf[f][0]*_buf[f][0] + _buf[f][1]*_buf[f][1];
// mix wet/dry signals
_buf[f][0] = d * _buf[f][0] + w * s[0];
_buf[f][1] = d * _buf[f][1] + w * s[1];
out_sum += _buf[f][0] * _buf[f][0] + _buf[f][1] * _buf[f][1];
}

checkGate( out_sum / _frames );
Expand Down
2 changes: 1 addition & 1 deletion plugins/waveshaper/waveshaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ bool waveShaperEffect::processAudioBuffer( sampleFrame * _buf,
s[0] *= *outputPtr;
s[1] *= *outputPtr;

out_sum += _buf[f][0]*_buf[f][0] + _buf[f][1]*_buf[f][1];
// mix wet/dry signals
_buf[f][0] = d * _buf[f][0] + w * s[0];
_buf[f][1] = d * _buf[f][1] + w * s[1];
out_sum += _buf[f][0] * _buf[f][0] + _buf[f][1] * _buf[f][1];

outputPtr += outputInc;
inputPtr += inputInc;
Expand Down

0 comments on commit eb376a0

Please sign in to comment.