Using fast_rand, FAST_MAX_RAND

Stopped accessing value() inside process loop
This commit is contained in:
dave
2014-11-27 19:30:40 +00:00
parent 94047beffe
commit 59641a43a3
2 changed files with 4 additions and 3 deletions

View File

@@ -93,6 +93,7 @@ bool FlangerEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )
const float length = m_flangerControls.m_delayTimeModel.value() * Engine::mixer()->processingSampleRate();
const float noise = m_flangerControls.m_whiteNoiseAmountModel.value();
float amplitude = m_flangerControls.m_lfoAmountModel.value() * Engine::mixer()->processingSampleRate();
bool invertFeedback = m_flangerControls.m_invertFeedbackModel.value();
m_lfo->setFrequency( m_flangerControls.m_lfoFrequencyModel.value() );
m_lDelay->setFeedback( m_flangerControls.m_feedbackModel.value() );
m_rDelay->setFeedback( m_flangerControls.m_feedbackModel.value() );
@@ -108,7 +109,7 @@ bool FlangerEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )
m_lfo->tick(&leftLfo, &rightLfo);
m_lDelay->setLength( ( float )length + ( amplitude * leftLfo ) );
m_rDelay->setLength( ( float )length+ ( amplitude * rightLfo ) );
if(m_flangerControls.m_invertFeedbackModel.value())
if(invertFeedback)
{
m_lDelay->tick( &buf[f][1] );
m_rDelay->tick(&buf[f][0] );

View File

@@ -27,7 +27,7 @@
Noise::Noise()
{
inv_randmax = 1.0/RAND_MAX; /* for range of 0 - 1.0 */
inv_randmax = 1.0/FAST_RAND_MAX; /* for range of 0 - 1.0 */
}
@@ -35,5 +35,5 @@ Noise::Noise()
float Noise::tick()
{
return (float) ((2.0 * rand() * inv_randmax) - 1.0);
return (float) ((2.0 * fast_rand() * inv_randmax) - 1.0);
}