zynaddsubfx

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

commit 3f055b00d2165903e091947e715f94e60321487c
parent d70b427dcb62906898b0f495fdd3b8ef79b9bcad
Author: fundamental <[email protected]>
Date:   Thu, 25 Aug 2011 16:35:07 -0400

Style: using pre-increment in loops

- This matches with yoshimi changes

Diffstat:
MExternalPrograms/Controller/Controller.C | 2+-
Msrc/DSP/AnalogFilter.cpp | 20++++++++++----------
Msrc/DSP/FormantFilter.cpp | 30+++++++++++++++---------------
Msrc/DSP/SVFilter.cpp | 12++++++------
Msrc/DSP/Unison.cpp | 8++++----
Msrc/Effects/Alienwah.cpp | 6+++---
Msrc/Effects/Chorus.cpp | 8++++----
Msrc/Effects/Distorsion.cpp | 10+++++-----
Msrc/Effects/DynamicFilter.cpp | 6+++---
Msrc/Effects/EQ.cpp | 12++++++------
Msrc/Effects/Echo.cpp | 2+-
Msrc/Effects/EffectMgr.cpp | 20++++++++++----------
Msrc/Effects/Phaser.cpp | 14+++++++-------
Msrc/Effects/Reverb.cpp | 42+++++++++++++++++++++---------------------
Msrc/Misc/Bank.cpp | 12++++++------
Msrc/Misc/Config.cpp | 18+++++++++---------
Msrc/Misc/Master.cpp | 100++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/Misc/Microtonal.cpp | 36++++++++++++++++++------------------
Msrc/Misc/Part.cpp | 94++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/Misc/Util.cpp | 4++--
Msrc/Misc/WaveShapeSmps.cpp | 28++++++++++++++--------------
Msrc/Nio/OssEngine.cpp | 2+-
Msrc/Nio/PaEngine.cpp | 2+-
Msrc/Output/DSSIaudiooutput.cpp | 2+-
Msrc/Params/ADnoteParameters.cpp | 14+++++++-------
Msrc/Params/EnvelopeParams.cpp | 6+++---
Msrc/Params/FilterParams.cpp | 38+++++++++++++++++++-------------------
Msrc/Params/PADnoteParameters.cpp | 62+++++++++++++++++++++++++++++++-------------------------------
Msrc/Params/PresetsStore.cpp | 2+-
Msrc/Params/SUBnoteParameters.cpp | 6+++---
Msrc/Synth/ADnote.cpp | 174++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/Synth/Envelope.cpp | 2+-
Msrc/Synth/OscilGen.cpp | 84++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/Synth/PADnote.cpp | 20++++++++++----------
Msrc/Synth/Resonance.cpp | 20++++++++++----------
Msrc/Synth/SUBnote.cpp | 38+++++++++++++++++++-------------------
Msrc/Synth/SynthNote.cpp | 8++++----
Msrc/Tests/AdNoteTest.h | 2+-
Msrc/Tests/MicrotonalTest.h | 2+-
Msrc/Tests/OscilGenTest.h | 2+-
Msrc/Tests/SubNoteTest.h | 2+-
Msrc/main.cpp | 2+-
42 files changed, 487 insertions(+), 487 deletions(-)

diff --git a/ExternalPrograms/Controller/Controller.C b/ExternalPrograms/Controller/Controller.C @@ -8,7 +8,7 @@ int Pexitprogram; Controller::Controller() { //init - for(int i = 0; i < 6; i++) { + for(int i = 0; i < 6; ++i) { pars[i].mode = 1; pars[i].val1 = 0; pars[i].val2 = 127; diff --git a/src/DSP/AnalogFilter.cpp b/src/DSP/AnalogFilter.cpp @@ -34,7 +34,7 @@ AnalogFilter::AnalogFilter(unsigned char Ftype, unsigned char Fstages) { stages = Fstages; - for(int i = 0; i < 3; i++) { + for(int i = 0; i < 3; ++i) { coeff.c[i] = 0.0; coeff.d[i] = 0.0; oldCoeff.c[i] = 0.0; @@ -61,7 +61,7 @@ AnalogFilter::~AnalogFilter() void AnalogFilter::cleanup() { - for(int i = 0; i < MAX_FILTER_STAGES + 1; i++) { + for(int i = 0; i < MAX_FILTER_STAGES + 1; ++i) { history[i].x1 = 0.0; history[i].x2 = 0.0; history[i].y1 = 0.0; @@ -361,7 +361,7 @@ void AnalogFilter::singlefilterout(float *smp, fstage &hist, const Coeff &coeff) { if(order == 1) { //First order filter - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float y0 = smp[i]*coeff.c[0] + hist.x1*coeff.c[1] + hist.y1*coeff.d[1]; hist.y1 = y0; @@ -370,7 +370,7 @@ void AnalogFilter::singlefilterout(float *smp, fstage &hist, } } if(order == 2) { //Second order filter - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float y0 = smp[i]*coeff.c[0] + hist.x1*coeff.c[1] + hist.x2*coeff.c[2] + hist.y1*coeff.d[1] + hist.y2*coeff.d[2]; @@ -384,7 +384,7 @@ void AnalogFilter::singlefilterout(float *smp, fstage &hist, } void AnalogFilter::filterout(float *smp) { - for(int i = 0; i < stages + 1; i++) + for(int i = 0; i < stages + 1; ++i) singlefilterout(smp, history[i], coeff); if(needsinterpolation) { @@ -392,10 +392,10 @@ void AnalogFilter::filterout(float *smp) float *ismp = getTmpBuffer(); memcpy(ismp, smp, sizeof(float) * SOUND_BUFFER_SIZE); - for(int i = 0; i < stages + 1; i++) + for(int i = 0; i < stages + 1; ++i) singlefilterout(ismp, oldHistory[i], oldCoeff); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float x = i / (float) SOUND_BUFFER_SIZE; smp[i] = ismp[i] * (1.0 - x) + smp[i] * x; } @@ -403,7 +403,7 @@ void AnalogFilter::filterout(float *smp) needsinterpolation = false; } - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) smp[i] *= outgain; } @@ -411,14 +411,14 @@ float AnalogFilter::H(float freq) { float fr = freq / SAMPLE_RATE * PI * 2.0; float x = coeff.c[0], y = 0.0; - for(int n = 1; n < 3; n++) { + for(int n = 1; n < 3; ++n) { x += cos(n * fr) * coeff.c[n]; y -= sin(n * fr) * coeff.c[n]; } float h = x * x + y * y; x = 1.0; y = 0.0; - for(int n = 1; n < 3; n++) { + for(int n = 1; n < 3; ++n) { x -= cos(n * fr) * coeff.d[n]; y += sin(n * fr) * coeff.d[n]; } diff --git a/src/DSP/FormantFilter.cpp b/src/DSP/FormantFilter.cpp @@ -30,12 +30,12 @@ FormantFilter::FormantFilter(FilterParams *pars) { numformants = pars->Pnumformants; - for(int i = 0; i < numformants; i++) + for(int i = 0; i < numformants; ++i) formant[i] = new AnalogFilter(4 /*BPF*/, 1000.0, 10.0, pars->Pstages); cleanup(); - for(int j = 0; j < FF_MAX_VOWELS; j++) - for(int i = 0; i < numformants; i++) { + for(int j = 0; j < FF_MAX_VOWELS; ++j) + for(int i = 0; i < numformants; ++i) { formantpar[j][i].freq = pars->getformantfreq( pars->Pvowels[j].formants[i].freq); formantpar[j][i].amp = pars->getformantamp( @@ -44,9 +44,9 @@ FormantFilter::FormantFilter(FilterParams *pars) pars->Pvowels[j].formants[i].q); } - for(int i = 0; i < FF_MAX_FORMANTS; i++) + for(int i = 0; i < FF_MAX_FORMANTS; ++i) oldformantamp[i] = 1.0; - for(int i = 0; i < numformants; i++) { + for(int i = 0; i < numformants; ++i) { currentformants[i].freq = 1000.0; currentformants[i].amp = 1.0; currentformants[i].q = 2.0; @@ -57,7 +57,7 @@ FormantFilter::FormantFilter(FilterParams *pars) sequencesize = pars->Psequencesize; if(sequencesize == 0) sequencesize = 1; - for(int k = 0; k < sequencesize; k++) + for(int k = 0; k < sequencesize; ++k) sequence[k].nvowel = pars->Psequence[k].nvowel; vowelclearness = pow(10.0, (pars->Pvowelclearness - 32.0) / 48.0); @@ -76,13 +76,13 @@ FormantFilter::FormantFilter(FilterParams *pars) FormantFilter::~FormantFilter() { - for(int i = 0; i < numformants; i++) + for(int i = 0; i < numformants; ++i) delete (formant[i]); } void FormantFilter::cleanup() { - for(int i = 0; i < numformants; i++) + for(int i = 0; i < numformants; ++i) formant[i]->cleanup(); } @@ -129,7 +129,7 @@ void FormantFilter::setpos(float input) p2 = sequence[p2].nvowel; if(firsttime != 0) { - for(int i = 0; i < numformants; i++) { + for(int i = 0; i < numformants; ++i) { currentformants[i].freq = formantpar[p1][i].freq * (1.0 - pos) + formantpar[p2][i].freq * pos; @@ -145,7 +145,7 @@ void FormantFilter::setpos(float input) firsttime = 0; } else { - for(int i = 0; i < numformants; i++) { + for(int i = 0; i < numformants; ++i) { currentformants[i].freq = currentformants[i].freq * (1.0 - formantslowness) + (formantpar[p1][i].freq @@ -183,7 +183,7 @@ void FormantFilter::setfreq(float frequency) void FormantFilter::setq(float q_) { Qfactor = q_; - for(int i = 0; i < numformants; i++) + for(int i = 0; i < numformants; ++i) formant[i]->setq(Qfactor * currentformants[i].q); } @@ -208,21 +208,21 @@ void FormantFilter::filterout(float *smp) memcpy(inbuffer, smp, sizeof(float) * SOUND_BUFFER_SIZE); memset(smp, 0, sizeof(float) * SOUND_BUFFER_SIZE); - for(int j = 0; j < numformants; j++) { + for(int j = 0; j < numformants; ++j) { float *tmpbuf = getTmpBuffer(); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) tmpbuf[i] = inbuffer[i] * outgain; formant[j]->filterout(tmpbuf); if(ABOVE_AMPLITUDE_THRESHOLD(oldformantamp[j], currentformants[j].amp)) - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) smp[i] += tmpbuf[i] * INTERPOLATE_AMPLITUDE(oldformantamp[j], currentformants[j].amp, i, SOUND_BUFFER_SIZE); else - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) smp[i] += tmpbuf[i] * currentformants[j].amp; returnTmpBuffer(tmpbuf); oldformantamp[j] = currentformants[j].amp; diff --git a/src/DSP/SVFilter.cpp b/src/DSP/SVFilter.cpp @@ -53,7 +53,7 @@ SVFilter::~SVFilter() void SVFilter::cleanup() { - for(int i = 0; i < MAX_FILTER_STAGES + 1; i++) { + for(int i = 0; i < MAX_FILTER_STAGES + 1; ++i) { st[i].low = 0.0; st[i].high = 0.0; st[i].band = 0.0; @@ -151,7 +151,7 @@ void SVFilter::singlefilterout(float *smp, fstage &x, parameters &par) errx(1, "Impossible SVFilter type encountered [%d]", type); } - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { x.low = x.low + par.f * x.band; x.high = par.q_sqrt * smp[i] - x.low - par.q * x.band; x.band = par.f * x.high + x.band; @@ -163,17 +163,17 @@ void SVFilter::singlefilterout(float *smp, fstage &x, parameters &par) void SVFilter::filterout(float *smp) { - for(int i = 0; i < stages + 1; i++) + for(int i = 0; i < stages + 1; ++i) singlefilterout(smp, st[i], par); if(needsinterpolation) { float *ismp = getTmpBuffer(); memcpy(ismp, smp, sizeof(float) * SOUND_BUFFER_SIZE); - for(int i = 0; i < stages + 1; i++) + for(int i = 0; i < stages + 1; ++i) singlefilterout(ismp, st[i], ipar); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float x = i / (float) SOUND_BUFFER_SIZE; smp[i] = ismp[i] * (1.0 - x) + smp[i] * x; } @@ -181,7 +181,7 @@ void SVFilter::filterout(float *smp) needsinterpolation = false; } - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) smp[i] *= outgain; } diff --git a/src/DSP/Unison.cpp b/src/DSP/Unison.cpp @@ -83,7 +83,7 @@ void Unison::update_parameters() { float increments_per_second = SAMPLE_RATE / (float) update_period_samples; // printf("#%g, %g\n",increments_per_second,base_freq); - for(int i = 0; i < unison_size; i++) { + for(int i = 0; i < unison_size; ++i) { float base = pow(UNISON_FREQ_SPAN, RND * 2.0 - 1.0); uv[i].relative_amplitude = base; float period = base / base_freq; @@ -116,7 +116,7 @@ void Unison::process(int bufsize, float *inbuf, float *outbuf) { float volume = 1.0 / sqrt(unison_size); float xpos_step = 1.0 / (float) update_period_samples; float xpos = (float) update_period_sample_k * xpos_step; - for(int i = 0; i < bufsize; i++) { + for(int i = 0; i < bufsize; ++i) { if((update_period_sample_k++) >= update_period_samples) { update_unison_data(); update_period_sample_k = 0; @@ -126,7 +126,7 @@ void Unison::process(int bufsize, float *inbuf, float *outbuf) { float in = inbuf[i], out = 0.0; float sign = 1.0; - for(int k = 0; k < unison_size; k++) { + for(int k = 0; k < unison_size; ++k) { float vpos = uv[k].realpos1 * (1.0 - xpos) + uv[k].realpos2 * xpos; //optimize float pos = delay_k + max_delay - vpos - 1.0; //optimize @@ -154,7 +154,7 @@ void Unison::update_unison_data() { if(!uv) return; - for(int k = 0; k < unison_size; k++) { + for(int k = 0; k < unison_size; ++k) { float pos = uv[k].position; float step = uv[k].step; pos += step; diff --git a/src/Effects/Alienwah.cpp b/src/Effects/Alienwah.cpp @@ -60,7 +60,7 @@ void Alienwah::out(const Stereo<float *> &smp) clfol = complex<float>(cos(lfol + phase) * fb, sin(lfol + phase) * fb); //rework clfor = complex<float>(cos(lfor + phase) * fb, sin(lfor + phase) * fb); //rework - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float x = ((float) i) / SOUND_BUFFER_SIZE; float x1 = 1.0 - x; //left @@ -98,7 +98,7 @@ void Alienwah::out(const Stereo<float *> &smp) */ void Alienwah::cleanup() { - for(int i = 0; i < Pdelay; i++) { + for(int i = 0; i < Pdelay; ++i) { oldl[i] = complex<float>(0.0, 0.0); oldr[i] = complex<float>(0.0, 0.0); } @@ -175,7 +175,7 @@ void Alienwah::setpreset(unsigned char npreset) if(npreset >= NUM_PRESETS) npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) + for(int n = 0; n < PRESET_SIZE; ++n) changepar(n, presets[npreset][n]); if(insertion == 0) changepar(0, presets[npreset][0] / 2); //lower the volume if this is system effect diff --git a/src/Effects/Chorus.cpp b/src/Effects/Chorus.cpp @@ -78,7 +78,7 @@ void Chorus::out(const Stereo<float *> &input) dl2 = getdelay(lfol); dr2 = getdelay(lfor); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float inl = input.l[i]; float inr = input.r[i]; @@ -123,12 +123,12 @@ void Chorus::out(const Stereo<float *> &input) } if(Poutsub != 0) - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { efxoutl[i] *= -1.0; efxoutr[i] *= -1.0; } - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { efxoutl[i] *= pangainL; efxoutr[i] *= pangainR; } @@ -203,7 +203,7 @@ void Chorus::setpreset(unsigned char npreset) if(npreset >= NUM_PRESETS) npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) + for(int n = 0; n < PRESET_SIZE; ++n) changepar(n, presets[npreset][n]); Ppreset = npreset; } diff --git a/src/Effects/Distorsion.cpp b/src/Effects/Distorsion.cpp @@ -99,13 +99,13 @@ void Distorsion::out(const Stereo<float *> &smp) inputvol *= -1.0; if(Pstereo != 0) { //Stereo - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { efxoutl[i] = smp.l[i] * inputvol * pangainL; efxoutr[i] = smp.r[i] * inputvol * pangainR; } } else { - for(i = 0; i < SOUND_BUFFER_SIZE; i++) + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) efxoutl[i] = (smp.l[i] * pangainL + smp.r[i] * pangainR) * inputvol; } @@ -121,11 +121,11 @@ void Distorsion::out(const Stereo<float *> &smp) applyfilters(efxoutl, efxoutr); if(Pstereo == 0) - for(i = 0; i < SOUND_BUFFER_SIZE; i++) + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) efxoutr[i] = efxoutl[i]; float level = dB2rap(60.0 * Plevel / 127.0 - 40.0); - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { lout = efxoutl[i]; rout = efxoutr[i]; l = lout * (1.0 - lrcross) + rout * lrcross; @@ -196,7 +196,7 @@ void Distorsion::setpreset(unsigned char npreset) if(npreset >= NUM_PRESETS) npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) + for(int n = 0; n < PRESET_SIZE; ++n) changepar(n, presets[npreset][n]); if(insertion == 0) changepar(0, (int) (presets[npreset][0] / 1.5)); //lower the volume if this is system effect diff --git a/src/Effects/DynamicFilter.cpp b/src/Effects/DynamicFilter.cpp @@ -61,7 +61,7 @@ void DynamicFilter::out(const Stereo<float *> &smp) const float freq = filterpars->getfreq(); const float q = filterpars->getq(); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { efxoutl[i] = smp.l[i]; efxoutr[i] = smp.r[i]; @@ -86,7 +86,7 @@ void DynamicFilter::out(const Stereo<float *> &smp) filterr->filterout(efxoutr); //panning - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { efxoutl[i] *= pangainL; efxoutr[i] *= pangainR; } @@ -164,7 +164,7 @@ void DynamicFilter::setpreset(unsigned char npreset) if(npreset >= NUM_PRESETS) npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) + for(int n = 0; n < PRESET_SIZE; ++n) changepar(n, presets[npreset][n]); filterpars->defaults(); diff --git a/src/Effects/EQ.cpp b/src/Effects/EQ.cpp @@ -27,7 +27,7 @@ EQ::EQ(const int &insertion_, float *efxoutl_, float *efxoutr_) :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0) { - for(int i = 0; i < MAX_EQ_BANDS; i++) { + for(int i = 0; i < MAX_EQ_BANDS; ++i) { filter[i].Ptype = 0; filter[i].Pfreq = 64; filter[i].Pgain = 64; @@ -48,7 +48,7 @@ EQ::~EQ() void EQ::cleanup() { - for(int i = 0; i < MAX_EQ_BANDS; i++) { + for(int i = 0; i < MAX_EQ_BANDS; ++i) { filter[i].l->cleanup(); filter[i].r->cleanup(); } @@ -57,12 +57,12 @@ void EQ::cleanup() void EQ::out(const Stereo<float *> &smp) { int i; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { efxoutl[i] = smp.l[i] * volume; efxoutr[i] = smp.r[i] * volume; } - for(i = 0; i < MAX_EQ_BANDS; i++) { + for(i = 0; i < MAX_EQ_BANDS; ++i) { if(filter[i].Ptype == 0) continue; filter[i].l->filterout(efxoutl); @@ -100,7 +100,7 @@ void EQ::setpreset(unsigned char npreset) if(npreset >= NUM_PRESETS) npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) + for(int n = 0; n < PRESET_SIZE; ++n) changepar(n, presets[npreset][n]); Ppreset = npreset; } @@ -203,7 +203,7 @@ float EQ::getfreqresponse(float freq) { float resp = 1.0; - for(int i = 0; i < MAX_EQ_BANDS; i++) { + for(int i = 0; i < MAX_EQ_BANDS; ++i) { if(filter[i].Ptype == 0) continue; resp *= filter[i].l->H(freq); diff --git a/src/Effects/Echo.cpp b/src/Effects/Echo.cpp @@ -191,7 +191,7 @@ void Echo::setpreset(unsigned char npreset) if(npreset >= NUM_PRESETS) npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) + for(int n = 0; n < PRESET_SIZE; ++n) changepar(n, presets[npreset][n]); if(insertion) setvolume(presets[npreset][0] / 2); //lower the volume if this is insertion effect diff --git a/src/Effects/EffectMgr.cpp b/src/Effects/EffectMgr.cpp @@ -48,7 +48,7 @@ EffectMgr::EffectMgr(int insertion_, pthread_mutex_t *mutex_) // mutex=mutex_; // efxoutl=new float[SOUND_BUFFER_SIZE]; // efxoutr=new float[SOUND_BUFFER_SIZE]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { efxoutl[i] = 0.0; efxoutr[i] = 0.0; } @@ -81,7 +81,7 @@ void EffectMgr::changeeffect(int nefx_) if(nefx == nefx_) return; nefx = nefx_; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { efxoutl[i] = 0.0; efxoutr[i] = 0.0; } @@ -212,7 +212,7 @@ void EffectMgr::out(float *smpsl, float *smpsr) int i; if(efx == NULL) { if(insertion == 0) - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { smpsl[i] = 0.0; smpsr[i] = 0.0; efxoutl[i] = 0.0; @@ -221,7 +221,7 @@ void EffectMgr::out(float *smpsl, float *smpsr) ; return; } - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { smpsl[i] += denormalkillbuf[i]; smpsr[i] += denormalkillbuf[i]; efxoutl[i] = 0.0; @@ -233,7 +233,7 @@ void EffectMgr::out(float *smpsl, float *smpsr) if(nefx == 7) { //this is need only for the EQ effect /**\todo figure out why*/ - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { smpsl[i] = efxoutl[i]; smpsr[i] = efxoutr[i]; } @@ -255,7 +255,7 @@ void EffectMgr::out(float *smpsl, float *smpsr) v2 *= v2; //for Reverb and Echo, the wet function is not liniar if(dryonly) { //this is used for instrument effect only - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { smpsl[i] *= v1; smpsr[i] *= v1; efxoutl[i] *= v2; @@ -263,14 +263,14 @@ void EffectMgr::out(float *smpsl, float *smpsr) } } else { //normal instrument/insertion effect - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { smpsl[i] = smpsl[i] * v1 + efxoutl[i] * v2; smpsr[i] = smpsr[i] * v1 + efxoutr[i] * v2; } } } else { //System effect - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { efxoutl[i] *= 2.0 * volume; efxoutr[i] *= 2.0 * volume; smpsl[i] = efxoutl[i]; @@ -317,7 +317,7 @@ void EffectMgr::add2XML(XMLwrapper *xml) xml->addpar("preset", efx->Ppreset); xml->beginbranch("EFFECT_PARAMETERS"); - for(int n = 0; n < 128; n++) { + for(int n = 0; n < 128; ++n) { /**\todo evaluate who should oversee saving * and loading of parameters*/ int par = geteffectpar(n); @@ -345,7 +345,7 @@ void EffectMgr::getfromXML(XMLwrapper *xml) efx->Ppreset = xml->getpar127("preset", efx->Ppreset); if(xml->enterbranch("EFFECT_PARAMETERS")) { - for(int n = 0; n < 128; n++) { + for(int n = 0; n < 128; ++n) { seteffectpar_nolock(n, 0); //erase effect parameter if(xml->enterbranch("par_no", n) == 0) continue; diff --git a/src/Effects/Phaser.cpp b/src/Effects/Phaser.cpp @@ -128,7 +128,7 @@ void Phaser::AnalogPhase(const Stereo<float *> &input) g = oldgain; oldgain = mod; - for (int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for (int i = 0; i < SOUND_BUFFER_SIZE; ++i) { g.l += diff.l;// Linear interpolation between LFO samples g.r += diff.r; @@ -158,7 +158,7 @@ void Phaser::AnalogPhase(const Stereo<float *> &input) float Phaser::applyPhase(float x, float g, float fb, float &hpf, float *yn1, float *xn1) { - for(int j = 0; j < Pstages; j++) { //Phasing routine + for(int j = 0; j < Pstages; ++j) { //Phasing routine mis = 1.0f + offsetpct*offset[j]; //This is symmetrical. @@ -197,7 +197,7 @@ void Phaser::normalPhase(const Stereo<float *> &input) gain.l = limit(gain.l, ZERO_, ONE_); gain.r = limit(gain.r, ZERO_, ONE_); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float x = (float) i / SOUND_BUFFER_SIZE; float x1 = 1.0 - x; //TODO think about making panning an external feature @@ -229,7 +229,7 @@ void Phaser::normalPhase(const Stereo<float *> &input) float Phaser::applyPhase(float x, float g, float *old) { - for(int j = 0; j < Pstages * 2; j++) { //Phasing routine + for(int j = 0; j < Pstages * 2; ++j) { //Phasing routine float tmp = old[j]; old[j] = g * tmp + x; x = tmp - g *old[j]; @@ -243,11 +243,11 @@ float Phaser::applyPhase(float x, float g, float *old) void Phaser::cleanup() { fb = oldgain = Stereo<float>(0.0); - for(int i = 0; i < Pstages * 2; i++) { + for(int i = 0; i < Pstages * 2; ++i) { old.l[i] = 0.0; old.r[i] = 0.0; } - for(int i = 0; i < Pstages; i++) { + for(int i = 0; i < Pstages; ++i) { xn1.l[i] = 0.0; yn1.l[i] = 0.0; xn1.r[i] = 0.0; @@ -355,7 +355,7 @@ void Phaser::setpreset(unsigned char npreset) }; if(npreset >= NUM_PRESETS) npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) + for(int n = 0; n < PRESET_SIZE; ++n) changepar(n, presets[npreset][n]); Ppreset = npreset; } diff --git a/src/Effects/Reverb.cpp b/src/Effects/Reverb.cpp @@ -48,7 +48,7 @@ Reverb::Reverb(const int &insertion_, float *efxoutl_, float *efxoutr_) roomsize = 1.0; rs = 1.0; - for(int i = 0; i < REV_COMBS * 2; i++) { + for(int i = 0; i < REV_COMBS * 2; ++i) { comblen[i] = 800 + (int)(RND * 1400); combk[i] = 0; lpcomb[i] = 0; @@ -56,7 +56,7 @@ Reverb::Reverb(const int &insertion_, float *efxoutl_, float *efxoutr_) comb[i] = NULL; } - for(int i = 0; i < REV_APS * 2; i++) { + for(int i = 0; i < REV_APS * 2; ++i) { aplen[i] = 500 + (int)(RND * 500); apk[i] = 0; ap[i] = NULL; @@ -81,9 +81,9 @@ Reverb::~Reverb() if(lpf != NULL) delete lpf; - for(i = 0; i < REV_APS * 2; i++) + for(i = 0; i < REV_APS * 2; ++i) delete [] ap[i]; - for(i = 0; i < REV_COMBS * 2; i++) + for(i = 0; i < REV_COMBS * 2; ++i) delete [] comb[i]; if(bandwidth) @@ -96,18 +96,18 @@ Reverb::~Reverb() void Reverb::cleanup() { int i, j; - for(i = 0; i < REV_COMBS * 2; i++) { + for(i = 0; i < REV_COMBS * 2; ++i) { lpcomb[i] = 0.0; - for(j = 0; j < comblen[i]; j++) + for(j = 0; j < comblen[i]; ++j) comb[i][j] = 0.0; } - for(i = 0; i < REV_APS * 2; i++) - for(j = 0; j < aplen[i]; j++) + for(i = 0; i < REV_APS * 2; ++i) + for(j = 0; j < aplen[i]; ++j) ap[i][j] = 0.0; if(idelay != NULL) - for(i = 0; i < idelaylen; i++) + for(i = 0; i < idelaylen; ++i) idelay[i] = 0.0; if(hpf != NULL) @@ -122,12 +122,12 @@ void Reverb::cleanup() void Reverb::processmono(int ch, float *output, float *inputbuf) { /**\todo: implement the high part from lohidamp*/ - for(int j = REV_COMBS * ch; j < REV_COMBS * (ch + 1); j++) { + for(int j = REV_COMBS * ch; j < REV_COMBS * (ch + 1); ++j) { int &ck = combk[j]; const int comblength = comblen[j]; float &lpcombj = lpcomb[j]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float fbout = comb[j][ck] * combfb[j]; fbout = fbout * (1.0 - lohifb) + lpcombj * lohifb; lpcombj = fbout; @@ -140,10 +140,10 @@ void Reverb::processmono(int ch, float *output, float *inputbuf) } } - for(int j = REV_APS * ch; j < REV_APS * (1 + ch); j++) { + for(int j = REV_APS * ch; j < REV_APS * (1 + ch); ++j) { int &ak = apk[j]; const int aplength = aplen[j]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float tmp = ap[j][ak]; ap[j][ak] = 0.7 * tmp + output[i]; output[i] = tmp - 0.7 * ap[j][ak]; @@ -162,11 +162,11 @@ void Reverb::out(const Stereo<float *> &smp) return; float *inputbuf = getTmpBuffer(); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) inputbuf[i] = (smp.l[i] + smp.r[i]) / 2.0; if(idelay != NULL) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { //Initial delay r float tmp = inputbuf[i] + idelay[idelayk] * idelayfb; inputbuf[i] = idelay[idelayk]; @@ -195,7 +195,7 @@ void Reverb::out(const Stereo<float *> &smp) lvol *= 2; rvol *= 2; } - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { efxoutl[i] *= lvol; efxoutr[i] *= rvol; } @@ -226,7 +226,7 @@ void Reverb::settime(unsigned char Ptime) this->Ptime = Ptime; t = pow(60.0, (float)Ptime / 127.0) - 0.97; - for(i = 0; i < REV_COMBS * 2; i++) + for(i = 0; i < REV_COMBS * 2; ++i) combfb[i] = -exp((float)comblen[i] / (float)SAMPLE_RATE * log(0.001) / t); //the feedback is negative because it removes the DC @@ -266,7 +266,7 @@ void Reverb::setidelay(unsigned char Pidelay) if(idelaylen > 1) { idelayk = 0; idelay = new float[idelaylen]; - for(int i = 0; i < idelaylen; i++) + for(int i = 0; i < idelaylen; ++i) idelay[i] = 0.0; } } @@ -336,7 +336,7 @@ void Reverb::settype(unsigned char Ptype) this->Ptype = Ptype; float tmp; - for(int i = 0; i < REV_COMBS * 2; i++) { + for(int i = 0; i < REV_COMBS * 2; ++i) { if(Ptype == 0) tmp = 800.0 + (int)(RND * 1400.0); else @@ -356,7 +356,7 @@ void Reverb::settype(unsigned char Ptype) comb[i] = new float[comblen[i]]; } - for(int i = 0; i < REV_APS * 2; i++) { + for(int i = 0; i < REV_APS * 2; ++i) { if(Ptype == 0) tmp = 500 + (int)(RND * 500); else @@ -441,7 +441,7 @@ void Reverb::setpreset(unsigned char npreset) if(npreset >= NUM_PRESETS) npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; n++) + for(int n = 0; n < PRESET_SIZE; ++n) changepar(n, presets[npreset][n]); if(insertion != 0) changepar(0, presets[npreset][0] / 2); //lower the volume if reverb is insertion effect diff --git a/src/Misc/Bank.cpp b/src/Misc/Bank.cpp @@ -96,7 +96,7 @@ void Bank::setname(unsigned int ninstrument, const string &newname, int newslot) snprintf(tmpfilename, 100, "%4d-%s", ninstrument + 1, newname.c_str()); //add the zeroes at the start of filename - for(int i = 0; i < 4; i++) + for(int i = 0; i < 4; ++i) if(tmpfilename[i] == ' ') tmpfilename[i] = '0'; @@ -154,7 +154,7 @@ void Bank::savetoslot(unsigned int ninstrument, Part *part) (char *)part->Pname); //add the zeroes at the start of filename - for(int i = 0; i < 4; i++) + for(int i = 0; i < 4; ++i) if(tmpfilename[i] == ' ') tmpfilename[i] = '0'; @@ -206,7 +206,7 @@ int Bank::loadbank(string bankdirname) int no = 0; unsigned int startname = 0; - for(unsigned int i = 0; i < 4; i++) { + for(unsigned int i = 0; i < 4; ++i) { if(strlen(filename) <= i) break; @@ -317,7 +317,7 @@ void Bank::rescanforbanks() //remove old banks banks.clear(); - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) + for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) if(!config.cfg.bankRootDirList[i].empty()) scanrootdir(config.cfg.bankRootDirList[i]); @@ -326,8 +326,8 @@ void Bank::rescanforbanks() //remove duplicate bank names int dupl = 0; - for(int j = 0; j < (int) banks.size() - 1; j++) { - for(int i = j + 1; i <(int) banks.size(); i++) { + for(int j = 0; j < (int) banks.size() - 1; ++j) { + for(int i = j + 1; i <(int) banks.size(); ++i) { if(banks[i].name == banks[j].name) { //add a [1] to the first bankname and [n] to others banks[i].name = banks[i].name + '[' + stringFrom(dupl +2) + ']'; diff --git a/src/Misc/Config.cpp b/src/Misc/Config.cpp @@ -66,9 +66,9 @@ void Config::init() winmidimax = 1; //try to find out how many input midi devices are there winmididevices = new winmidionedevice[winmidimax]; - for(int i = 0; i < winmidimax; i++) { + for(int i = 0; i < winmidimax; ++i) { winmididevices[i].name = new char[MAX_STRING_SIZE]; - for(int j = 0; j < MAX_STRING_SIZE; j++) + for(int j = 0; j < MAX_STRING_SIZE; ++j) winmididevices[i].name[j] = '\0'; } @@ -107,7 +107,7 @@ Config::~Config() delete [] cfg.LinuxOSSWaveOutDev; delete [] cfg.LinuxOSSSeqInDev; - for(int i = 0; i < winmidimax; i++) + for(int i = 0; i < winmidimax; ++i) delete [] winmididevices[i].name; delete [] winmididevices; } @@ -122,13 +122,13 @@ void Config::save() void Config::clearbankrootdirlist() { - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) + for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) cfg.bankRootDirList[i].clear(); } void Config::clearpresetsdirlist() { - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) + for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) cfg.presetsDirList[i].clear(); } @@ -196,7 +196,7 @@ void Config::readConfig(const char *filename) 10); //get bankroot dirs - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) { + for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) { if(xmlcfg.enterbranch("BANKROOT", i)) { cfg.bankRootDirList[i] = xmlcfg.getparstr("bank_root", ""); xmlcfg.exitbranch(); @@ -204,7 +204,7 @@ void Config::readConfig(const char *filename) } //get preset root dirs - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) { + for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) { if(xmlcfg.enterbranch("PRESETSROOT", i)) { cfg.presetsDirList[i] = xmlcfg.getparstr("presets_root", ""); xmlcfg.exitbranch(); @@ -261,14 +261,14 @@ void Config::saveConfig(const char *filename) xmlcfg->addpar("virtual_keyboard_layout", cfg.VirKeybLayout); - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) + for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) if(!cfg.bankRootDirList[i].empty()) { xmlcfg->beginbranch("BANKROOT", i); xmlcfg->addparstr("bank_root", cfg.bankRootDirList[i]); xmlcfg->endbranch(); } - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) + for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) if(!cfg.presetsDirList[i].empty()) { xmlcfg->beginbranch("PRESETSROOT", i); xmlcfg->addparstr("presets_root", cfg.presetsDirList[i]); diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp @@ -47,20 +47,20 @@ Master::Master() fft = new FFTwrapper(OSCIL_SIZE); shutup = 0; - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { vuoutpeakpart[npart] = 1e-9; fakepeakpart[npart] = 0; } - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) part[npart] = new Part(&microtonal, fft, &mutex); //Insertion Effects init - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) + for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) insefx[nefx] = new EffectMgr(1, &mutex); //System Effects init - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) + for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) sysefx[nefx] = new EffectMgr(0, &mutex); @@ -73,25 +73,25 @@ void Master::defaults() setPvolume(80); setPkeyshift(64); - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { part[npart]->defaults(); part[npart]->Prcvchn = npart % NUM_MIDI_CHANNELS; } partonoff(0, 1); //enable the first part - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) { insefx[nefx]->defaults(); Pinsparts[nefx] = -1; } //System Effects init - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) { sysefx[nefx]->defaults(); - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) setPsysefxvol(npart, nefx, 0); - for(int nefxto = 0; nefxto < NUM_SYS_EFX; nefxto++) + for(int nefxto = 0; nefxto < NUM_SYS_EFX; ++nefxto) setPsysefxsend(nefx, nefxto, 0); } @@ -125,7 +125,7 @@ Master &Master::getInstance() void Master::noteOn(char chan, char note, char velocity) { if(velocity) { - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { if(chan == part[npart]->Prcvchn) { fakepeakpart[npart] = velocity * 2; if(part[npart]->Penabled) @@ -143,7 +143,7 @@ void Master::noteOn(char chan, char note, char velocity) */ void Master::noteOff(char chan, char note) { - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) if((chan == part[npart]->Prcvchn) && part[npart]->Penabled) part[npart]->NoteOff(note); } @@ -175,7 +175,7 @@ void Master::setController(char chan, int type, int par) ; } else { //other controllers - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) //Send the controller to all part assigned to the channel + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) //Send the controller to all part assigned to the channel if((chan == part[npart]->Prcvchn) && (part[npart]->Penabled != 0)) part[npart]->SetController(type, par); ; @@ -194,7 +194,7 @@ void Master::vuUpdate(const float *outl, const float *outr) //Peak computation (for vumeters) vu.outpeakl = 1e-12; vu.outpeakr = 1e-12; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { if(fabs(outl[i]) > vu.outpeakl) vu.outpeakl = fabs(outl[i]); if(fabs(outr[i]) > vu.outpeakr) @@ -210,7 +210,7 @@ void Master::vuUpdate(const float *outl, const float *outr) //RMS Peak computation (for vumeters) vu.rmspeakl = 1e-12; vu.rmspeakr = 1e-12; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { vu.rmspeakl += outl[i] * outl[i]; vu.rmspeakr += outr[i] * outr[i]; } @@ -218,12 +218,12 @@ void Master::vuUpdate(const float *outl, const float *outr) vu.rmspeakr = sqrt(vu.rmspeakr / SOUND_BUFFER_SIZE); //Part Peak computation (for Part vumeters or fake part vumeters) - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { vuoutpeakpart[npart] = 1.0e-12; if(part[npart]->Penabled != 0) { float *outl = part[npart]->partoutl, *outr = part[npart]->partoutr; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float tmp = fabs(outl[i] + outr[i]); if(tmp > vuoutpeakpart[npart]) vuoutpeakpart[npart] = tmp; @@ -247,7 +247,7 @@ void Master::partonoff(int npart, int what) fakepeakpart[npart] = 0; part[npart]->Penabled = 0; part[npart]->cleanup(); - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) { if(Pinsparts[nefx] == npart) insefx[nefx]->cleanup(); ; @@ -273,12 +273,12 @@ void Master::AudioOut(float *outl, float *outr) memset(outr, 0, sizeof(float) * SOUND_BUFFER_SIZE); //Compute part samples and store them part[npart]->partoutl,partoutr - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) if(part[npart]->Penabled != 0) part[npart]->ComputePartSmps(); //Insertion effects - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) { if(Pinsparts[nefx] >= 0) { int efxpart = Pinsparts[nefx]; if(part[efxpart]->Penabled) @@ -289,7 +289,7 @@ void Master::AudioOut(float *outl, float *outr) //Apply the part volumes and pannings (after insertion effects) - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { if(part[npart]->Penabled == 0) continue; @@ -306,7 +306,7 @@ void Master::AudioOut(float *outl, float *outr) //the volume or the panning has changed and needs interpolation if(ABOVE_AMPLITUDE_THRESHOLD(oldvol.l, newvol.l) || ABOVE_AMPLITUDE_THRESHOLD(oldvol.r, newvol.r)) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { Stereo<float> vol(INTERPOLATE_AMPLITUDE(oldvol.l, newvol.l, i, SOUND_BUFFER_SIZE), INTERPOLATE_AMPLITUDE(oldvol.r, newvol.r, @@ -318,7 +318,7 @@ void Master::AudioOut(float *outl, float *outr) part[npart]->oldvolumer = newvol.r; } else { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //the volume did not changed + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { //the volume did not changed part[npart]->partoutl[i] *= newvol.l; part[npart]->partoutr[i] *= newvol.r; } @@ -327,7 +327,7 @@ void Master::AudioOut(float *outl, float *outr) //System effects - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) { if(sysefx[nefx]->geteffect() == 0) continue; //the effect is disabled @@ -338,7 +338,7 @@ void Master::AudioOut(float *outl, float *outr) memset(tmpmixr, 0, sizeof(float) * SOUND_BUFFER_SIZE); //Mix the channels according to the part settings about System Effect - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { //skip if the part has no output to effect if(Psysefxvol[nefx][npart] == 0) continue; @@ -349,17 +349,17 @@ void Master::AudioOut(float *outl, float *outr) //the output volume of each part to system effect const float vol = sysefxvol[nefx][npart]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { tmpmixl[i] += part[npart]->partoutl[i] * vol; tmpmixr[i] += part[npart]->partoutr[i] * vol; } } // system effect send to next ones - for(int nefxfrom = 0; nefxfrom < nefx; nefxfrom++) { + for(int nefxfrom = 0; nefxfrom < nefx; ++nefxfrom) { if(Psysefxsend[nefxfrom][nefx] != 0) { const float vol = sysefxsend[nefxfrom][nefx]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { tmpmixl[i] += sysefx[nefxfrom]->efxoutl[i] * vol; tmpmixr[i] += sysefx[nefxfrom]->efxoutr[i] * vol; } @@ -370,7 +370,7 @@ void Master::AudioOut(float *outl, float *outr) //Add the System Effect to sound output const float outvol = sysefx[nefx]->sysefxgetvolume(); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { outl[i] += tmpmixl[i] * outvol; outr[i] += tmpmixr[i] * outvol; } @@ -380,9 +380,9 @@ void Master::AudioOut(float *outl, float *outr) } //Mix all parts - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { if(part[npart]->Penabled) { //only mix active parts - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //the volume did not changed + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { //the volume did not changed outl[i] += part[npart]->partoutl[i]; outr[i] += part[npart]->partoutr[i]; } @@ -390,13 +390,13 @@ void Master::AudioOut(float *outl, float *outr) } //Insertion effects for Master Out - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) + for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) if(Pinsparts[nefx] == -2) insefx[nefx]->out(outl, outr); //Master Volume - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { outl[i] *= volume; outr[i] *= volume; } @@ -408,7 +408,7 @@ void Master::AudioOut(float *outl, float *outr) //Shutup if it is asked (with fade-out) if(shutup) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float tmp = (SOUND_BUFFER_SIZE - i) / (float) SOUND_BUFFER_SIZE; outl[i] *= tmp; @@ -468,11 +468,11 @@ void Master::GetAudioOutSamples(size_t nsamples, Master::~Master() { - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) delete part[npart]; - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) + for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) delete insefx[nefx]; - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) + for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) delete sysefx[nefx]; delete fft; @@ -517,13 +517,13 @@ void Master::setPsysefxsend(int Pefxfrom, int Pefxto, char Pvol) */ void Master::ShutUp() { - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { part[npart]->cleanup(); fakepeakpart[npart] = 0; } - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) + for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) insefx[nefx]->cleanup(); - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) + for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) sysefx[nefx]->cleanup(); vuresetpeaks(); shutup = 0; @@ -555,7 +555,7 @@ vuData Master::getVuData() void Master::applyparameters(bool lockmutex) { - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) part[npart]->applyparameters(lockmutex); } @@ -569,26 +569,26 @@ void Master::add2XML(XMLwrapper *xml) microtonal.add2XML(xml); xml->endbranch(); - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { xml->beginbranch("PART", npart); part[npart]->add2XML(xml); xml->endbranch(); } xml->beginbranch("SYSTEM_EFFECTS"); - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) { xml->beginbranch("SYSTEM_EFFECT", nefx); xml->beginbranch("EFFECT"); sysefx[nefx]->add2XML(xml); xml->endbranch(); - for(int pefx = 0; pefx < NUM_MIDI_PARTS; pefx++) { + for(int pefx = 0; pefx < NUM_MIDI_PARTS; ++pefx) { xml->beginbranch("VOLUME", pefx); xml->addpar("vol", Psysefxvol[nefx][pefx]); xml->endbranch(); } - for(int tonefx = nefx + 1; tonefx < NUM_SYS_EFX; tonefx++) { + for(int tonefx = nefx + 1; tonefx < NUM_SYS_EFX; ++tonefx) { xml->beginbranch("SENDTO", tonefx); xml->addpar("send_vol", Psysefxsend[nefx][tonefx]); xml->endbranch(); @@ -600,7 +600,7 @@ void Master::add2XML(XMLwrapper *xml) xml->endbranch(); xml->beginbranch("INSERTION_EFFECTS"); - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) { xml->beginbranch("INSERTION_EFFECT", nefx); xml->addpar("part", Pinsparts[nefx]); @@ -691,7 +691,7 @@ void Master::getfromXML(XMLwrapper *xml) part[0]->Penabled = 0; - for(int npart = 0; npart < NUM_MIDI_PARTS; npart++) { + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { if(xml->enterbranch("PART", npart) == 0) continue; part[npart]->getfromXML(xml); @@ -705,7 +705,7 @@ void Master::getfromXML(XMLwrapper *xml) sysefx[0]->changeeffect(0); if(xml->enterbranch("SYSTEM_EFFECTS")) { - for(int nefx = 0; nefx < NUM_SYS_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) { if(xml->enterbranch("SYSTEM_EFFECT", nefx) == 0) continue; if(xml->enterbranch("EFFECT")) { @@ -713,7 +713,7 @@ void Master::getfromXML(XMLwrapper *xml) xml->exitbranch(); } - for(int partefx = 0; partefx < NUM_MIDI_PARTS; partefx++) { + for(int partefx = 0; partefx < NUM_MIDI_PARTS; ++partefx) { if(xml->enterbranch("VOLUME", partefx) == 0) continue; setPsysefxvol(partefx, nefx, @@ -721,7 +721,7 @@ void Master::getfromXML(XMLwrapper *xml) xml->exitbranch(); } - for(int tonefx = nefx + 1; tonefx < NUM_SYS_EFX; tonefx++) { + for(int tonefx = nefx + 1; tonefx < NUM_SYS_EFX; ++tonefx) { if(xml->enterbranch("SENDTO", tonefx) == 0) continue; setPsysefxsend(nefx, tonefx, @@ -736,7 +736,7 @@ void Master::getfromXML(XMLwrapper *xml) if(xml->enterbranch("INSERTION_EFFECTS")) { - for(int nefx = 0; nefx < NUM_INS_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) { if(xml->enterbranch("INSERTION_EFFECT", nefx) == 0) continue; Pinsparts[nefx] = xml->getpar("part", diff --git a/src/Misc/Microtonal.cpp b/src/Misc/Microtonal.cpp @@ -49,10 +49,10 @@ void Microtonal::defaults() Pmapsize = 12; Pmappingenabled = 0; - for(int i = 0; i < 128; i++) + for(int i = 0; i < 128; ++i) Pmapping[i] = i; - for(int i = 0; i < MAX_OCTAVE_SIZE; i++) { + for(int i = 0; i < MAX_OCTAVE_SIZE; ++i) { octave[i].tuning = tmpoctave[i].tuning = pow( 2, (i % octavesize @@ -64,7 +64,7 @@ void Microtonal::defaults() octave[11].type = 2; octave[11].x1 = 2; octave[11].x2 = 1; - for(int i = 0; i < MICROTONAL_MAX_NAME_LEN; i++) { + for(int i = 0; i < MICROTONAL_MAX_NAME_LEN; ++i) { Pname[i] = '\0'; Pcomment[i] = '\0'; } @@ -137,7 +137,7 @@ float Microtonal::getnotefreq(int note, int keyshift) const minus = 1; } int deltanote = 0; - for(int i = 0; i < tmp; i++) + for(int i = 0; i < tmp; ++i) if(Pmapping[i % Pmapsize] >= 0) deltanote++; float rap_anote_middlenote = @@ -227,10 +227,10 @@ bool Microtonal::operator!=(const Microtonal &micro) const MCREQ(Pmapsize); MCREQ(Pmappingenabled); - for(int i = 0; i < 128; i++) + for(int i = 0; i < 128; ++i) MCREQ(Pmapping[i]); - for(int i = 0; i < octavesize; i++) { + for(int i = 0; i < octavesize; ++i) { FMCREQ(octave[i].tuning); MCREQ(octave[i].type); MCREQ(octave[i].x1); @@ -317,7 +317,7 @@ int Microtonal::texttotunings(const char *text) char *lin; lin = new char[MAX_LINE_SIZE + 1]; while(k < strlen(text)) { - for(i = 0; i < MAX_LINE_SIZE; i++) { + for(i = 0; i < MAX_LINE_SIZE; ++i) { lin[i] = text[k++]; if(lin[i] < 0x20) break; @@ -338,7 +338,7 @@ int Microtonal::texttotunings(const char *text) if(nl == 0) return -2; //the input is empty octavesize = nl; - for(i = 0; i < octavesize; i++) { + for(i = 0; i < octavesize; ++i) { octave[i].tuning = tmpoctave[i].tuning; octave[i].type = tmpoctave[i].type; octave[i].x1 = tmpoctave[i].x1; @@ -355,11 +355,11 @@ void Microtonal::texttomapping(const char *text) unsigned int i, k = 0; char *lin; lin = new char[MAX_LINE_SIZE + 1]; - for(i = 0; i < 128; i++) + for(i = 0; i < 128; ++i) Pmapping[i] = -1; int tx = 0; while(k < strlen(text)) { - for(i = 0; i < MAX_LINE_SIZE; i++) { + for(i = 0; i < MAX_LINE_SIZE; ++i) { lin[i] = text[k++]; if(lin[i] < 0x20) break; @@ -420,7 +420,7 @@ int Microtonal::loadscl(const char *filename) //loads the short description if(loadline(file, &tmp[0]) != 0) return 2; - for(int i = 0; i < 500; i++) + for(int i = 0; i < 500; ++i) if(tmp[i] < 32) tmp[i] = 0; snprintf((char *) Pname, MICROTONAL_MAX_NAME_LEN, "%s", tmp); @@ -433,7 +433,7 @@ int Microtonal::loadscl(const char *filename) if(nnotes > MAX_OCTAVE_SIZE) return 2; //load the tunnings - for(int nline = 0; nline < nnotes; nline++) { + for(int nline = 0; nline < nnotes; ++nline) { if(loadline(file, &tmp[0]) != 0) return 2; linetotunings(nline, &tmp[0]); @@ -441,7 +441,7 @@ int Microtonal::loadscl(const char *filename) fclose(file); octavesize = nnotes; - for(int i = 0; i < octavesize; i++) { + for(int i = 0; i < octavesize; ++i) { octave[i].tuning = tmpoctave[i].tuning; octave[i].type = tmpoctave[i].type; octave[i].x1 = tmpoctave[i].x1; @@ -525,7 +525,7 @@ int Microtonal::loadkbm(const char *filename) //load the mappings if(Pmapsize != 0) { - for(int nline = 0; nline < Pmapsize; nline++) { + for(int nline = 0; nline < Pmapsize; ++nline) { if(loadline(file, &tmp[0]) != 0) return 2; if(sscanf(&tmp[0], "%d", &x) == 0) @@ -571,7 +571,7 @@ void Microtonal::add2XML(XMLwrapper *xml) const xml->beginbranch("OCTAVE"); xml->addpar("octave_size", octavesize); - for(int i = 0; i < octavesize; i++) { + for(int i = 0; i < octavesize; ++i) { xml->beginbranch("DEGREE", i); if(octave[i].type == 1) xml->addparreal("cents", octave[i].tuning); @@ -587,7 +587,7 @@ void Microtonal::add2XML(XMLwrapper *xml) const xml->beginbranch("KEYBOARD_MAPPING"); xml->addpar("map_size", Pmapsize); xml->addpar("mapping_enabled", Pmappingenabled); - for(int i = 0; i < Pmapsize; i++) { + for(int i = 0; i < Pmapsize; ++i) { xml->beginbranch("KEYMAP", i); xml->addpar("degree", Pmapping[i]); xml->endbranch(); @@ -620,7 +620,7 @@ void Microtonal::getfromXML(XMLwrapper *xml) if(xml->enterbranch("OCTAVE")) { octavesize = xml->getpar127("octave_size", octavesize); - for(int i = 0; i < octavesize; i++) { + for(int i = 0; i < octavesize; ++i) { if(xml->enterbranch("DEGREE", i) == 0) continue; octave[i].x2 = 0; @@ -641,7 +641,7 @@ void Microtonal::getfromXML(XMLwrapper *xml) if(xml->enterbranch("KEYBOARD_MAPPING")) { Pmapsize = xml->getpar127("map_size", Pmapsize); Pmappingenabled = xml->getpar127("mapping_enabled", Pmappingenabled); - for(int i = 0; i < Pmapsize; i++) { + for(int i = 0; i < Pmapsize; ++i) { if(xml->enterbranch("KEYMAP", i) == 0) continue; Pmapping[i] = xml->getpar127("degree", Pmapping[i]); diff --git a/src/Misc/Part.cpp b/src/Misc/Part.cpp @@ -43,7 +43,7 @@ Part::Part(Microtonal *microtonal_, FFTwrapper *fft_, pthread_mutex_t *mutex_) partoutl = new float [SOUND_BUFFER_SIZE]; partoutr = new float [SOUND_BUFFER_SIZE]; - for(int n = 0; n < NUM_KIT_ITEMS; n++) { + for(int n = 0; n < NUM_KIT_ITEMS; ++n) { kit[n].Pname = new unsigned char [PART_MAX_NAME_LEN]; kit[n].adpars = NULL; kit[n].subpars = NULL; @@ -55,12 +55,12 @@ Part::Part(Microtonal *microtonal_, FFTwrapper *fft_, pthread_mutex_t *mutex_) kit[0].padpars = new PADnoteParameters(fft, mutex); //Part's Insertion Effects init - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { partefx[nefx] = new EffectMgr(1, mutex); Pefxbypass[nefx] = false; } - for(int n = 0; n < NUM_PART_EFX + 1; n++) { + for(int n = 0; n < NUM_PART_EFX + 1; ++n) { partfxinputl[n] = new float [SOUND_BUFFER_SIZE]; partfxinputr[n] = new float [SOUND_BUFFER_SIZE]; } @@ -68,11 +68,11 @@ Part::Part(Microtonal *microtonal_, FFTwrapper *fft_, pthread_mutex_t *mutex_) killallnotes = 0; oldfreq = -1.0; - for(int i = 0; i < POLIPHONY; i++) { + for(int i = 0; i < POLIPHONY; ++i) { partnote[i].status = KEY_OFF; partnote[i].note = -1; partnote[i].itemsplaying = 0; - for(int j = 0; j < NUM_KIT_ITEMS; j++) { + for(int j = 0; j < NUM_KIT_ITEMS; ++j) { partnote[i].kititem[j].adnote = NULL; partnote[i].kititem[j].subnote = NULL; partnote[i].kititem[j].padnote = NULL; @@ -121,7 +121,7 @@ void Part::defaultsinstrument() Pkitmode = 0; Pdrummode = 0; - for(int n = 0; n < NUM_KIT_ITEMS; n++) { + for(int n = 0; n < NUM_KIT_ITEMS; ++n) { kit[n].Penabled = 0; kit[n].Pmuted = 0; kit[n].Pminkey = 0; @@ -140,7 +140,7 @@ void Part::defaultsinstrument() kit[0].subpars->defaults(); kit[0].padpars->defaults(); - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { partefx[nefx]->defaults(); Pefxroute[nefx] = 0; //route to next effect } @@ -153,17 +153,17 @@ void Part::defaultsinstrument() */ void Part::cleanup(bool final) { - for(int k = 0; k < POLIPHONY; k++) + for(int k = 0; k < POLIPHONY; ++k) KillNotePos(k); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { partoutl[i] = final ? 0.0 : denormalkillbuf[i]; partoutr[i] = final ? 0.0 : denormalkillbuf[i]; } ctl.resetall(); - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) + for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) partefx[nefx]->cleanup(); - for(int n = 0; n < NUM_PART_EFX + 1; n++) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int n = 0; n < NUM_PART_EFX + 1; ++n) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { partfxinputl[n][i] = final ? 0.0 : denormalkillbuf[i]; partfxinputr[n][i] = final ? 0.0 : denormalkillbuf[i]; } @@ -173,7 +173,7 @@ void Part::cleanup(bool final) Part::~Part() { cleanup(true); - for(int n = 0; n < NUM_KIT_ITEMS; n++) { + for(int n = 0; n < NUM_KIT_ITEMS; ++n) { if(kit[n].adpars != NULL) delete (kit[n].adpars); if(kit[n].subpars != NULL) @@ -189,9 +189,9 @@ Part::~Part() delete [] Pname; delete [] partoutl; delete [] partoutr; - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) + for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) delete (partefx[nefx]); - for(int n = 0; n < NUM_PART_EFX + 1; n++) { + for(int n = 0; n < NUM_PART_EFX + 1; ++n) { delete [] partfxinputl[n]; delete [] partfxinputr[n]; } @@ -237,7 +237,7 @@ void Part::NoteOn(unsigned char note, lastnote = note; pos = -1; - for(i = 0; i < POLIPHONY; i++) { + for(i = 0; i < POLIPHONY; ++i) { if(partnote[i].status == KEY_OFF) { pos = i; break; @@ -262,14 +262,14 @@ void Part::NoteOn(unsigned char note, } else { // Legato mode is valid, but this is only a first note. - for(i = 0; i < POLIPHONY; i++) + for(i = 0; i < POLIPHONY; ++i) if((partnote[i].status == KEY_PLAYING) || (partnote[i].status == KEY_RELASED_AND_SUSTAINED)) RelaseNotePos(i); // Set posb posb = (pos + 1) % POLIPHONY; //We really want it (if the following fails) - for(i = 0; i < POLIPHONY; i++) + for(i = 0; i < POLIPHONY; ++i) if((partnote[i].status == KEY_OFF) && (pos != i)) { posb = i; break; @@ -280,7 +280,7 @@ void Part::NoteOn(unsigned char note, } else // Legato mode is either off or non-applicable. if(Ppolymode == 0) { //if the mode is 'mono' turn off all other notes - for(i = 0; i < POLIPHONY; i++) + for(i = 0; i < POLIPHONY; ++i) if(partnote[i].status == KEY_PLAYING) RelaseNotePos(i); RelaseSustainedKeys(); @@ -380,7 +380,7 @@ void Part::NoteOn(unsigned char note, } else { // "kit mode" legato note int ci = 0; - for(int item = 0; item < NUM_KIT_ITEMS; item++) { + for(int item = 0; item < NUM_KIT_ITEMS; ++item) { if(kit[item].Pmuted != 0) continue; if((note < kit[item].Pminkey) || (note > kit[item].Pmaxkey)) @@ -480,7 +480,7 @@ void Part::NoteOn(unsigned char note, } } else { //init the notes for the "kit mode" - for(int item = 0; item < NUM_KIT_ITEMS; item++) { + for(int item = 0; item < NUM_KIT_ITEMS; ++item) { if(kit[item].Pmuted != 0) continue; if((note < kit[item].Pminkey) || (note > kit[item].Pmaxkey)) @@ -631,7 +631,7 @@ void Part::SetController(unsigned int type, int par) setPvolume(Pvolume); //update the volume setPpanning(Ppanning); //update the panning - for(int item = 0; item < NUM_KIT_ITEMS; item++) { + for(int item = 0; item < NUM_KIT_ITEMS; ++item) { if(kit[item].adpars == NULL) continue; kit[item].adpars->GlobalPar.Reson-> @@ -647,7 +647,7 @@ void Part::SetController(unsigned int type, int par) break; case C_resonance_center: ctl.setresonancecenter(par); - for(int item = 0; item < NUM_KIT_ITEMS; item++) { + for(int item = 0; item < NUM_KIT_ITEMS; ++item) { if(kit[item].adpars == NULL) continue; kit[item].adpars->GlobalPar.Reson-> @@ -672,7 +672,7 @@ void Part::RelaseSustainedKeys() if(monomemnotes.back() != lastnote) // Sustain controller manipulation would cause repeated same note respawn without this check. MonoMemRenote(); // To play most recent still held note. - for(int i = 0; i < POLIPHONY; i++) + for(int i = 0; i < POLIPHONY; ++i) if(partnote[i].status == KEY_RELASED_AND_SUSTAINED) RelaseNotePos(i); } @@ -683,7 +683,7 @@ void Part::RelaseSustainedKeys() void Part::RelaseAllKeys() { - for(int i = 0; i < POLIPHONY; i++) + for(int i = 0; i < POLIPHONY; ++i) if((partnote[i].status != KEY_RELASED) && (partnote[i].status != KEY_OFF)) //thanks to Frank Neumann RelaseNotePos(i); @@ -707,7 +707,7 @@ void Part::MonoMemRenote() */ void Part::RelaseNotePos(int pos) { - for(int j = 0; j < NUM_KIT_ITEMS; j++) { + for(int j = 0; j < NUM_KIT_ITEMS; ++j) { if(partnote[pos].kititem[j].adnote != NULL) if(partnote[pos].kititem[j].adnote) partnote[pos].kititem[j].adnote->relasekey(); @@ -734,7 +734,7 @@ void Part::KillNotePos(int pos) partnote[pos].time = 0; partnote[pos].itemsplaying = 0; - for(int j = 0; j < NUM_KIT_ITEMS; j++) { + for(int j = 0; j < NUM_KIT_ITEMS; ++j) { if(partnote[pos].kititem[j].adnote != NULL) { delete (partnote[pos].kititem[j].adnote); partnote[pos].kititem[j].adnote = NULL; @@ -768,14 +768,14 @@ void Part::setkeylimit(unsigned char Pkeylimit) //release old keys if the number of notes>keylimit if(Ppolymode != 0) { int notecount = 0; - for(int i = 0; i < POLIPHONY; i++) + for(int i = 0; i < POLIPHONY; ++i) if((partnote[i].status == KEY_PLAYING) || (partnote[i].status == KEY_RELASED_AND_SUSTAINED)) notecount++; int oldestnotepos = -1; if(notecount > keylimit) { //find out the oldest note - for(int i = 0; i < POLIPHONY; i++) { + for(int i = 0; i < POLIPHONY; ++i) { int maxtime = 0; if(((partnote[i].status == KEY_PLAYING) || (partnote[i].status == KEY_RELASED_AND_SUSTAINED)) @@ -802,7 +802,7 @@ void Part::AllNotesOff() void Part::RunNote(unsigned int k) { unsigned noteplay = 0; - for(int item = 0; item < partnote[k].itemsplaying; item++) { + for(int item = 0; item < partnote[k].itemsplaying; ++item) { int sendcurrenttofx = partnote[k].kititem[item].sendtoparteffect; for(unsigned type = 0; type < 3; ++type) { @@ -828,7 +828,7 @@ void Part::RunNote(unsigned int k) delete (*note); (*note) = NULL; } - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //add the note to part(mix) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { //add the note to part(mix) partfxinputl[sendcurrenttofx][i] += tmpoutl[i]; partfxinputr[sendcurrenttofx][i] += tmpoutr[i]; } @@ -847,14 +847,14 @@ void Part::RunNote(unsigned int k) */ void Part::ComputePartSmps() { - for(unsigned nefx = 0; nefx < NUM_PART_EFX + 1; nefx++) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(unsigned nefx = 0; nefx < NUM_PART_EFX + 1; ++nefx) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { partfxinputl[nefx][i] = 0.0; partfxinputr[nefx][i] = 0.0; } } - for(unsigned k = 0; k < POLIPHONY; k++) { + for(unsigned k = 0; k < POLIPHONY; ++k) { if(partnote[k].status == KEY_OFF) continue; partnote[k].time++; @@ -864,39 +864,39 @@ void Part::ComputePartSmps() //Apply part's effects and mix them - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { if(!Pefxbypass[nefx]) { partefx[nefx]->out(partfxinputl[nefx], partfxinputr[nefx]); if(Pefxroute[nefx] == 2) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { partfxinputl[nefx + 1][i] += partefx[nefx]->efxoutl[i]; partfxinputr[nefx + 1][i] += partefx[nefx]->efxoutr[i]; } } } int routeto = ((Pefxroute[nefx] == 0) ? nefx + 1 : NUM_PART_EFX); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { partfxinputl[routeto][i] += partfxinputl[nefx][i]; partfxinputr[routeto][i] += partfxinputr[nefx][i]; } } - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { partoutl[i] = partfxinputl[NUM_PART_EFX][i]; partoutr[i] = partfxinputr[NUM_PART_EFX][i]; } //Kill All Notes if killallnotes!=0 if(killallnotes != 0) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float tmp = (SOUND_BUFFER_SIZE - i) / (float) SOUND_BUFFER_SIZE; partoutl[i] *= tmp; partoutr[i] *= tmp; } - for(int k = 0; k < POLIPHONY; k++) + for(int k = 0; k < POLIPHONY; ++k) KillNotePos(k); killallnotes = 0; - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) + for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) partefx[nefx]->cleanup(); } @@ -957,7 +957,7 @@ void Part::setkititemstatus(int kititem, int Penabled_) } if(resetallnotes) - for(int k = 0; k < POLIPHONY; k++) + for(int k = 0; k < POLIPHONY; ++k) KillNotePos(k); } @@ -975,7 +975,7 @@ void Part::add2XMLinstrument(XMLwrapper *xml) xml->addpar("kit_mode", Pkitmode); xml->addparbool("drum_mode", Pdrummode); - for(int i = 0; i < NUM_KIT_ITEMS; i++) { + for(int i = 0; i < NUM_KIT_ITEMS; ++i) { xml->beginbranch("INSTRUMENT_KIT_ITEM", i); xml->addparbool("enabled", kit[i].Penabled); if(kit[i].Penabled != 0) { @@ -1013,7 +1013,7 @@ void Part::add2XMLinstrument(XMLwrapper *xml) xml->endbranch(); xml->beginbranch("INSTRUMENT_EFFECTS"); - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { xml->beginbranch("INSTRUMENT_EFFECT", nefx); xml->beginbranch("EFFECT"); partefx[nefx]->add2XML(xml); @@ -1092,7 +1092,7 @@ int Part::loadXMLinstrument(const char *filename)/*{*/ void Part::applyparameters(bool lockmutex)/*{*/ { - for(int n = 0; n < NUM_KIT_ITEMS; n++) + for(int n = 0; n < NUM_KIT_ITEMS; ++n) if((kit[n].padpars != NULL) && (kit[n].Ppadenabled != 0)) kit[n].padpars->applyparameters(lockmutex); }/*}*/ @@ -1113,7 +1113,7 @@ void Part::getfromXMLinstrument(XMLwrapper *xml) Pdrummode = xml->getparbool("drum_mode", Pdrummode); setkititemstatus(0, 0); - for(int i = 0; i < NUM_KIT_ITEMS; i++) { + for(int i = 0; i < NUM_KIT_ITEMS; ++i) { if(xml->enterbranch("INSTRUMENT_KIT_ITEM", i) == 0) continue; setkititemstatus(i, xml->getparbool("enabled", kit[i].Penabled)); @@ -1161,7 +1161,7 @@ void Part::getfromXMLinstrument(XMLwrapper *xml) if(xml->enterbranch("INSTRUMENT_EFFECTS")) { - for(int nefx = 0; nefx < NUM_PART_EFX; nefx++) { + for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { if(xml->enterbranch("INSTRUMENT_EFFECT", nefx) == 0) continue; if(xml->enterbranch("EFFECT")) { diff --git a/src/Misc/Util.cpp b/src/Misc/Util.cpp @@ -133,7 +133,7 @@ void os_sleep(long length) std::string legalizeFilename(std::string filename) { - for(int i = 0; i < (int) filename.size(); i++) { + for(int i = 0; i < (int) filename.size(); ++i) { char c = filename[i]; if(!(isdigit(c) || isalpha(c) || (c == '-') || (c == ' '))) filename[i] = '_'; @@ -143,7 +143,7 @@ std::string legalizeFilename(std::string filename) void invSignal(float *sig, size_t len) { - for(size_t i = 0; i < len; i++) + for(size_t i = 0; i < len; ++i) sig[i] *= -1.0f; } diff --git a/src/Misc/WaveShapeSmps.cpp b/src/Misc/WaveShapeSmps.cpp @@ -35,7 +35,7 @@ void waveShapeSmps(int n, switch(type) { case 1: ws = pow(10, ws * ws * 3.0) - 1.0 + 0.001; //Arctangent - for(i = 0; i < n; i++) + for(i = 0; i < n; ++i) smps[i] = atan(smps[i] * ws) / atan(ws); break; case 2: @@ -44,13 +44,13 @@ void waveShapeSmps(int n, tmpv = sin(ws) + 0.1; else tmpv = 1.1; - for(i = 0; i < n; i++) + for(i = 0; i < n; ++i) smps[i] = sin(smps[i] * (0.1 + ws - ws * smps[i])) / tmpv; ; break; case 3: ws = ws * ws * ws * 20.0 + 0.0001; //Pow - for(i = 0; i < n; i++) { + for(i = 0; i < n; ++i) { smps[i] *= ws; if(fabs(smps[i]) < 1.0) { smps[i] = (smps[i] - pow(smps[i], 3.0)) * 3.0; @@ -67,12 +67,12 @@ void waveShapeSmps(int n, tmpv = sin(ws); else tmpv = 1.0; - for(i = 0; i < n; i++) + for(i = 0; i < n; ++i) smps[i] = sin(smps[i] * ws) / tmpv; break; case 5: ws = ws * ws + 0.000001; //Quantisize - for(i = 0; i < n; i++) + for(i = 0; i < n; ++i) smps[i] = floor(smps[i] / ws + 0.5) * ws; break; case 6: @@ -81,12 +81,12 @@ void waveShapeSmps(int n, tmpv = sin(ws); else tmpv = 1.0; - for(i = 0; i < n; i++) + for(i = 0; i < n; ++i) smps[i] = asin(sin(smps[i] * ws)) / tmpv; break; case 7: ws = pow(2.0, -ws * ws * 8.0); //Limiter - for(i = 0; i < n; i++) { + for(i = 0; i < n; ++i) { float tmp = smps[i]; if(fabs(tmp) > ws) { if(tmp >= 0.0) @@ -100,7 +100,7 @@ void waveShapeSmps(int n, break; case 8: ws = pow(2.0, -ws * ws * 8.0); //Upper Limiter - for(i = 0; i < n; i++) { + for(i = 0; i < n; ++i) { float tmp = smps[i]; if(tmp > ws) smps[i] = ws; @@ -109,7 +109,7 @@ void waveShapeSmps(int n, break; case 9: ws = pow(2.0, -ws * ws * 8.0); //Lower Limiter - for(i = 0; i < n; i++) { + for(i = 0; i < n; ++i) { float tmp = smps[i]; if(tmp < -ws) smps[i] = -ws; @@ -118,7 +118,7 @@ void waveShapeSmps(int n, break; case 10: ws = (pow(2.0, ws * 6.0) - 1.0) / pow(2.0, 6.0); //Inverse Limiter - for(i = 0; i < n; i++) { + for(i = 0; i < n; ++i) { float tmp = smps[i]; if(fabs(tmp) > ws) { if(tmp >= 0.0) @@ -132,7 +132,7 @@ void waveShapeSmps(int n, break; case 11: ws = pow(5, ws * ws * 1.0) - 1.0; //Clip - for(i = 0; i < n; i++) + for(i = 0; i < n; ++i) smps[i] = smps[i] * (ws + 0.5) * 0.9999 - floor( 0.5 + smps[i] * (ws + 0.5) * 0.9999); @@ -143,7 +143,7 @@ void waveShapeSmps(int n, tmpv = ws; else tmpv = 1.0; - for(i = 0; i < n; i++) { + for(i = 0; i < n; ++i) { float tmp = smps[i] * ws; if((tmp > -2.0) && (tmp < 1.0)) smps[i] = tmp * (1.0 - tmp) * (tmp + 2.0) / tmpv; @@ -157,7 +157,7 @@ void waveShapeSmps(int n, tmpv = ws * (1 + ws) / 2.0; else tmpv = 1.0; - for(i = 0; i < n; i++) { + for(i = 0; i < n; ++i) { float tmp = smps[i] * ws; if((tmp > -1.0) && (tmp < 1.618034)) smps[i] = tmp * (1.0 - tmp) / tmpv; @@ -174,7 +174,7 @@ void waveShapeSmps(int n, tmpv = 0.5; else tmpv = 0.5 - 1.0 / (exp(ws) + 1.0); - for(i = 0; i < n; i++) { + for(i = 0; i < n; ++i) { float tmp = smps[i] * ws; if(tmp < -10.0) tmp = -10.0; diff --git a/src/Nio/OssEngine.cpp b/src/Nio/OssEngine.cpp @@ -212,7 +212,7 @@ void *OssEngine::thread() const Stereo<float *> smps = getNext(); float l, r; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { l = smps.l[i]; r = smps.r[i]; diff --git a/src/Nio/PaEngine.cpp b/src/Nio/PaEngine.cpp @@ -100,7 +100,7 @@ int PaEngine::process(float *out, unsigned long framesPerBuffer) // cerr << "Bug: PaEngine::process SOUND_BUFFER_SIZE!=framesPerBuffer" // << framesPerBuffer << ' ' << smp.l.size() << endl; - for(int i = 0; i < framesPerBuffer; i++) { + for(int i = 0; i < framesPerBuffer; ++i) { *out++ = smp.l[i]; *out++ = smp.r[i]; } diff --git a/src/Output/DSSIaudiooutput.cpp b/src/Output/DSSIaudiooutput.cpp @@ -674,7 +674,7 @@ bool DSSIaudiooutput::mapNextBank() else { bank.loadbank(bank.banks[bankNoToMap].dir); - for(unsigned long instrument = 0; instrument < BANK_SIZE; instrument++) + for(unsigned long instrument = 0; instrument < BANK_SIZE; ++instrument) { string insName = bank.getname(instrument); if(!insName.empty() && insName[0] != '\0' && insName[0] != ' ') diff --git a/src/Params/ADnoteParameters.cpp b/src/Params/ADnoteParameters.cpp @@ -43,7 +43,7 @@ ADnoteParameters::ADnoteParameters(FFTwrapper *fft_) fft = fft_; - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) EnableVoice(nvoice); defaults(); @@ -71,7 +71,7 @@ void ADnoteParameters::defaults() //Default Parameters GlobalPar.defaults(); - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) defaults(nvoice); VoicePar[0].Enabled = 1; @@ -280,7 +280,7 @@ ADnoteGlobalParam::~ADnoteGlobalParam() ADnoteParameters::~ADnoteParameters() { - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) KillVoice(nvoice); } @@ -304,7 +304,7 @@ int ADnoteParameters::get_unison_size_index(int nvoice) { void ADnoteParameters::set_unison_size_index(int nvoice, int index) { int unison = 1; - for(int i = 0; i <= index; i++) { + for(int i = 0; i <= index; ++i) { unison = ADnote_unison_sizes[i]; if(unison == 0) { unison = ADnote_unison_sizes[i - 1]; @@ -325,7 +325,7 @@ void ADnoteParameters::add2XMLsection(XMLwrapper *xml, int n) int oscilused = 0, fmoscilused = 0; //if the oscil or fmoscil are used by another voice - for(int i = 0; i < NUM_VOICES; i++) { + for(int i = 0; i < NUM_VOICES; ++i) { if(VoicePar[i].Pextoscil == nvoice) oscilused = 1; if(VoicePar[i].PextFMoscil == nvoice) @@ -544,7 +544,7 @@ void ADnoteGlobalParam::add2XML(XMLwrapper *xml) void ADnoteParameters::add2XML(XMLwrapper *xml) { GlobalPar.add2XML(xml); - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) { + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { xml->beginbranch("VOICE", nvoice); add2XMLsection(xml, nvoice); xml->endbranch(); @@ -631,7 +631,7 @@ void ADnoteParameters::getfromXML(XMLwrapper *xml) { GlobalPar.getfromXML(xml); - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) { + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { VoicePar[nvoice].Enabled = 0; if(xml->enterbranch("VOICE", nvoice) == 0) continue; diff --git a/src/Params/EnvelopeParams.cpp b/src/Params/EnvelopeParams.cpp @@ -39,7 +39,7 @@ EnvelopeParams::EnvelopeParams(unsigned char Penvstretch_, PS_val = 64; PR_val = 64; - for(i = 0; i < MAX_ENVELOPE_POINTS; i++) { + for(i = 0; i < MAX_ENVELOPE_POINTS; ++i) { Penvdt[i] = 32; Penvval[i] = 64; } @@ -223,7 +223,7 @@ void EnvelopeParams::add2XML(XMLwrapper *xml) xml->addpar("R_val", PR_val); if((Pfreemode != 0) || (!xml->minimal)) { - for(int i = 0; i < Penvpoints; i++) { + for(int i = 0; i < Penvpoints; ++i) { xml->beginbranch("POINT", i); if(i != 0) xml->addpar("dt", Penvdt[i]); @@ -252,7 +252,7 @@ void EnvelopeParams::getfromXML(XMLwrapper *xml) PS_val = xml->getpar127("S_val", PS_val); PR_val = xml->getpar127("R_val", PR_val); - for(int i = 0; i < Penvpoints; i++) { + for(int i = 0; i < Penvpoints; ++i) { if(xml->enterbranch("POINT", i) == 0) continue; if(i != 0) diff --git a/src/Params/FilterParams.cpp b/src/Params/FilterParams.cpp @@ -56,12 +56,12 @@ void FilterParams::defaults() Pnumformants = 3; Pformantslowness = 64; - for(int j = 0; j < FF_MAX_VOWELS; j++) + for(int j = 0; j < FF_MAX_VOWELS; ++j) defaults(j); ; Psequencesize = 3; - for(int i = 0; i < FF_MAX_SEQUENCE; i++) + for(int i = 0; i < FF_MAX_SEQUENCE; ++i) Psequence[i].nvowel = i % FF_MAX_VOWELS; Psequencestretch = 40; @@ -74,7 +74,7 @@ void FilterParams::defaults() void FilterParams::defaults(int n) { int j = n; - for(int i = 0; i < FF_MAX_FORMANTS; i++) { + for(int i = 0; i < FF_MAX_FORMANTS; ++i) { Pvowels[j].formants[i].freq = (int)(RND * 127.0); //some random freqs Pvowels[j].formants[i].q = 64; Pvowels[j].formants[i].amp = 127; @@ -104,8 +104,8 @@ void FilterParams::getfromFilterParams(FilterParams *pars) Pnumformants = pars->Pnumformants; Pformantslowness = pars->Pformantslowness; - for(int j = 0; j < FF_MAX_VOWELS; j++) { - for(int i = 0; i < FF_MAX_FORMANTS; i++) { + for(int j = 0; j < FF_MAX_VOWELS; ++j) { + for(int i = 0; i < FF_MAX_FORMANTS; ++i) { Pvowels[j].formants[i].freq = pars->Pvowels[j].formants[i].freq; Pvowels[j].formants[i].q = pars->Pvowels[j].formants[i].q; Pvowels[j].formants[i].amp = pars->Pvowels[j].formants[i].amp; @@ -113,7 +113,7 @@ void FilterParams::getfromFilterParams(FilterParams *pars) } Psequencesize = pars->Psequencesize; - for(int i = 0; i < FF_MAX_SEQUENCE; i++) + for(int i = 0; i < FF_MAX_SEQUENCE; ++i) Psequence[i].nvowel = pars->Psequence[i].nvowel; Psequencestretch = pars->Psequencestretch; @@ -191,11 +191,11 @@ void FilterParams::formantfilterH(int nvowel, int nfreqs, float *freqs) float filter_freq, filter_q, filter_amp; float omega, sn, cs, alpha; - for(int i = 0; i < nfreqs; i++) + for(int i = 0; i < nfreqs; ++i) freqs[i] = 0.0; //for each formant... - for(int nformant = 0; nformant < Pnumformants; nformant++) { + for(int nformant = 0; nformant < Pnumformants; ++nformant) { //compute formant parameters(frequency,amplitude,etc.) filter_freq = getformantfreq(Pvowels[nvowel].formants[nformant].freq); filter_q = getformantq(Pvowels[nvowel].formants[nformant].q) * getq(); @@ -222,23 +222,23 @@ void FilterParams::formantfilterH(int nvowel, int nfreqs, float *freqs) continue; - for(int i = 0; i < nfreqs; i++) { + for(int i = 0; i < nfreqs; ++i) { float freq = getfreqx(i / (float) nfreqs); if(freq > SAMPLE_RATE / 2) { - for(int tmp = i; tmp < nfreqs; tmp++) + for(int tmp = i; tmp < nfreqs; ++tmp) freqs[tmp] = 0.0; break; } float fr = freq / SAMPLE_RATE * PI * 2.0; float x = c[0], y = 0.0; - for(int n = 1; n < 3; n++) { + for(int n = 1; n < 3; ++n) { x += cos(n * fr) * c[n]; y -= sin(n * fr) * c[n]; } float h = x * x + y * y; x = 1.0; y = 0.0; - for(int n = 1; n < 3; n++) { + for(int n = 1; n < 3; ++n) { x -= cos(n * fr) * d[n]; y += sin(n * fr) * d[n]; } @@ -247,7 +247,7 @@ void FilterParams::formantfilterH(int nvowel, int nfreqs, float *freqs) freqs[i] += pow(h, (Pstages + 1.0) / 2.0) * filter_amp; } } - for(int i = 0; i < nfreqs; i++) { + for(int i = 0; i < nfreqs; ++i) { if(freqs[i] > 0.000000001) freqs[i] = rap2dB(freqs[i]) + getgain(); else @@ -282,7 +282,7 @@ float FilterParams::getformantq(unsigned char q) void FilterParams::add2XMLsection(XMLwrapper *xml, int n) { int nvowel = n; - for(int nformant = 0; nformant < FF_MAX_FORMANTS; nformant++) { + for(int nformant = 0; nformant < FF_MAX_FORMANTS; ++nformant) { xml->beginbranch("FORMANT", nformant); xml->addpar("freq", Pvowels[nvowel].formants[nformant].freq); xml->addpar("amp", Pvowels[nvowel].formants[nformant].amp); @@ -310,7 +310,7 @@ void FilterParams::add2XML(XMLwrapper *xml) xml->addpar("vowel_clearness", Pvowelclearness); xml->addpar("center_freq", Pcenterfreq); xml->addpar("octaves_freq", Poctavesfreq); - for(int nvowel = 0; nvowel < FF_MAX_VOWELS; nvowel++) { + for(int nvowel = 0; nvowel < FF_MAX_VOWELS; ++nvowel) { xml->beginbranch("VOWEL", nvowel); add2XMLsection(xml, nvowel); xml->endbranch(); @@ -318,7 +318,7 @@ void FilterParams::add2XML(XMLwrapper *xml) xml->addpar("sequence_size", Psequencesize); xml->addpar("sequence_stretch", Psequencestretch); xml->addparbool("sequence_reversed", Psequencereversed); - for(int nseq = 0; nseq < FF_MAX_SEQUENCE; nseq++) { + for(int nseq = 0; nseq < FF_MAX_SEQUENCE; ++nseq) { xml->beginbranch("SEQUENCE_POS", nseq); xml->addpar("vowel_id", Psequence[nseq].nvowel); xml->endbranch(); @@ -331,7 +331,7 @@ void FilterParams::add2XML(XMLwrapper *xml) void FilterParams::getfromXMLsection(XMLwrapper *xml, int n) { int nvowel = n; - for(int nformant = 0; nformant < FF_MAX_FORMANTS; nformant++) { + for(int nformant = 0; nformant < FF_MAX_FORMANTS; ++nformant) { if(xml->enterbranch("FORMANT", nformant) == 0) continue; Pvowels[nvowel].formants[nformant].freq = xml->getpar127( @@ -367,7 +367,7 @@ void FilterParams::getfromXML(XMLwrapper *xml) Pcenterfreq = xml->getpar127("center_freq", Pcenterfreq); Poctavesfreq = xml->getpar127("octaves_freq", Poctavesfreq); - for(int nvowel = 0; nvowel < FF_MAX_VOWELS; nvowel++) { + for(int nvowel = 0; nvowel < FF_MAX_VOWELS; ++nvowel) { if(xml->enterbranch("VOWEL", nvowel) == 0) continue; getfromXMLsection(xml, nvowel); @@ -377,7 +377,7 @@ void FilterParams::getfromXML(XMLwrapper *xml) Psequencestretch = xml->getpar127("sequence_stretch", Psequencestretch); Psequencereversed = xml->getparbool("sequence_reversed", Psequencereversed); - for(int nseq = 0; nseq < FF_MAX_SEQUENCE; nseq++) { + for(int nseq = 0; nseq < FF_MAX_SEQUENCE; ++nseq) { if(xml->enterbranch("SEQUENCE_POS", nseq) == 0) continue; Psequence[nseq].nvowel = xml->getpar("vowel_id", diff --git a/src/Params/PADnoteParameters.cpp b/src/Params/PADnoteParameters.cpp @@ -48,7 +48,7 @@ PADnoteParameters::PADnoteParameters(FFTwrapper *fft_, FilterEnvelope->ADSRinit_filter(64, 40, 64, 70, 60, 64); FilterLfo = new LFOParams(80, 0, 64, 0, 0, 0, 0, 2); - for(int i = 0; i < PAD_MAX_SAMPLES; i++) + for(int i = 0; i < PAD_MAX_SAMPLES; ++i) sample[i].smp = NULL; newsample.smp = NULL; @@ -147,7 +147,7 @@ void PADnoteParameters::deletesample(int n) void PADnoteParameters::deletesamples() { - for(int i = 0; i < PAD_MAX_SAMPLES; i++) + for(int i = 0; i < PAD_MAX_SAMPLES; ++i) deletesample(i); } @@ -156,7 +156,7 @@ void PADnoteParameters::deletesamples() */ float PADnoteParameters::getprofile(float *smp, int size) { - for(int i = 0; i < size; i++) + for(int i = 0; i < size; ++i) smp[i] = 0.0; const int supersample = 16; float basepar = pow(2.0, (1.0 - Php.base.par1 / 127.0) * 12.0); @@ -173,7 +173,7 @@ float PADnoteParameters::getprofile(float *smp, int size) float amppar2 = (1.0 - Php.amp.par2 / 127.0) * 0.998 + 0.001; float width = pow(150.0 / (Php.width + 22.0), 2.0); - for(int i = 0; i < size * supersample; i++) { + for(int i = 0; i < size * supersample; ++i) { bool makezero = false; float x = i * 1.0 / (size * (float) supersample); @@ -272,7 +272,7 @@ float PADnoteParameters::getprofile(float *smp, int size) //normalize the profile (make the max. to be equal to 1.0) float max = 0.0; - for(int i = 0; i < size; i++) { + for(int i = 0; i < size; ++i) { if(smp[i] < 0.0) smp[i] = 0.0; if(smp[i] > max) @@ -280,7 +280,7 @@ float PADnoteParameters::getprofile(float *smp, int size) } if(max < 0.00001) max = 1.0; - for(int i = 0; i < size; i++) + for(int i = 0; i < size; ++i) smp[i] /= max; if(!Php.autoscale) @@ -289,7 +289,7 @@ float PADnoteParameters::getprofile(float *smp, int size) //compute the estimated perceived bandwidth float sum = 0.0; int i; - for(i = 0; i < size / 2 - 2; i++) { + for(i = 0; i < size / 2 - 2; ++i) { sum += smp[i] * smp[i] + smp[size - i - 1] * smp[size - i - 1]; if(sum >= 4.0) break; @@ -381,26 +381,26 @@ void PADnoteParameters::generatespectrum_bandwidthMode(float *spectrum, int profilesize, float bwadjust) { - for(int i = 0; i < size; i++) + for(int i = 0; i < size; ++i) spectrum[i] = 0.0; float harmonics[OSCIL_SIZE / 2]; - for(int i = 0; i < OSCIL_SIZE / 2; i++) + for(int i = 0; i < OSCIL_SIZE / 2; ++i) harmonics[i] = 0.0; //get the harmonic structure from the oscillator (I am using the frequency amplitudes, only) oscilgen->get(harmonics, basefreq, false); //normalize float max = 0.0; - for(int i = 0; i < OSCIL_SIZE / 2; i++) + for(int i = 0; i < OSCIL_SIZE / 2; ++i) if(harmonics[i] > max) max = harmonics[i]; if(max < 0.000001) max = 1; - for(int i = 0; i < OSCIL_SIZE / 2; i++) + for(int i = 0; i < OSCIL_SIZE / 2; ++i) harmonics[i] /= max; - for(int nh = 1; nh < OSCIL_SIZE / 2; nh++) { //for each harmonic + for(int nh = 1; nh < OSCIL_SIZE / 2; ++nh) { //for each harmonic float realfreq = getNhr(nh) * basefreq; if(realfreq > SAMPLE_RATE * 0.49999) break; @@ -451,7 +451,7 @@ void PADnoteParameters::generatespectrum_bandwidthMode(float *spectrum, float rap = sqrt((float)profilesize / (float)ibw); int cfreq = (int) (realfreq / (SAMPLE_RATE * 0.5) * size) - ibw / 2; - for(int i = 0; i < ibw; i++) { + for(int i = 0; i < ibw; ++i) { int src = (int)(i * rap * rap); int spfreq = i + cfreq; if(spfreq < 0) @@ -464,7 +464,7 @@ void PADnoteParameters::generatespectrum_bandwidthMode(float *spectrum, else { //if the bandwidth is smaller than the profilesize float rap = sqrt((float)ibw / (float)profilesize); float ibasefreq = realfreq / (SAMPLE_RATE * 0.5) * size; - for(int i = 0; i < profilesize; i++) { + for(int i = 0; i < profilesize; ++i) { float idfreq = i / (float)profilesize - 0.5; idfreq *= ibw; int spfreq = (int) (idfreq + ibasefreq); @@ -487,26 +487,26 @@ void PADnoteParameters::generatespectrum_otherModes(float *spectrum, int size, float basefreq) { - for(int i = 0; i < size; i++) + for(int i = 0; i < size; ++i) spectrum[i] = 0.0; float harmonics[OSCIL_SIZE / 2]; - for(int i = 0; i < OSCIL_SIZE / 2; i++) + for(int i = 0; i < OSCIL_SIZE / 2; ++i) harmonics[i] = 0.0; //get the harmonic structure from the oscillator (I am using the frequency amplitudes, only) oscilgen->get(harmonics, basefreq, false); //normalize float max = 0.0; - for(int i = 0; i < OSCIL_SIZE / 2; i++) + for(int i = 0; i < OSCIL_SIZE / 2; ++i) if(harmonics[i] > max) max = harmonics[i]; if(max < 0.000001) max = 1; - for(int i = 0; i < OSCIL_SIZE / 2; i++) + for(int i = 0; i < OSCIL_SIZE / 2; ++i) harmonics[i] /= max; - for(int nh = 1; nh < OSCIL_SIZE / 2; nh++) { //for each harmonic + for(int nh = 1; nh < OSCIL_SIZE / 2; ++nh) { //for each harmonic float realfreq = getNhr(nh) * basefreq; ///sa fac aici interpolarea si sa am grija daca frecv descresc @@ -528,13 +528,13 @@ void PADnoteParameters::generatespectrum_otherModes(float *spectrum, if(Pmode != 1) { int old = 0; - for(int k = 1; k < size; k++) { + for(int k = 1; k < size; ++k) { if((spectrum[k] > 1e-10) || (k == (size - 1))) { int delta = k - old; float val1 = spectrum[old]; float val2 = spectrum[k]; float idelta = 1.0 / delta; - for(int i = 0; i < delta; i++) { + for(int i = 0; i < delta; ++i) { float x = idelta * i; spectrum[old + i] = val1 * (1.0 - x) + val2 * x; } @@ -580,9 +580,9 @@ void PADnoteParameters::applyparameters(bool lockmutex) fft_t *fftfreqs = new fft_t[samplesize / 2]; float adj[samplemax]; //this is used to compute frequency relation to the base frequency - for(int nsample = 0; nsample < samplemax; nsample++) + for(int nsample = 0; nsample < samplemax; ++nsample) adj[nsample] = (Pquality.oct + 1.0) * (float)nsample / samplemax; - for(int nsample = 0; nsample < samplemax; nsample++) { + for(int nsample = 0; nsample < samplemax; ++nsample) { float tmp = adj[nsample] - adj[samplemax - 1] * 0.5; float basefreqadjust = pow(2.0, tmp); @@ -601,24 +601,24 @@ void PADnoteParameters::applyparameters(bool lockmutex) newsample.smp = new float[samplesize + extra_samples]; newsample.smp[0] = 0.0; - for(int i = 1; i < spectrumsize; i++) //randomize the phases + for(int i = 1; i < spectrumsize; ++i) //randomize the phases fftfreqs[i] = std::polar(spectrum[i], (float)RND * 6.29f); fft->freqs2smps(fftfreqs, newsample.smp); //that's all; here is the only ifft for the whole sample; no windows are used ;-) //normalize(rms) float rms = 0.0; - for(int i = 0; i < samplesize; i++) + for(int i = 0; i < samplesize; ++i) rms += newsample.smp[i] * newsample.smp[i]; rms = sqrt(rms); if(rms < 0.000001) rms = 1.0; rms *= sqrt(262144.0 / samplesize); - for(int i = 0; i < samplesize; i++) + for(int i = 0; i < samplesize; ++i) newsample.smp[i] *= 1.0 / rms * 50.0; //prepare extra samples used by the linear or cubic interpolation - for(int i = 0; i < extra_samples; i++) + for(int i = 0; i < extra_samples; ++i) newsample.smp[i + samplesize] = newsample.smp[i]; //replace the current sample with the new computed sample @@ -644,12 +644,12 @@ void PADnoteParameters::applyparameters(bool lockmutex) //delete the additional samples that might exists and are not useful if(lockmutex) { pthread_mutex_lock(mutex); - for(int i = samplemax; i < PAD_MAX_SAMPLES; i++) + for(int i = samplemax; i < PAD_MAX_SAMPLES; ++i) deletesample(i); pthread_mutex_unlock(mutex); } else - for(int i = samplemax; i < PAD_MAX_SAMPLES; i++) + for(int i = samplemax; i < PAD_MAX_SAMPLES; ++i) deletesample(i); ; } @@ -658,7 +658,7 @@ void PADnoteParameters::export2wav(std::string basefilename) { applyparameters(true); basefilename += "_PADsynth_"; - for(int k = 0; k < PAD_MAX_SAMPLES; k++) { + for(int k = 0; k < PAD_MAX_SAMPLES; ++k) { if(sample[k].smp == NULL) continue; char tmpstr[20]; @@ -668,7 +668,7 @@ void PADnoteParameters::export2wav(std::string basefilename) if(wav.good()) { int nsmps = sample[k].size; short int *smps = new short int[nsmps]; - for(int i = 0; i < nsmps; i++) + for(int i = 0; i < nsmps; ++i) smps[i] = (short int)(sample[k].smp[i] * 32767.0); wav.writeMonoSamples(nsmps, smps); } diff --git a/src/Params/PresetsStore.cpp b/src/Params/PresetsStore.cpp @@ -96,7 +96,7 @@ void PresetsStore::rescanforpresets(const string &type) clearpresets(); string ftype = "." + type + ".xpz"; - for(int i = 0; i < MAX_BANK_ROOT_DIRS; i++) { + for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) { if(config.cfg.presetsDirList[i].empty()) continue; diff --git a/src/Params/SUBnoteParameters.cpp b/src/Params/SUBnoteParameters.cpp @@ -63,7 +63,7 @@ void SUBnoteParameters::defaults() PFreqEnvelopeEnabled = 0; PBandWidthEnvelopeEnabled = 0; - for(int n = 0; n < MAX_SUB_HARMONICS; n++) { + for(int n = 0; n < MAX_SUB_HARMONICS; ++n) { Phmag[n] = 0; Phrelbw[n] = 64; } @@ -101,7 +101,7 @@ void SUBnoteParameters::add2XML(XMLwrapper *xml) xml->addpar("start", Pstart); xml->beginbranch("HARMONICS"); - for(int i = 0; i < MAX_SUB_HARMONICS; i++) { + for(int i = 0; i < MAX_SUB_HARMONICS; ++i) { if((Phmag[i] == 0) && (xml->minimal)) continue; xml->beginbranch("HARMONIC", i); @@ -174,7 +174,7 @@ void SUBnoteParameters::getfromXML(XMLwrapper *xml) if(xml->enterbranch("HARMONICS")) { Phmag[0] = 0; - for(int i = 0; i < MAX_SUB_HARMONICS; i++) { + for(int i = 0; i < MAX_SUB_HARMONICS; ++i) { if(xml->enterbranch("HARMONIC", i) == 0) continue; Phmag[i] = xml->getpar127("mag", Phmag[i]); diff --git a/src/Synth/ADnote.cpp b/src/Synth/ADnote.cpp @@ -92,7 +92,7 @@ ADnote::ADnote(ADnoteParameters *pars, else NoteGlobalPar.Punch.Enabled = 0; - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) { + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { pars->VoicePar[nvoice].OscilSmp->newrandseed(rand()); NoteVoicePar[nvoice].OscilSmp = NULL; NoteVoicePar[nvoice].FMSmp = NULL; @@ -137,13 +137,13 @@ ADnote::ADnote(ADnoteParameters *pars, default: { //unison for more than 2 subvoices float unison_values[unison]; float min = -1e-6, max = 1e-6; - for(int k = 0; k < unison; k++) { + for(int k = 0; k < unison; ++k) { float step = (k / (float) (unison - 1)) * 2.0 - 1.0; //this makes the unison spread more uniform float val = step + (RND * 2.0 - 1.0) / (unison - 1); unison_values[k] = limit(val, min, max); } float diff = max - min; - for(int k = 0; k < unison; k++) { + for(int k = 0; k < unison; ++k) { unison_values[k] = (unison_values[k] - (max + min) * 0.5) / diff; //the lowest value will be -1 and the highest will be 1 unison_base_freq_rap[nvoice][k] = @@ -154,7 +154,7 @@ ADnote::ADnote(ADnoteParameters *pars, //unison vibrattos if(unison > 1) { - for(int k = 0; k < unison; k++) //reduce the frequency difference for larger vibrattos + for(int k = 0; k < unison; ++k) //reduce the frequency difference for larger vibrattos unison_base_freq_rap[nvoice][k] = 1.0 + (unison_base_freq_rap[nvoice][k] - 1.0) * (1.0 - unison_vibratto_a); @@ -171,7 +171,7 @@ ADnote::ADnote(ADnoteParameters *pars, (1.0 - pars->VoicePar[nvoice]. Unison_vibratto_speed / 127.0) * 4.0); - for(int k = 0; k < unison; k++) { + for(int k = 0; k < unison; ++k) { unison_vibratto[nvoice].position[k] = RND * 1.8 - 0.9; //make period to vary randomly from 50% to 200% vibratto base period float vibratto_period = vibratto_base_period @@ -194,13 +194,13 @@ ADnote::ADnote(ADnoteParameters *pars, if(unison != 1) { int inv = pars->VoicePar[nvoice].Unison_invert_phase; switch(inv) { - case 0: for(int k = 0; k < unison; k++) + case 0: for(int k = 0; k < unison; ++k) unison_invert_phase[nvoice][k] = false; break; - case 1: for(int k = 0; k < unison; k++) + case 1: for(int k = 0; k < unison; ++k) unison_invert_phase[nvoice][k] = (RND > 0.5); break; - default: for(int k = 0; k < unison; k++) + default: for(int k = 0; k < unison; ++k) unison_invert_phase[nvoice][k] = (k % inv == 0) ? true : false; break; @@ -259,7 +259,7 @@ ADnote::ADnote(ADnoteParameters *pars, - for(int k = 0; k < unison; k++) { + for(int k = 0; k < unison; ++k) { oscposhi[nvoice][k] = 0; oscposlo[nvoice][k] = 0.0; oscposhiFM[nvoice][k] = 0; @@ -282,7 +282,7 @@ ADnote::ADnote(ADnoteParameters *pars, pars->VoicePar[nvoice].Presonance); //I store the first elments to the last position for speedups - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; i++) + for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; ++i) NoteVoicePar[nvoice].OscilSmp[OSCIL_SIZE + i] = NoteVoicePar[nvoice].OscilSmp[i]; @@ -292,7 +292,7 @@ ADnote::ADnote(ADnoteParameters *pars, - 64.0) / 128.0 * OSCIL_SIZE + OSCIL_SIZE * 4); oscposhi_start %= OSCIL_SIZE; - for(int k = 0; k < unison; k++) { + for(int k = 0; k < unison; ++k) { oscposhi[nvoice][k] = oscposhi_start; oscposhi_start = (int)(RND * (OSCIL_SIZE - 1)); //put random starting point for other subvoices } @@ -371,7 +371,7 @@ ADnote::ADnote(ADnoteParameters *pars, partparams->VoicePar[nvoice].PFMVelocityScaleFunction); FMoldsmp[nvoice] = new float [unison]; - for(int k = 0; k < unison; k++) + for(int k = 0; k < unison; ++k) FMoldsmp[nvoice][k] = 0.0; //this is for FM (integration) firsttick[nvoice] = 1; @@ -382,13 +382,13 @@ ADnote::ADnote(ADnoteParameters *pars, } max_unison = 1; - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) if(unison_size[nvoice] > max_unison) max_unison = unison_size[nvoice]; tmpwave_unison = new float *[max_unison]; - for(int k = 0; k < max_unison; k++) { + for(int k = 0; k < max_unison; ++k) { tmpwave_unison[k] = new float[SOUND_BUFFER_SIZE]; memset(tmpwave_unison[k], 0, SOUND_BUFFER_SIZE * sizeof(float)); } @@ -433,7 +433,7 @@ void ADnote::legatonote(float freq, float velocity, int portamento_, * (VelF(velocity, pars->GlobalPar.PFilterVelocityScaleFunction) - 1); - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) { + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { if(NoteVoicePar[nvoice].Enabled == OFF) continue; //(gf) Stay the same as first note in legato. @@ -485,7 +485,7 @@ void ADnote::legatonote(float freq, float velocity, int portamento_, pars->VoicePar[nvoice].Presonance);//(gf)Modif of the above line. //I store the first elments to the last position for speedups - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; i++) + for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; ++i) NoteVoicePar[nvoice].OscilSmp[OSCIL_SIZE + i] = NoteVoicePar[nvoice].OscilSmp[i]; @@ -562,12 +562,12 @@ void ADnote::legatonote(float freq, float velocity, int portamento_, partparams->GlobalPar.GlobalFilter->getfreqtracking(basefreq); // Forbids the Modulation Voice to be greater or equal than voice - for(int i = 0; i < NUM_VOICES; i++) + for(int i = 0; i < NUM_VOICES; ++i) if(NoteVoicePar[i].FMVoice >= i) NoteVoicePar[i].FMVoice = -1; // Voice Parameter init - for(unsigned nvoice = 0; nvoice < NUM_VOICES; nvoice++) { + for(unsigned nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { if(NoteVoicePar[nvoice].Enabled == 0) continue; @@ -616,7 +616,7 @@ void ADnote::legatonote(float freq, float velocity, int portamento_, if(!partparams->GlobalPar.Hrandgrouping) partparams->VoicePar[vc].FMSmp->newrandseed(rand()); - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; i++) + for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; ++i) NoteVoicePar[nvoice].FMSmp[OSCIL_SIZE + i] = NoteVoicePar[nvoice].FMSmp[i]; } @@ -631,10 +631,10 @@ void ADnote::legatonote(float freq, float velocity, int portamento_, } - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - for(unsigned i = nvoice + 1; i < NUM_VOICES; i++) + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { + for(unsigned i = nvoice + 1; i < NUM_VOICES; ++i) tmp[i] = 0; - for(unsigned i = nvoice + 1; i < NUM_VOICES; i++) + for(unsigned i = nvoice + 1; i < NUM_VOICES; ++i) if((NoteVoicePar[i].FMVoice == nvoice) && (tmp[i] == 0)) tmp[i] = 1; @@ -671,7 +671,7 @@ void ADnote::KillVoice(int nvoice) */ void ADnote::KillNote() { - for(unsigned nvoice = 0; nvoice < NUM_VOICES; nvoice++) { + for(unsigned nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { if(NoteVoicePar[nvoice].Enabled == ON) KillVoice(nvoice); @@ -693,7 +693,7 @@ ADnote::~ADnote() delete [] tmpwaver; delete [] bypassl; delete [] bypassr; - for(int k = 0; k < max_unison; k++) + for(int k = 0; k < max_unison; ++k) delete[] tmpwave_unison[k]; delete[] tmpwave_unison; } @@ -716,12 +716,12 @@ void ADnote::initparameters() * NoteGlobalPar.AmpLfo->amplfoout(); // Forbids the Modulation Voice to be greater or equal than voice - for(int i = 0; i < NUM_VOICES; i++) + for(int i = 0; i < NUM_VOICES; ++i) if(NoteVoicePar[i].FMVoice >= i) NoteVoicePar[i].FMVoice = -1; // Voice Parameter init - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) { + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { Voice &vce = NoteVoicePar[nvoice]; ADnoteVoiceParam &param = partparams->VoicePar[nvoice]; @@ -795,17 +795,17 @@ void ADnote::initparameters() if(!partparams->GlobalPar.Hrandgrouping) partparams->VoicePar[vc].FMSmp->newrandseed(rand()); - for(int k = 0; k < unison_size[nvoice]; k++) + for(int k = 0; k < unison_size[nvoice]; ++k) oscposhiFM[nvoice][k] = (oscposhi[nvoice][k] + partparams->VoicePar[vc].FMSmp->get(vce.FMSmp, tmp)) % OSCIL_SIZE; - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; i++) + for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; ++i) vce.FMSmp[OSCIL_SIZE + i] = vce.FMSmp[i]; int oscposhiFM_add = (int)((param.PFMoscilphase - 64.0) / 128.0 * OSCIL_SIZE + OSCIL_SIZE * 4); - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { oscposhiFM[nvoice][k] += oscposhiFM_add; oscposhiFM[nvoice][k] %= OSCIL_SIZE; } @@ -822,10 +822,10 @@ void ADnote::initparameters() } } - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) { - for(int i = nvoice + 1; i < NUM_VOICES; i++) + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { + for(int i = nvoice + 1; i < NUM_VOICES; ++i) tmp[i] = 0; - for(int i = nvoice + 1; i < NUM_VOICES; i++) + for(int i = nvoice + 1; i < NUM_VOICES; ++i) if((NoteVoicePar[i].FMVoice == nvoice) && (tmp[i] == 0)) { NoteVoicePar[nvoice].VoiceOut = new float[SOUND_BUFFER_SIZE]; tmp[i] = 1; @@ -847,7 +847,7 @@ void ADnote::compute_unison_freq_rap(int nvoice) { return; } float relbw = ctl->bandwidth.relbw * bandwidthDetuneMultiplier; - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float pos = unison_vibratto[nvoice].position[k]; float step = unison_vibratto[nvoice].step[k]; pos += step; @@ -877,7 +877,7 @@ void ADnote::compute_unison_freq_rap(int nvoice) { */ void ADnote::setfreq(int nvoice, float in_freq) { - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float freq = fabs(in_freq) * unison_freq_rap[nvoice][k]; float speed = freq * float(OSCIL_SIZE) / (float) SAMPLE_RATE; if(speed > OSCIL_SIZE) @@ -893,7 +893,7 @@ void ADnote::setfreq(int nvoice, float in_freq) */ void ADnote::setfreqFM(int nvoice, float in_freq) { - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float freq = fabs(in_freq) * unison_freq_rap[nvoice][k]; float speed = freq * float(OSCIL_SIZE) / (float) SAMPLE_RATE; if(speed > OSCIL_SIZE) @@ -981,7 +981,7 @@ void ADnote::computecurrentparameters() } //compute parameters for all voices - for(nvoice = 0; nvoice < NUM_VOICES; nvoice++) { + for(nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { if(NoteVoicePar[nvoice].Enabled != ON) continue; NoteVoicePar[nvoice].DelayTicks -= 1; @@ -1071,7 +1071,7 @@ void ADnote::computecurrentparameters() inline void ADnote::fadein(float *smps) const { int zerocrossings = 0; - for(int i = 1; i < SOUND_BUFFER_SIZE; i++) + for(int i = 1; i < SOUND_BUFFER_SIZE; ++i) if((smps[i - 1] < 0.0) && (smps[i] > 0.0)) zerocrossings++; //this is only the possitive crossings @@ -1083,7 +1083,7 @@ inline void ADnote::fadein(float *smps) const F2I(tmp, n); //how many samples is the fade-in if(n > SOUND_BUFFER_SIZE) n = SOUND_BUFFER_SIZE; - for(int i = 0; i < n; i++) { //fade-in + for(int i = 0; i < n; ++i) { //fade-in float tmp = 0.5 - cos((float)i / (float) n * PI) * 0.5; smps[i] *= tmp; } @@ -1097,14 +1097,14 @@ inline void ADnote::ComputeVoiceOscillator_LinearInterpolation(int nvoice) int i, poshi; float poslo; - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { poshi = oscposhi[nvoice][k]; poslo = oscposlo[nvoice][k]; int freqhi = oscfreqhi[nvoice][k]; float freqlo = oscfreqlo[nvoice][k]; float *smps = NoteVoicePar[nvoice].OscilSmp; float *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { tw[i] = smps[poshi] * (1.0 - poslo) + smps[poshi + 1] * poslo; poslo += freqlo; if(poslo >= 1.0) { @@ -1172,9 +1172,9 @@ inline void ADnote::ComputeVoiceOscillatorMorph(int nvoice) if(NoteVoicePar[nvoice].FMVoice >= 0) { //if I use VoiceOut[] as modullator int FMVoice = NoteVoicePar[nvoice].FMVoice; - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], FMnewamplitude[nvoice], i, @@ -1185,14 +1185,14 @@ inline void ADnote::ComputeVoiceOscillatorMorph(int nvoice) } } else { - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { int poshiFM = oscposhiFM[nvoice][k]; float posloFM = oscposloFM[nvoice][k]; int freqhiFM = oscfreqhiFM[nvoice][k]; float freqloFM = oscfreqloFM[nvoice][k]; float *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], FMnewamplitude[nvoice], i, @@ -1228,9 +1228,9 @@ inline void ADnote::ComputeVoiceOscillatorRingModulation(int nvoice) FMoldamplitude[nvoice] = 1.0; if(NoteVoicePar[nvoice].FMVoice >= 0) { // if I use VoiceOut[] as modullator - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], FMnewamplitude[nvoice], i, @@ -1241,14 +1241,14 @@ inline void ADnote::ComputeVoiceOscillatorRingModulation(int nvoice) } } else { - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { int poshiFM = oscposhiFM[nvoice][k]; float posloFM = oscposloFM[nvoice][k]; int freqhiFM = oscfreqhiFM[nvoice][k]; float freqloFM = oscfreqloFM[nvoice][k]; float *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], FMnewamplitude[nvoice], i, @@ -1285,7 +1285,7 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, if(NoteVoicePar[nvoice].FMVoice >= 0) { //if I use VoiceOut[] as modulator - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float *tw = tmpwave_unison[k]; memcpy(tw, NoteVoicePar[NoteVoicePar[nvoice].FMVoice].VoiceOut, SOUND_BUFFER_SIZE * sizeof(float)); @@ -1293,14 +1293,14 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, } else { //Compute the modulator and store it in tmpwave_unison[][] - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { int poshiFM = oscposhiFM[nvoice][k]; float posloFM = oscposloFM[nvoice][k]; int freqhiFM = oscfreqhiFM[nvoice][k]; float freqloFM = oscfreqloFM[nvoice][k]; float *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { tw[i] = (NoteVoicePar[nvoice].FMSmp[poshiFM] * (1.0 - posloFM) + NoteVoicePar[nvoice].FMSmp[poshiFM + 1] * posloFM); @@ -1319,9 +1319,9 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, // Amplitude interpolation if(ABOVE_AMPLITUDE_THRESHOLD(FMoldamplitude[nvoice], FMnewamplitude[nvoice])) { - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) tw[i] *= INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], FMnewamplitude[nvoice], i, @@ -1330,9 +1330,9 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, } } else { - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) tw[i] *= FMnewamplitude[nvoice]; } } @@ -1342,10 +1342,10 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, if(FMmode != 0) { //Frequency modulation float normalize = OSCIL_SIZE / 262144.0 * 44100.0 / (float)SAMPLE_RATE; - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float *tw = tmpwave_unison[k]; float fmold = FMoldsmp[nvoice][k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { fmold = fmod(fmold + tw[i] * normalize, OSCIL_SIZE); tw[i] = fmold; } @@ -1354,22 +1354,22 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, } else { //Phase modulation float normalize = OSCIL_SIZE / 262144.0; - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float *tw = tmpwave_unison[k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) tw[i] *= normalize; } } //do the modulation - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float *tw = tmpwave_unison[k]; int poshi = oscposhi[nvoice][k]; float poslo = oscposlo[nvoice][k]; int freqhi = oscfreqhi[nvoice][k]; float freqlo = oscfreqlo[nvoice][k]; - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(i = 0; i < SOUND_BUFFER_SIZE; ++i) { F2I(tw[i], FMmodfreqhi); FMmodfreqlo = fmod(tw[i] + 0.0000000001, 1.0); if(FMmodfreqhi < 0) @@ -1416,9 +1416,9 @@ inline void ADnote::ComputeVoiceOscillatorPitchModulation(int /*nvoice*/) */ inline void ADnote::ComputeVoiceNoise(int nvoice) { - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float *tw = tmpwave_unison[k]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) tw[i] = RND * 2.0 - 1.0; } } @@ -1441,7 +1441,7 @@ int ADnote::noteout(float *outl, float *outr) memset(bypassr, 0, SOUND_BUFFER_SIZE * sizeof(float)); computecurrentparameters(); - for(unsigned nvoice = 0; nvoice < NUM_VOICES; nvoice++) { + for(unsigned nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { if((NoteVoicePar[nvoice].Enabled != ON) || (NoteVoicePar[nvoice].DelayTicks > 0)) continue; @@ -1473,7 +1473,7 @@ int ADnote::noteout(float *outl, float *outr) memset(tmpwavel, 0, SOUND_BUFFER_SIZE * sizeof(float)); if(stereo) memset(tmpwaver, 0, SOUND_BUFFER_SIZE * sizeof(float)); - for(int k = 0; k < unison_size[nvoice]; k++) { + for(int k = 0; k < unison_size[nvoice]; ++k) { float *tw = tmpwave_unison[k]; if(stereo) { float stereo_pos = 0; @@ -1510,13 +1510,13 @@ int ADnote::noteout(float *outl, float *outr) rvol = -rvol; } - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) tmpwavel[i] += tw[i] * lvol; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) tmpwaver[i] += tw[i] * rvol; } else - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) tmpwavel[i] += tw[i]; } @@ -1534,14 +1534,14 @@ int ADnote::noteout(float *outl, float *outr) rest = 10; if(rest > SOUND_BUFFER_SIZE) rest = SOUND_BUFFER_SIZE; - for(int i = 0; i < SOUND_BUFFER_SIZE - rest; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE - rest; ++i) tmpwavel[i] *= oldam; if(stereo) - for(int i = 0; i < SOUND_BUFFER_SIZE - rest; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE - rest; ++i) tmpwaver[i] *= oldam; } // Amplitude interpolation - for(int i = 0; i < rest; i++) { + for(int i = 0; i < rest; ++i) { float amp = INTERPOLATE_AMPLITUDE(oldam, newam, i, rest); tmpwavel[i + (SOUND_BUFFER_SIZE - rest)] *= amp; if(stereo) @@ -1549,10 +1549,10 @@ int ADnote::noteout(float *outl, float *outr) } } else { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) tmpwavel[i] *= newam; if(stereo) - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) tmpwaver[i] *= newam; } @@ -1574,11 +1574,11 @@ int ADnote::noteout(float *outl, float *outr) //check if the amplitude envelope is finished, if yes, the voice will be fadeout if(NoteVoicePar[nvoice].AmpEnvelope != NULL) { if(NoteVoicePar[nvoice].AmpEnvelope->finished() != 0) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) tmpwavel[i] *= 1.0 - (float)i / (float)SOUND_BUFFER_SIZE; if(stereo) - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) tmpwaver[i] *= 1.0 - (float)i / (float)SOUND_BUFFER_SIZE; } @@ -1589,11 +1589,11 @@ int ADnote::noteout(float *outl, float *outr) // Put the ADnote samples in VoiceOut (without appling Global volume, because I wish to use this voice as a modullator) if(NoteVoicePar[nvoice].VoiceOut != NULL) { if(stereo) - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) NoteVoicePar[nvoice].VoiceOut[i] = tmpwavel[i] + tmpwaver[i]; else //mono - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) NoteVoicePar[nvoice].VoiceOut[i] = tmpwavel[i]; } @@ -1602,7 +1602,7 @@ int ADnote::noteout(float *outl, float *outr) // Add the voice that do not bypass the filter to out if(NoteVoicePar[nvoice].filterbypass == 0) { //no bypass if(stereo) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //stereo + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { //stereo outl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume * NoteVoicePar[nvoice].Panning * 2.0; outr[i] += tmpwaver[i] * NoteVoicePar[nvoice].Volume @@ -1610,13 +1610,13 @@ int ADnote::noteout(float *outl, float *outr) } } else - for(int i = 0; i < SOUND_BUFFER_SIZE; i++)//mono + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i)//mono outl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume; } else { //bypass the filter if(stereo) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //stereo + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { //stereo bypassl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume * NoteVoicePar[nvoice].Panning * 2.0; bypassr[i] += tmpwaver[i] * NoteVoicePar[nvoice].Volume @@ -1624,7 +1624,7 @@ int ADnote::noteout(float *outl, float *outr) } } else - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) //mono + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) //mono bypassl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume; } @@ -1646,14 +1646,14 @@ int ADnote::noteout(float *outl, float *outr) else NoteGlobalPar.GlobalFilterR->filterout(&outr[0]); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { outl[i] += bypassl[i]; outr[i] += bypassr[i]; } if(ABOVE_AMPLITUDE_THRESHOLD(globaloldamplitude, globalnewamplitude)) { // Amplitude Interpolation - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float tmpvol = INTERPOLATE_AMPLITUDE(globaloldamplitude, globalnewamplitude, i, @@ -1663,7 +1663,7 @@ int ADnote::noteout(float *outl, float *outr) } } else { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { outl[i] *= globalnewamplitude * NoteGlobalPar.Panning; outr[i] *= globalnewamplitude * (1.0 - NoteGlobalPar.Panning); } @@ -1671,7 +1671,7 @@ int ADnote::noteout(float *outl, float *outr) //Apply the punch if(NoteGlobalPar.Punch.Enabled != 0) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float punchamp = NoteGlobalPar.Punch.initialvalue * NoteGlobalPar.Punch.t + 1.0; outl[i] *= punchamp; @@ -1692,7 +1692,7 @@ int ADnote::noteout(float *outl, float *outr) // Check if the global amplitude is finished. // If it does, disable the note if(NoteGlobalPar.AmpEnvelope->finished()) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //fade-out + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { //fade-out float tmp = 1.0 - (float)i / (float)SOUND_BUFFER_SIZE; outl[i] *= tmp; outr[i] *= tmp; @@ -1708,7 +1708,7 @@ int ADnote::noteout(float *outl, float *outr) */ void ADnote::relasekey() { - for(int nvoice = 0; nvoice < NUM_VOICES; nvoice++) + for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) NoteVoicePar[nvoice].releasekey(); NoteGlobalPar.FreqEnvelope->relasekey(); NoteGlobalPar.FilterEnvelope->relasekey(); diff --git a/src/Synth/Envelope.cpp b/src/Synth/Envelope.cpp @@ -48,7 +48,7 @@ Envelope::Envelope(EnvelopeParams *envpars, float basefreq) if((mode == 2) && (linearenvelope != 0)) mode = 1; //change to linear - for(i = 0; i < MAX_ENVELOPE_POINTS; i++) { + for(i = 0; i < MAX_ENVELOPE_POINTS; ++i) { float tmp = envpars->getdt(i) / 1000.0 * envstretch; if(tmp > bufferdt) envdt[i] = bufferdt / tmp; diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp @@ -93,7 +93,7 @@ void rmsNormalize(fft_t *freqs) const float gain = 1.0 / sqrt(sum); - for(int i = 1; i < OSCIL_SIZE / 2; i++) + for(int i = 1; i < OSCIL_SIZE / 2; ++i) freqs[i] *= gain; } @@ -145,7 +145,7 @@ void OscilGen::defaults() oldmodulationpar2 = 0; oldmodulationpar3 = 0; - for(int i = 0; i < MAX_AD_HARMONICS; i++) { + for(int i = 0; i < MAX_AD_HARMONICS; ++i) { hmag[i] = 0.0; hphase[i] = 0.0; Phmag[i] = 64; @@ -214,14 +214,14 @@ void OscilGen::convert2sine() mag[0] = 0; phase[0] = 0; - for(int i = 0; i < MAX_AD_HARMONICS; i++) { + for(int i = 0; i < MAX_AD_HARMONICS; ++i) { mag[i] = abs(freqs, i + 1); phase[i] = arg(freqs, i + 1); } defaults(); - for(int i = 0; i < MAX_AD_HARMONICS - 1; i++) { + for(int i = 0; i < MAX_AD_HARMONICS - 1; ++i) { float newmag = mag[i]; float newphase = phase[i]; @@ -279,7 +279,7 @@ void OscilGen::getbasefunction(float *smps) base_func func = getBaseFunction(Pcurrentbasefunc); - for(i = 0; i < OSCIL_SIZE; i++) { + for(i = 0; i < OSCIL_SIZE; ++i) { float t = i * 1.0 / OSCIL_SIZE; switch(Pbasefuncmodulation) { @@ -322,7 +322,7 @@ void OscilGen::oscilfilter() const float par2 = Pfilterpar2 / 127.0; filter_func filter = getFilter(Pfiltertype); - for(int i = 1; i < OSCIL_SIZE / 2; i++) + for(int i = 1; i < OSCIL_SIZE / 2; ++i) oscilFFTfreqs[i] *= filter(i,par,par2); normalize(oscilFFTfreqs); @@ -354,14 +354,14 @@ inline void normalize(float *smps, size_t N) { //Find max float max = 0.0; - for(size_t i = 0; i < N; i++) + for(size_t i = 0; i < N; ++i) if(max < fabs(smps[i])) max = fabs(smps[i]); if(max < 0.00001) max = 1.0; //Normalize to +-1 - for(size_t i = 0; i < N; i++) + for(size_t i = 0; i < N; ++i) smps[i] /= max; } @@ -377,7 +377,7 @@ void OscilGen::waveshape() clearDC(oscilFFTfreqs); //reduce the amplitude of the freqs near the nyquist - for(int i = 1; i < OSCIL_SIZE / 8; i++) { + for(int i = 1; i < OSCIL_SIZE / 8; ++i) { float gain = i / (OSCIL_SIZE / 8.0); oscilFFTfreqs[OSCIL_SIZE / 2 - i] *= gain; } @@ -431,7 +431,7 @@ void OscilGen::modulation() clearDC(oscilFFTfreqs); //remove the DC //reduce the amplitude of the freqs near the nyquist - for(i = 1; i < OSCIL_SIZE / 8; i++) { + for(i = 1; i < OSCIL_SIZE / 8; ++i) { float tmp = i / (OSCIL_SIZE / 8.0); oscilFFTfreqs[OSCIL_SIZE / 2 - i] *= tmp; } @@ -442,13 +442,13 @@ void OscilGen::modulation() //Normalize normalize(tmpsmps, OSCIL_SIZE); - for(i = 0; i < OSCIL_SIZE; i++) + for(i = 0; i < OSCIL_SIZE; ++i) in[i] = tmpsmps[i]; - for(i = 0; i < extra_points; i++) + for(i = 0; i < extra_points; ++i) in[i + OSCIL_SIZE] = tmpsmps[i]; //Do the modulation - for(i = 0; i < OSCIL_SIZE; i++) { + for(i = 0; i < OSCIL_SIZE; ++i) { float t = i * 1.0 / OSCIL_SIZE; switch(Pmodulation) { @@ -508,7 +508,7 @@ void OscilGen::spectrumadjust() normalize(oscilFFTfreqs); - for(int i = 0; i < OSCIL_SIZE / 2; i++) { + for(int i = 0; i < OSCIL_SIZE / 2; ++i) { float mag = abs(oscilFFTfreqs, i); float phase = arg(oscilFFTfreqs, i); @@ -549,7 +549,7 @@ void OscilGen::shiftharmonics() } } else { - for(int i = 0; i < OSCIL_SIZE / 2 - 1; i++) { + for(int i = 0; i < OSCIL_SIZE / 2 - 1; ++i) { int oldh = i + abs(harmonicshift); if(oldh >= (OSCIL_SIZE / 2 - 1)) h = 0.0; @@ -576,10 +576,10 @@ void OscilGen::prepare() || DIFF(basefuncmodulationpar2) || DIFF(basefuncmodulationpar3)) changebasefunction(); - for(int i = 0; i < MAX_AD_HARMONICS; i++) + for(int i = 0; i < MAX_AD_HARMONICS; ++i) hphase[i] = (Phphase[i] - 64.0) / 64.0 * PI / (i + 1); - for(int i = 0; i < MAX_AD_HARMONICS; i++) { + for(int i = 0; i < MAX_AD_HARMONICS; ++i) { const float hmagnew = 1.0 - fabs(Phmag[i] / 64.0 - 1.0); switch(Phmagtype) { case 1: @@ -604,23 +604,23 @@ void OscilGen::prepare() } //remove the harmonics where Phmag[i]==64 - for(int i = 0; i < MAX_AD_HARMONICS; i++) + for(int i = 0; i < MAX_AD_HARMONICS; ++i) if(Phmag[i] == 64) hmag[i] = 0.0; clearAll(oscilFFTfreqs); if(Pcurrentbasefunc == 0) { //the sine case - for(int i = 0; i < MAX_AD_HARMONICS; i++) { + for(int i = 0; i < MAX_AD_HARMONICS; ++i) { oscilFFTfreqs[i + 1].real() = -hmag[i] * sin(hphase[i] * (i + 1)) / 2.0; oscilFFTfreqs[i + 1].imag() = hmag[i] * cos(hphase[i] * (i + 1)) / 2.0; } } else { - for(int j = 0; j < MAX_AD_HARMONICS; j++) { + for(int j = 0; j < MAX_AD_HARMONICS; ++j) { if(Phmag[j] == 64) continue; - for(int i = 1; i < OSCIL_SIZE / 2; i++) { + for(int i = 1; i < OSCIL_SIZE / 2; ++i) { int k = i * (j + 1); if(k >= OSCIL_SIZE / 2) break; @@ -662,7 +662,7 @@ void OscilGen::adaptiveharmonic(fft_t *f, float freq) freq = 440.0; fft_t *inf = new fft_t[OSCIL_SIZE / 2]; - for(int i = 0; i < OSCIL_SIZE / 2; i++) + for(int i = 0; i < OSCIL_SIZE / 2; ++i) inf[i] = f[i]; clearAll(f); clearDC(inf); @@ -681,7 +681,7 @@ void OscilGen::adaptiveharmonic(fft_t *f, float freq) down = true; } - for(int i = 0; i < OSCIL_SIZE / 2 - 2; i++) { + for(int i = 0; i < OSCIL_SIZE / 2 - 2; ++i) { float h = i * rap; int high = (int)(i * rap); float low = fmod(h, 1.0); @@ -727,14 +727,14 @@ void OscilGen::adaptiveharmonicpostprocess(fft_t *f, int size) float par = Padaptiveharmonicspar * 0.01; par = 1.0 - pow((1.0 - par), 1.5); - for(int i = 0; i < size; i++) { + for(int i = 0; i < size; ++i) { inf[i] = f[i] * double(par); f[i] *= (1.0 - par); } if(Padaptiveharmonics == 2) { //2n+1 - for(int i = 0; i < size; i++) + for(int i = 0; i < size; ++i) if((i % 2) == 0) f[i] += inf[i]; //i=0 pt prima armonica,etc. } @@ -742,13 +742,13 @@ void OscilGen::adaptiveharmonicpostprocess(fft_t *f, int size) int nh = (Padaptiveharmonics - 3) / 2 + 2; int sub_vs_add = (Padaptiveharmonics - 3) % 2; if(sub_vs_add == 0) { - for(int i = 0; i < size; i++) { + for(int i = 0; i < size; ++i) { if(((i + 1) % nh) == 0) f[i] += inf[i]; } } else { - for(int i = 0; i < size / nh - 1; i++) + for(int i = 0; i < size / nh - 1; ++i) f[(i + 1) * nh - 1] += inf[i]; } } @@ -828,7 +828,7 @@ short int OscilGen::get(float *smps, float freqHz, int resonance) if(Padaptiveharmonics != 0) nyquist = OSCIL_SIZE / 2; - for(int i = 1; i < nyquist - 1; i++) + for(int i = 1; i < nyquist - 1; ++i) outoscilFFTfreqs[i] = oscilFFTfreqs[i]; adaptiveharmonic(outoscilFFTfreqs, freqHz); @@ -838,7 +838,7 @@ short int OscilGen::get(float *smps, float freqHz, int resonance) } if(Padaptiveharmonics) { //do the antialiasing in the case of adaptive harmonics - for(int i = nyquist; i < OSCIL_SIZE / 2; i++) + for(int i = nyquist; i < OSCIL_SIZE / 2; ++i) outoscilFFTfreqs[i] = fft_t(0.0f, 0.0f); } @@ -846,7 +846,7 @@ short int OscilGen::get(float *smps, float freqHz, int resonance) // in ADnote by setting start position according to this setting if((Prand > 64) && (freqHz >= 0.0) && (!ADvsPAD)) { const float rnd = PI * pow((Prand - 64.0) / 64.0, 2.0); - for(int i = 1; i < nyquist - 1; i++) //to Nyquist only for AntiAliasing + for(int i = 1; i < nyquist - 1; ++i) //to Nyquist only for AntiAliasing outoscilFFTfreqs[i] *= std::polar<fftw_real>(1.0f, (float)(rnd * i * RND)); } @@ -860,14 +860,14 @@ short int OscilGen::get(float *smps, float freqHz, int resonance) case 1: power = power * 2.0 - 0.5; power = pow(15.0, power); - for(int i = 1; i < nyquist - 1; i++) + for(int i = 1; i < nyquist - 1; ++i) outoscilFFTfreqs[i] *= pow(RND, power) * normalize; break; case 2: power = power * 2.0 - 0.5; power = pow(15.0, power) * 2.0; float rndfreq = 2 * PI * RND; - for(int i = 1; i < nyquist - 1; i++) + for(int i = 1; i < nyquist - 1; ++i) outoscilFFTfreqs[i] *= pow(fabs(sin(i * rndfreq)), power) * normalize; break; @@ -881,11 +881,11 @@ short int OscilGen::get(float *smps, float freqHz, int resonance) rmsNormalize(outoscilFFTfreqs); if((ADvsPAD) && (freqHz > 0.1)) //in this case the smps will contain the freqs - for(int i = 1; i < OSCIL_SIZE / 2; i++) + for(int i = 1; i < OSCIL_SIZE / 2; ++i) smps[i - 1] = abs(outoscilFFTfreqs, i); else { fft->freqs2smps(outoscilFFTfreqs, smps); - for(int i = 0; i < OSCIL_SIZE; i++) + for(int i = 0; i < OSCIL_SIZE; ++i) smps[i] *= 0.25; //correct the amplitude } @@ -904,7 +904,7 @@ void OscilGen::getspectrum(int n, float *spc, int what) if(n > OSCIL_SIZE / 2) n = OSCIL_SIZE / 2; - for(int i = 1; i < n; i++) { + for(int i = 1; i < n; ++i) { if(what == 0) spc[i - 1] = abs(oscilFFTfreqs, i); else { @@ -916,12 +916,12 @@ void OscilGen::getspectrum(int n, float *spc, int what) } if(what == 0) { - for(int i = 0; i < n; i++) + for(int i = 0; i < n; ++i) outoscilFFTfreqs[i] = fft_t(spc[i], spc[i]); memset(outoscilFFTfreqs+n, 0, (OSCIL_SIZE / 2 - n) * sizeof(fft_t)); adaptiveharmonic(outoscilFFTfreqs, 0.0); adaptiveharmonicpostprocess(outoscilFFTfreqs, n - 1); - for(int i = 0; i < n; i++) + for(int i = 0; i < n; ++i) spc[i] = outoscilFFTfreqs[i].imag(); } } @@ -932,7 +932,7 @@ void OscilGen::getspectrum(int n, float *spc, int what) */ void OscilGen::useasbase() { - for(int i = 0; i < OSCIL_SIZE / 2; i++) + for(int i = 0; i < OSCIL_SIZE / 2; ++i) basefuncFFTfreqs[i] = oscilFFTfreqs[i]; oldbasefunc = Pcurrentbasefunc = 127; @@ -990,7 +990,7 @@ void OscilGen::add2XML(XMLwrapper *xml) xml->addpar("adaptive_harmonics_power", Padaptiveharmonicspower); xml->beginbranch("HARMONICS"); - for(int n = 0; n < MAX_AD_HARMONICS; n++) { + for(int n = 0; n < MAX_AD_HARMONICS; ++n) { if((Phmag[n] == 64) && (Phphase[n] == 64)) continue; xml->beginbranch("HARMONIC", n + 1); @@ -1004,7 +1004,7 @@ void OscilGen::add2XML(XMLwrapper *xml) normalize(basefuncFFTfreqs); xml->beginbranch("BASE_FUNCTION"); - for(int i = 1; i < OSCIL_SIZE / 2; i++) { + for(int i = 1; i < OSCIL_SIZE / 2; ++i) { float xc = basefuncFFTfreqs[i].real(); float xs = basefuncFFTfreqs[i].imag(); if((fabs(xs) > 0.00001) && (fabs(xs) > 0.00001)) { @@ -1084,7 +1084,7 @@ void OscilGen::getfromXML(XMLwrapper *xml) if(xml->enterbranch("HARMONICS")) { Phmag[0] = 64; Phphase[0] = 64; - for(int n = 0; n < MAX_AD_HARMONICS; n++) { + for(int n = 0; n < MAX_AD_HARMONICS; ++n) { if(xml->enterbranch("HARMONIC", n + 1) == 0) continue; Phmag[n] = xml->getpar127("mag", 64); @@ -1099,7 +1099,7 @@ void OscilGen::getfromXML(XMLwrapper *xml) if(xml->enterbranch("BASE_FUNCTION")) { - for(int i = 1; i < OSCIL_SIZE / 2; i++) { + for(int i = 1; i < OSCIL_SIZE / 2; ++i) { if(xml->enterbranch("BF_HARMONIC", i)) { basefuncFFTfreqs[i].real() = xml->getparreal("cos", 0.0); basefuncFFTfreqs[i].imag() = xml->getparreal("sin", 0.0); diff --git a/src/Synth/PADnote.cpp b/src/Synth/PADnote.cpp @@ -75,7 +75,7 @@ void PADnote::setup(float freq, float velocity,int portamento_, int midinote, bo float logfreq = log(basefreq * pow(2.0, NoteGlobalPar.Detune / 1200.0)); float mindist = fabs(logfreq - log(pars->sample[0].basefreq + 0.0001)); nsample = 0; - for(int i = 1; i < PAD_MAX_SAMPLES; i++) { + for(int i = 1; i < PAD_MAX_SAMPLES; ++i) { if(pars->sample[i].smp == NULL) break; float dist = fabs(logfreq - log(pars->sample[i].basefreq + 0.0001)); @@ -192,7 +192,7 @@ PADnote::~PADnote() inline void PADnote::fadein(float *smps) { int zerocrossings = 0; - for(int i = 1; i < SOUND_BUFFER_SIZE; i++) + for(int i = 1; i < SOUND_BUFFER_SIZE; ++i) if((smps[i - 1] < 0.0) && (smps[i] > 0.0)) zerocrossings++; //this is only the possitive crossings @@ -204,7 +204,7 @@ inline void PADnote::fadein(float *smps) F2I(tmp, n); //how many samples is the fade-in if(n > SOUND_BUFFER_SIZE) n = SOUND_BUFFER_SIZE; - for(int i = 0; i < n; i++) { //fade-in + for(int i = 0; i < n; ++i) { //fade-in float tmp = 0.5 - cos((float)i / (float) n * PI) * 0.5; smps[i] *= tmp; } @@ -260,7 +260,7 @@ int PADnote::Compute_Linear(float *outl, return 1; } int size = pars->sample[nsample].size; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { poshi_l += freqhi; poshi_r += freqhi; poslo += freqlo; @@ -291,7 +291,7 @@ int PADnote::Compute_Cubic(float *outl, } int size = pars->sample[nsample].size; float xm1, x0, x1, x2, a, b, c; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { poshi_l += freqhi; poshi_r += freqhi; poslo += freqlo; @@ -334,7 +334,7 @@ int PADnote::noteout(float *outl, float *outr) computecurrentparameters(); float *smps = pars->sample[nsample].smp; if(smps == NULL) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { outl[i] = 0.0; outr[i] = 0.0; } @@ -365,7 +365,7 @@ int PADnote::noteout(float *outl, float *outr) //Apply the punch if(NoteGlobalPar.Punch.Enabled != 0) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float punchamp = NoteGlobalPar.Punch.initialvalue * NoteGlobalPar.Punch.t + 1.0; outl[i] *= punchamp; @@ -380,7 +380,7 @@ int PADnote::noteout(float *outl, float *outr) if(ABOVE_AMPLITUDE_THRESHOLD(globaloldamplitude, globalnewamplitude)) { // Amplitude Interpolation - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float tmpvol = INTERPOLATE_AMPLITUDE(globaloldamplitude, globalnewamplitude, i, @@ -390,7 +390,7 @@ int PADnote::noteout(float *outl, float *outr) } } else { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { outl[i] *= globalnewamplitude * NoteGlobalPar.Panning; outr[i] *= globalnewamplitude * (1.0 - NoteGlobalPar.Panning); } @@ -403,7 +403,7 @@ int PADnote::noteout(float *outl, float *outr) // Check if the global amplitude is finished. // If it does, disable the note if(NoteGlobalPar.AmpEnvelope->finished() != 0) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //fade-out + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { //fade-out float tmp = 1.0 - (float)i / (float)SOUND_BUFFER_SIZE; outl[i] *= tmp; outr[i] *= tmp; diff --git a/src/Synth/Resonance.cpp b/src/Synth/Resonance.cpp @@ -42,7 +42,7 @@ void Resonance::defaults() Pprotectthefundamental = 0; ctlcenter = 1.0; ctlbw = 1.0; - for(int i = 0; i < N_RES_POINTS; i++) + for(int i = 0; i < N_RES_POINTS; ++i) Prespoints[i] = 64; } @@ -67,13 +67,13 @@ void Resonance::applyres(int n, fft_t *fftdata, float freq) l1 = log(getfreqx(0.0) * ctlcenter), l2 = log(2.0) * getoctavesfreq() * ctlbw; - for(int i = 0; i < N_RES_POINTS; i++) + for(int i = 0; i < N_RES_POINTS; ++i) if(sum < Prespoints[i]) sum = Prespoints[i]; if(sum < 1.0) sum = 1.0; - for(int i = 1; i < n; i++) { + for(int i = 1; i < n; ++i) { float x = (log(freq * i) - l1) / l2; //compute where the n-th hamonics fits to the graph if(x < 0.0) x = 0.0; @@ -109,7 +109,7 @@ float Resonance::getfreqresponse(float freq) float l1 = log(getfreqx(0.0) * ctlcenter), l2 = log(2.0) * getoctavesfreq() * ctlbw, sum = 0.0; - for(int i = 0; i < N_RES_POINTS; i++) + for(int i = 0; i < N_RES_POINTS; ++i) if(sum < Prespoints[i]) sum = Prespoints[i]; if(sum < 1.0) @@ -141,7 +141,7 @@ float Resonance::getfreqresponse(float freq) void Resonance::smooth() { float old = Prespoints[0]; - for(int i = 0; i < N_RES_POINTS; i++) { + for(int i = 0; i < N_RES_POINTS; ++i) { old = old * 0.4 + Prespoints[i] * 0.6; Prespoints[i] = (int) old; } @@ -160,7 +160,7 @@ void Resonance::smooth() void Resonance::randomize(int type) { int r = (int)(RND * 127.0); - for(int i = 0; i < N_RES_POINTS; i++) { + for(int i = 0; i < N_RES_POINTS; ++i) { Prespoints[i] = r; if((RND < 0.1) && (type == 0)) r = (int)(RND * 127.0); @@ -178,10 +178,10 @@ void Resonance::randomize(int type) void Resonance::interpolatepeaks(int type) { int x1 = 0, y1 = Prespoints[0]; - for(int i = 1; i < N_RES_POINTS; i++) { + for(int i = 1; i < N_RES_POINTS; ++i) { if((Prespoints[i] != 64) || (i + 1 == N_RES_POINTS)) { int y2 = Prespoints[i]; - for(int k = 0; k < i - x1; k++) { + for(int k = 0; k < i - x1; ++k) { float x = (float) k / (i - x1); if(type == 0) x = (1 - cos(x * PI)) * 0.5; @@ -251,7 +251,7 @@ void Resonance::add2XML(XMLwrapper *xml) xml->addpar("octaves_freq", Poctavesfreq); xml->addparbool("protect_fundamental_frequency", Pprotectthefundamental); xml->addpar("resonance_points", N_RES_POINTS); - for(int i = 0; i < N_RES_POINTS; i++) { + for(int i = 0; i < N_RES_POINTS; ++i) { xml->beginbranch("RESPOINT", i); xml->addpar("val", Prespoints[i]); xml->endbranch(); @@ -268,7 +268,7 @@ void Resonance::getfromXML(XMLwrapper *xml) Poctavesfreq = xml->getpar127("octaves_freq", Poctavesfreq); Pprotectthefundamental = xml->getparbool("protect_fundamental_frequency", Pprotectthefundamental); - for(int i = 0; i < N_RES_POINTS; i++) { + for(int i = 0; i < N_RES_POINTS; ++i) { if(xml->enterbranch("RESPOINT", i) == 0) continue; Prespoints[i] = xml->getpar127("val", Prespoints[i]); diff --git a/src/Synth/SUBnote.cpp b/src/Synth/SUBnote.cpp @@ -97,7 +97,7 @@ void SUBnote::setup(float freq, float velocity, int portamento_, int midinote, b //select only harmonics that desire to compute int harmonics = 0; - for(int n = 0; n < MAX_SUB_HARMONICS; n++) { + for(int n = 0; n < MAX_SUB_HARMONICS; ++n) { if(pars->Phmag[n] == 0) continue; if(n * basefreq > SAMPLE_RATE / 2.0) @@ -129,7 +129,7 @@ void SUBnote::setup(float freq, float velocity, int portamento_, int midinote, b //how much the amplitude is normalised (because the harmonics) float reduceamp = 0.0; - for(int n = 0; n < numharmonics; n++) { + for(int n = 0; n < numharmonics; ++n) { float freq = basefreq * (pos[n] + 1); //the bandwidth is not absolute(Hz); it is relative to frequency @@ -170,7 +170,7 @@ void SUBnote::setup(float freq, float velocity, int portamento_, int midinote, b gain *= hgain; reduceamp += hgain; - for(int nph = 0; nph < numstages; nph++) { + for(int nph = 0; nph < numstages; ++nph) { float amp = 1.0; if(nph == 0) amp = gain; @@ -400,8 +400,8 @@ void SUBnote::computecurrentparameters() float tmpgain = 1.0 / sqrt(envbw * envfreq); - for(int n = 0; n < numharmonics; n++) { - for(int nph = 0; nph < numstages; nph++) { + for(int n = 0; n < numharmonics; ++n) { + for(int nph = 0; nph < numstages; ++nph) { if(nph == 0) gain = tmpgain; else @@ -413,8 +413,8 @@ void SUBnote::computecurrentparameters() } } if(stereo != 0) - for(int n = 0; n < numharmonics; n++) { - for(int nph = 0; nph < numstages; nph++) { + for(int n = 0; n < numharmonics; ++n) { + for(int nph = 0; nph < numstages; ++nph) { if(nph == 0) gain = tmpgain; else @@ -465,13 +465,13 @@ int SUBnote::noteout(float *outl, float *outr) float *tmprnd = getTmpBuffer(); float *tmpsmp = getTmpBuffer(); //left channel - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) tmprnd[i] = RND * 2.0 - 1.0; - for(int n = 0; n < numharmonics; n++) { + for(int n = 0; n < numharmonics; ++n) { memcpy(tmpsmp, tmprnd, SOUND_BUFFER_SIZE * sizeof(float)); - for(int nph = 0; nph < numstages; nph++) + for(int nph = 0; nph < numstages; ++nph) filter(lfilter[nph + n * numstages], tmpsmp); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) outl[i] += tmpsmp[i]; } @@ -480,13 +480,13 @@ int SUBnote::noteout(float *outl, float *outr) //right channel if(stereo != 0) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) tmprnd[i] = RND * 2.0 - 1.0; - for(int n = 0; n < numharmonics; n++) { + for(int n = 0; n < numharmonics; ++n) { memcpy(tmpsmp, tmprnd, SOUND_BUFFER_SIZE * sizeof(float)); - for(int nph = 0; nph < numstages; nph++) + for(int nph = 0; nph < numstages; ++nph) filter(rfilter[nph + n * numstages], tmpsmp); - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) outr[i] += tmpsmp[i]; } if(GlobalFilterR != NULL) @@ -501,7 +501,7 @@ int SUBnote::noteout(float *outl, float *outr) int n = 10; if(n > SOUND_BUFFER_SIZE) n = SOUND_BUFFER_SIZE; - for(int i = 0; i < n; i++) { + for(int i = 0; i < n; ++i) { float ampfadein = 0.5 - 0.5 * cos( (float) i / (float) n * PI); outl[i] *= ampfadein; @@ -512,7 +512,7 @@ int SUBnote::noteout(float *outl, float *outr) if(ABOVE_AMPLITUDE_THRESHOLD(oldamplitude, newamplitude)) { // Amplitude interpolation - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { float tmpvol = INTERPOLATE_AMPLITUDE(oldamplitude, newamplitude, i, @@ -522,7 +522,7 @@ int SUBnote::noteout(float *outl, float *outr) } } else { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { outl[i] *= newamplitude * panning; outr[i] *= newamplitude * (1.0 - panning); } @@ -536,7 +536,7 @@ int SUBnote::noteout(float *outl, float *outr) // Check if the note needs to be computed more if(AmpEnvelope->finished() != 0) { - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { //fade-out + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { //fade-out float tmp = 1.0 - (float)i / (float)SOUND_BUFFER_SIZE; outl[i] *= tmp; outr[i] *= tmp; diff --git a/src/Synth/SynthNote.cpp b/src/Synth/SynthNote.cpp @@ -64,7 +64,7 @@ void SynthNote::Legato::apply(SynthNote &note, float *outl, float *outr) if(decounter == -10) decounter = fade.length; //Yea, could be done without the loop... - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { decounter--; if(decounter < 1) { // Catching-up done, we can finally set @@ -81,7 +81,7 @@ void SynthNote::Legato::apply(SynthNote &note, float *outl, float *outr) if(decounter == -10) decounter = fade.length; silent = false; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { decounter--; if(decounter < 1) { decounter = -10; @@ -96,10 +96,10 @@ void SynthNote::Legato::apply(SynthNote &note, float *outl, float *outr) case LM_FadeOut: // Fade-out, then set the catch-up if(decounter == -10) decounter = fade.length; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) { + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) { decounter--; if(decounter < 1) { - for(int j = i; j < SOUND_BUFFER_SIZE; j++) { + for(int j = i; j < SOUND_BUFFER_SIZE; ++j) { outl[j] = 0.0; outr[j] = 0.0; } diff --git a/src/Tests/AdNoteTest.h b/src/Tests/AdNoteTest.h @@ -38,7 +38,7 @@ class AdNoteTest:public CxxTest::TestSuite //next the bad global variables that for some reason have not been properly placed in some //initialization routine, but rather exist as cryptic oneliners in main.cpp: denormalkillbuf = new float[SOUND_BUFFER_SIZE]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) denormalkillbuf[i] = 0; //phew, glad to get thouse out of my way. took me a lot of sweat and gdb to get this far... diff --git a/src/Tests/MicrotonalTest.h b/src/Tests/MicrotonalTest.h @@ -60,7 +60,7 @@ class MicrotonalTest:public CxxTest::TestSuite (const char *)testMicro->Pcomment), "Equal Temperament 12 notes per octave"); - for(int i = 0; i < 128; i++) + for(int i = 0; i < 128; ++i) TS_ASSERT_EQUALS(testMicro->Pmapping[i], i); TS_ASSERT_DELTA(testMicro->getnotefreq(19, 0), 24.4997, 0.0001); diff --git a/src/Tests/OscilGenTest.h b/src/Tests/OscilGenTest.h @@ -25,7 +25,7 @@ class OscilGenTest:public CxxTest::TestSuite //next the bad global variables that for some reason have not been properly placed in some //initialization routine, but rather exist as cryptic oneliners in main.cpp: denormalkillbuf = new float[SOUND_BUFFER_SIZE]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) denormalkillbuf[i] = 0; //prepare the default settings diff --git a/src/Tests/SubNoteTest.h b/src/Tests/SubNoteTest.h @@ -38,7 +38,7 @@ class SubNoteTest:public CxxTest::TestSuite //next the bad global variables that for some reason have not been properly placed in some //initialization routine, but rather exist as cryptic oneliners in main.cpp: denormalkillbuf = new float[SOUND_BUFFER_SIZE]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) denormalkillbuf[i] = 0; //prepare the default settings diff --git a/src/main.cpp b/src/main.cpp @@ -197,7 +197,7 @@ int main(int argc, char *argv[]) srand(time(NULL)); //produce denormal buf denormalkillbuf = new float [SOUND_BUFFER_SIZE]; - for(int i = 0; i < SOUND_BUFFER_SIZE; i++) + for(int i = 0; i < SOUND_BUFFER_SIZE; ++i) denormalkillbuf[i] = (RND - 0.5) * 1e-16; /* Parse command-line options */