zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit e69cf702f762420d6d1e6fe800cfbd49e677ec24
parent f0f3e502c01dc80492e9da8d50fb5504e22288b8
Author: Christopher A. Oliver <caowasteland@gmail.com>
Date:   Thu,  5 Nov 2015 12:01:07 -0500

Fix up one sample phase shift in user base function rendering.

Undo order of operations misunderstanding.

Diffstat:
Msrc/Synth/OscilGen.cpp | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp @@ -447,7 +447,9 @@ float OscilGen::userfunc(float x) fft->freqs2smps(basefuncFFTfreqs, cachedbasefunc); cachedbasevalid = true; } - return cinterpolate(cachedbasefunc, synth.oscilsize, synth.oscilsize * x); + return cinterpolate(cachedbasefunc, + synth.oscilsize, + synth.oscilsize * x + (synth.oscilsize - 1)); } /* @@ -1344,6 +1346,9 @@ void OscilGen::getfromXML(XMLwrapper *xml) xml->exitbranch(); } + if(Pcurrentbasefunc != 0) + changebasefunction(); + if(xml->enterbranch("BASE_FUNCTION")) { for(int i = 1; i < synth.oscilsize / 2; ++i) if(xml->enterbranch("BF_HARMONIC", i)) { @@ -1354,14 +1359,10 @@ void OscilGen::getfromXML(XMLwrapper *xml) } xml->exitbranch(); - if(Pcurrentbasefunc != 0) - changebasefunction(); - clearDC(basefuncFFTfreqs); normalize(basefuncFFTfreqs, synth.oscilsize); - } else if(Pcurrentbasefunc != 0) - changebasefunction(); -} + cachedbasevalid = false; + }} //Define basic functions