zynaddsubfx

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

commit 3f843d4fc9b4bc2e1b9f96962c0725c82f921371
parent 30c6c668c537c7a052fddc5228950c0d42f69b1f
Author: paulnasca <paulnasca>
Date:   Fri, 29 Apr 2005 14:54:16 +0000

*** empty log message ***

Diffstat:
Msrc/Synth/LFO.C | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/Synth/LFO.C b/src/Synth/LFO.C @@ -108,7 +108,12 @@ REALTYPE LFO::lfoout(){ else out*=lfointensity*amp2; if (lfodelay<0.00001) { if (freqrndenabled==0) x+=incx; - else x+=incx*(incrnd*(1.0-x)+nextincrnd*x); + else { + float tmp=(incrnd*(1.0-x)+nextincrnd*x) + if (tmp>1.0) tmp=1.0; + else if (tmp<0.0) tmp=0.0; + x+=incx*tmp; + }; if (x>=1) { x=fmod(x,1.0); amp1=amp2; @@ -136,6 +141,5 @@ void LFO::computenextincrnd(){ if (freqrndenabled==0) return; incrnd=nextincrnd; nextincrnd=pow(0.5,lfofreqrnd)+RND*(pow(2.0,lfofreqrnd)-1.0); - if (nextincrnd*incx>=0.49999999) nextincrnd=0.499999999; };