BassBoost, seperated sample exact and regular process loops

This was done to increase performance when sample exactness
is not in use. This was a consern becasue of the 2 extra function
calls each frame introduced with SA.
This commit is contained in:
Dave French
2015-03-16 06:57:12 +00:00
parent 1cb7336189
commit c747c7a9ee

View File

@@ -91,18 +91,37 @@ bool BassBoosterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames
double outSum = 0.0;
const float d = dryLevel();
const float w = wetLevel();
for( fpp_t f = 0; f < frames; ++f )
if( gainBuffer )
{
//process period using sample exact data
for( fpp_t f = 0; f < frames; ++f )
{
m_bbFX.leftFX().setGain( *gainPtr );
m_bbFX.rightFX().setGain( *gainPtr );
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];
gainPtr += gainInc;
}
} else
{
//process period without sample exact data
m_bbFX.leftFX().setGain( *gainPtr );
m_bbFX.rightFX().setGain( *gainPtr );
outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1];
for( fpp_t f = 0; f < frames; ++f )
{
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] );
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];
gainPtr += gainInc;
buf[f][0] = d * buf[f][0] + w * s[0];
buf[f][1] = d * buf[f][1] + w * s[1];
}
}
checkGate( outSum / frames );