Mercurial > hg > beaglert
changeset 51:4f8db16f17b5 newapi
D-Box updates; should work as old version did
author | andrewm |
---|---|
date | Sat, 30 May 2015 13:25:51 -0500 |
parents | be427da6fb9c |
children | a6d223473ea2 |
files | projects/d-box/FeedbackOscillator.cpp projects/d-box/render.cpp |
diffstat | 2 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/projects/d-box/FeedbackOscillator.cpp Sat May 30 12:34:32 2015 -0500 +++ b/projects/d-box/FeedbackOscillator.cpp Sat May 30 13:25:51 2015 -0500 @@ -62,7 +62,12 @@ float outFloat = coeffs[COEFF_B0] * input + coeffs[COEFF_B1] * lastInput - coeffs[COEFF_A1] * lastOutput; int requestRenderLength = 0; - *output = outFloat; + if(outFloat < -0.5) + *output = 0; + else if(outFloat > 0.5) + *output = 1; + else + *output = outFloat + 0.5; if(canTrigger && outFloat > 0 && lastOutput <= 0) { triggered = true;
--- a/projects/d-box/render.cpp Sat May 30 12:34:32 2015 -0500 +++ b/projects/d-box/render.cpp Sat May 30 13:25:51 2015 -0500 @@ -106,8 +106,8 @@ float octaveSplitter; float semitones[((int)N_OCT*12)+1]; float deltaTouch = 0; -float deltaWeightP = 0.5; -float deltaWeightI = 0.0005; +float deltaWeightP = 0.5 / 65536.0; +float deltaWeightI = 0.0005 / 65536.0; // filter vars ne10_fir_instance_f32_t filter[2]; @@ -370,7 +370,7 @@ // current pitch is gPitchLatestInput, already retrieved semitoneIndex = ( gPitchLatestInput * 12 * N_OCT )+0.5; // closest semitone deltaTarget = (semitones[semitoneIndex]-gPitchLatestInput); // delta between pitch and target - deltaTouch += deltaTarget*deltaWeightI; // update feedback [previous + current] + deltaTouch += deltaTarget*(deltaWeightI); // update feedback [previous + current] } else deltaTouch = 0;