zynaddsubfx

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

commit ecfc42ce3e2564e71ef78f48a2c736bf37f17281
parent 1766f2baf6cf3e938fe473d6ffabf4633ce5bc10
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Wed, 31 Oct 2012 23:43:30 -0400

C++11: Build now compiles without errors

Due to std::complex<T>::imag() and ::real() changing their signatures, in C++11,
code dealing with these was updated to compile under both versions of C++.

Diffstat:
Msrc/Effects/Alienwah.cpp | 4++--
Msrc/Params/PADnoteParameters.cpp | 2+-
Msrc/Synth/OscilGen.cpp | 24++++++++++++------------
3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/Effects/Alienwah.cpp b/src/Effects/Alienwah.cpp @@ -65,7 +65,7 @@ void Alienwah::out(const Stereo<float *> &smp) complex<float> tmp = clfol * x + oldclfol * x1; complex<float> out = tmp * oldl[oldk]; - out.real() += (1 - fabs(fb)) * smp.l[i] * pangainL; + out += (1 - fabs(fb)) * smp.l[i] * pangainL; oldl[oldk] = out; float l = out.real() * 10.0f * (fb + 0.1f); @@ -74,7 +74,7 @@ void Alienwah::out(const Stereo<float *> &smp) tmp = clfor * x + oldclfor * x1; out = tmp * oldr[oldk]; - out.real() += (1 - fabs(fb)) * smp.r[i] * pangainR; + out += (1 - fabs(fb)) * smp.r[i] * pangainR; oldr[oldk] = out; float r = out.real() * 10.0f * (fb + 0.1f); diff --git a/src/Params/PADnoteParameters.cpp b/src/Params/PADnoteParameters.cpp @@ -477,7 +477,7 @@ void PADnoteParameters::generatespectrum_bandwidthMode(float *spectrum, float idfreq = i / (float)profilesize - 0.5f; idfreq *= ibw; int spfreq = (int) (idfreq + ibasefreq); - float fspfreq = fmod((double)idfreq + ibasefreq, 1.0f); + float fspfreq = fmodf((float)idfreq + ibasefreq, 1.0f); if(spfreq <= 0) continue; if(spfreq >= size - 1) diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp @@ -616,12 +616,9 @@ void OscilGen::prepare() clearAll(oscilFFTfreqs); if(Pcurrentbasefunc == 0) //the sine case for(int i = 0; i < MAX_AD_HARMONICS - 1; ++i) { - oscilFFTfreqs[i - + 1].real() = -hmag[i] - * sinf(hphase[i] * (i + 1)) / 2.0f; - oscilFFTfreqs[i - + 1].imag() = hmag[i] - * cosf(hphase[i] * (i + 1)) / 2.0f; + oscilFFTfreqs[i + 1] = + std::complex<float>(-hmag[i] * sinf(hphase[i] * (i + 1)) / 2.0f, + hmag[i] * cosf(hphase[i] * (i + 1)) / 2.0f); } else for(int j = 0; j < MAX_AD_HARMONICS; ++j) { @@ -698,10 +695,12 @@ void OscilGen::adaptiveharmonic(fft_t *f, float freq) break; else { if(down) { - f[high].real() += inf[i].real() * (1.0f - low); - f[high].imag() += inf[i].imag() * (1.0f - low); - f[high + 1].real() += inf[i].real() * low; - f[high + 1].imag() += inf[i].imag() * low; + f[high] = + std::complex<float>(f[high].real() + inf[i].real() * (1.0f - low), + f[high].imag() + inf[i].imag() * (1.0f - low)); + + f[high + 1] = std::complex<float>(f[high + 1].real() + inf[i].real() * low, + f[high + 1].imag() + inf[i].imag() * low); } else { hc = inf[high].real() @@ -1112,8 +1111,9 @@ void OscilGen::getfromXML(XMLwrapper *xml) if(xml->enterbranch("BASE_FUNCTION")) { for(int i = 1; i < synth->oscilsize / 2; ++i) if(xml->enterbranch("BF_HARMONIC", i)) { - basefuncFFTfreqs[i].real() = xml->getparreal("cos", 0.0f); - basefuncFFTfreqs[i].imag() = xml->getparreal("sin", 0.0f); + basefuncFFTfreqs[i] = + std::complex<float>(xml->getparreal("cos", 0.0f), + xml->getparreal("sin", 0.0f)); xml->exitbranch(); } xml->exitbranch();