diff --git a/plugins/zynaddsubfx/LocalZynAddSubFx.cpp b/plugins/zynaddsubfx/LocalZynAddSubFx.cpp index 013f1bea9..bce9655c6 100644 --- a/plugins/zynaddsubfx/LocalZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/LocalZynAddSubFx.cpp @@ -60,9 +60,6 @@ LocalZynAddSubFx::LocalZynAddSubFx() { denormalkillbuf[i] = (RND-0.5)*1e-16; } - - OscilGen::tmpsmps = new REALTYPE[OSCIL_SIZE]; - newFFTFREQS( &OscilGen::outoscilFFTfreqs, OSCIL_SIZE/2 ); } ++s_instanceCount; @@ -80,8 +77,6 @@ LocalZynAddSubFx::~LocalZynAddSubFx() if( --s_instanceCount == 0 ) { delete[] denormalkillbuf; - delete[] OscilGen::tmpsmps; - deleteFFTFREQS( &OscilGen::outoscilFFTfreqs ); } } diff --git a/plugins/zynaddsubfx/src/Synth/OscilGen.C b/plugins/zynaddsubfx/src/Synth/OscilGen.C index ba1102735..8e18ff214 100644 --- a/plugins/zynaddsubfx/src/Synth/OscilGen.C +++ b/plugins/zynaddsubfx/src/Synth/OscilGen.C @@ -27,14 +27,12 @@ #include "OscilGen.h" #include "../Effects/Distorsion.h" -REALTYPE *OscilGen::tmpsmps;//this array stores some termporary data and it has SOUND_BUFFER_SIZE elements -FFTFREQS OscilGen::outoscilFFTfreqs; - - OscilGen::OscilGen(FFTwrapper *fft_,Resonance *res_):Presets(){ setpresettype("Poscilgen"); fft=fft_; res=res_; + tmpsmps = new REALTYPE[OSCIL_SIZE]; + newFFTFREQS(&outoscilFFTfreqs, OSCIL_SIZE/2); newFFTFREQS(&oscilFFTfreqs,OSCIL_SIZE/2); newFFTFREQS(&basefuncFFTfreqs,OSCIL_SIZE/2); @@ -45,6 +43,8 @@ OscilGen::OscilGen(FFTwrapper *fft_,Resonance *res_):Presets(){ }; OscilGen::~OscilGen(){ + delete[] tmpsmps; + deleteFFTFREQS(&outoscilFFTfreqs); deleteFFTFREQS(&basefuncFFTfreqs); deleteFFTFREQS(&oscilFFTfreqs); }; diff --git a/plugins/zynaddsubfx/src/Synth/OscilGen.h b/plugins/zynaddsubfx/src/Synth/OscilGen.h index 4a3d808da..22ccd0b7f 100644 --- a/plugins/zynaddsubfx/src/Synth/OscilGen.h +++ b/plugins/zynaddsubfx/src/Synth/OscilGen.h @@ -107,11 +107,11 @@ class OscilGen:public Presets{ bool ADvsPAD;//if it is used by ADsynth or by PADsynth - static REALTYPE *tmpsmps;//this array stores some termporary data and it has SOUND_BUFFER_SIZE elements - static FFTFREQS outoscilFFTfreqs; - private: + REALTYPE *tmpsmps;//this array stores some termporary data and it has SOUND_BUFFER_SIZE elements + FFTFREQS outoscilFFTfreqs; + REALTYPE hmag[MAX_AD_HARMONICS],hphase[MAX_AD_HARMONICS];//the magnituides and the phases of the sine/nonsine harmonics // private: FFTwrapper *fft;