Mercurial > hg > beaglert
diff projects/d-box/FeedbackOscillator.cpp @ 50:be427da6fb9c newapi
Removed old testing code that stopped audio after 10 seconds; command line parameter updates; D-Box updates (not fully working yet)
author | andrewm |
---|---|
date | Sat, 30 May 2015 12:34:32 -0500 |
parents | 8a575ba3ab52 |
children | 4f8db16f17b5 |
line wrap: on
line diff
--- a/projects/d-box/FeedbackOscillator.cpp Thu May 28 17:48:42 2015 -0400 +++ b/projects/d-box/FeedbackOscillator.cpp Sat May 30 12:34:32 2015 -0500 @@ -58,23 +58,11 @@ // Process one sample and store the output value // Returns true if the wavetable needs rendering -int FeedbackOscillator::process(uint16_t input, uint16_t *output) { - float inFloat = input / 65536.0; - float outFloat = coeffs[COEFF_B0] * inFloat + coeffs[COEFF_B1] * lastInput - coeffs[COEFF_A1] * lastOutput; +int FeedbackOscillator::process(float input, float *output) { + float outFloat = coeffs[COEFF_B0] * input + coeffs[COEFF_B1] * lastInput - coeffs[COEFF_A1] * lastOutput; int requestRenderLength = 0; - //outFloat *= 2.0; - - int intOut = outFloat * 65536.0 + 32768; - if(intOut > 65535) - intOut = 65535; - if(intOut < 0) - intOut = 0; - //intOut = (intOut & 0xFF) << 8; - //if(intOut > 65535) - // intOut = 65535; - - *output = (uint16_t)intOut; + *output = outFloat; if(canTrigger && outFloat > 0 && lastOutput <= 0) { triggered = true; @@ -106,7 +94,7 @@ sampleCount++; lastOutput = outFloat; - lastInput = inFloat; + lastInput = input; return requestRenderLength; }