zynaddsubfx

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

commit 2749f19d371c9b1bcb572681b61592e283d601a3
parent a4d431e32d937825048fb6a0b2a29c0fa40fe5d2
Author: paulnasca <paulnasca>
Date:   Sat, 28 Feb 2004 18:25:44 +0000

*** empty log message ***

Diffstat:
MChangeLog | 2++
Msrc/Synth/ADnote.C | 13++++++++++---
Msrc/Synth/LFO.C | 8+++++---
3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -546,5 +546,7 @@ 25 Feb 2004 - La Bank - inceput sa scriu partea ca sa arate instrumentele din banca 26 Feb 2004 - Continuat la Bank 27 Feb 2004 - Corectate erori la snprintf ( nu dadeam parametru "%s" inainte de string si daca acel string continea ceva %, era periculos) si alte erori + - Micsorat timpul de marire amplitudine la ADnote (doar in cazul cand amplitudinea creste brusc ca la un LFO expdown) + - Corectata o eroare foarte veche la LFO amplitudine (amplitudinea nu scadea corespunzator) diff --git a/src/Synth/ADnote.C b/src/Synth/ADnote.C @@ -788,10 +788,17 @@ int ADnote::noteout(REALTYPE *outl,REALTYPE *outr){ // Amplitude if (ABOVE_AMPLITUDE_THRESHOLD(oldamplitude[nvoice],newamplitude[nvoice])){ + int rest=SOUND_BUFFER_SIZE; + //test if the amplitude if raising and the difference is high + if ((newamplitude[nvoice]>oldamplitude[nvoice])&&((newamplitude[nvoice]-oldamplitude[nvoice])>0.25)){ + rest=10; + if (rest>SOUND_BUFFER_SIZE) rest=SOUND_BUFFER_SIZE; + for (int i=0;i<SOUND_BUFFER_SIZE-rest;i++) tmpwave[i]*=oldamplitude[nvoice]; + }; // Amplitude interpolation - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - tmpwave[i]*=INTERPOLATE_AMPLITUDE(oldamplitude[nvoice] - ,newamplitude[nvoice],i,SOUND_BUFFER_SIZE); + for (i=0;i<rest;i++){ + tmpwave[i+(SOUND_BUFFER_SIZE-rest)]*=INTERPOLATE_AMPLITUDE(oldamplitude[nvoice] + ,newamplitude[nvoice],i,rest); }; } else for (i=0;i<SOUND_BUFFER_SIZE;i++) tmpwave[i]*=newamplitude[nvoice]; diff --git a/src/Synth/LFO.C b/src/Synth/LFO.C @@ -77,7 +77,7 @@ REALTYPE LFO::lfoout(){ REALTYPE out; switch (lfotype){ case 1: //LFO_TRIANGLE - if ((x>0.0)&&(x<0.25)) out=4.0*x; + if ((x>=0.0)&&(x<0.25)) out=4.0*x; else if ((x>0.25)&&(x<0.75)) out=2-4*x; else out=4.0*x-4.0; break; @@ -99,7 +99,9 @@ REALTYPE LFO::lfoout(){ break; default:out=cos(x*2.0*PI);//LFO_SINE }; - if ((lfotype==0)||(lfotype==1)) out*=lfointensity*(amp1+x*(amp2-amp1)); + + + if ((lfotype==0)||(lfotype==1)) out*=lfointensity*(amp1+x*(amp2-amp1)); else out*=lfointensity*amp2; if (lfodelay<0.00001) { if (freqrndenabled==0) x+=incx; @@ -120,7 +122,7 @@ REALTYPE LFO::lfoout(){ */ REALTYPE LFO::amplfoout(){ REALTYPE out; - out=1-lfointensity+lfoout()/2.0; + out=1.0-lfointensity+lfoout(); if (out<-1.0) out=-1.0; else if (out>1.0) out=1.0; return(out);