zynaddsubfx

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

commit cce34c19bf2c643ecdc8f05c1d934cd6c0fb5561
parent d328a7df26113ad163f7c81756262087d7fc4226
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Thu, 31 May 2012 22:52:50 -0400

Style: reran style.sh

Uncrustify presented a large diff, but it happens and it appears to be stable
(ie style.sh now yields the same code)
Note that to reduce the size of these commits uncrustify should be run more
frequently.

- extra lines added to style.sh to take care of .C/.H extentions (ie NSM code)
- manually fixed one compile bug generated in JackEngine by uncrustify

Diffstat:
MExternalPrograms/Controller/Controller.C | 7+++----
MExternalPrograms/Controller/main.C | 1-
MExternalPrograms/Spliter/Spliter.C | 15+++++++--------
MExternalPrograms/Spliter/main.C | 1-
Msrc/DSP/AnalogFilter.cpp | 10+++++-----
Msrc/DSP/FormantFilter.cpp | 11++++++-----
Msrc/DSP/FormantFilter.h | 2+-
Msrc/DSP/Unison.cpp | 29+++++++++++++++--------------
Msrc/DSP/Unison.h | 10+++++-----
Msrc/Effects/Alienwah.cpp | 6+++---
Msrc/Effects/Chorus.cpp | 34+++++++++++++++++++---------------
Msrc/Effects/Chorus.h | 4++--
Msrc/Effects/Distorsion.cpp | 22+++++++++++-----------
Msrc/Effects/Distorsion.h | 2+-
Msrc/Effects/DynamicFilter.h | 2+-
Msrc/Effects/EQ.cpp | 2+-
Msrc/Effects/EQ.h | 4++--
Msrc/Effects/Echo.cpp | 6+++---
Msrc/Effects/Effect.cpp | 10+++++-----
Msrc/Effects/Effect.h | 4++--
Msrc/Effects/EffectLFO.cpp | 26+++++++++++++-------------
Msrc/Effects/EffectMgr.cpp | 5++---
Msrc/Effects/EffectMgr.h | 4++--
Msrc/Effects/Reverb.cpp | 9++++-----
Msrc/Effects/Reverb.h | 23+++++++++++------------
Msrc/Misc/Bank.cpp | 6+++---
Msrc/Misc/Bank.h | 4++--
Msrc/Misc/Dump.cpp | 8+++++---
Msrc/Misc/Master.cpp | 10+++++-----
Msrc/Misc/Master.h | 8++++----
Msrc/Misc/Microtonal.cpp | 8++++----
Msrc/Misc/NSM.C | 88++++++++++++++++++++++++++++++++++++++++++-------------------------------------
Msrc/Misc/NSM.H | 25++++++++++++++-----------
Msrc/Misc/NSM/Client.C | 362+++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
Msrc/Misc/NSM/Client.H | 194++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
Msrc/Misc/Part.cpp | 8++++----
Msrc/Misc/Part.h | 4++--
Msrc/Misc/Recorder.cpp | 3++-
Msrc/Misc/Util.cpp | 10+++++-----
Msrc/Misc/Util.h | 4++--
Msrc/Misc/XMLwrapper.cpp | 6+++---
Msrc/Nio/EngineMgr.cpp | 3++-
Msrc/Nio/InMgr.cpp | 52++++++++++++++++++++++++++--------------------------
Msrc/Nio/InMgr.h | 2+-
Msrc/Nio/JackEngine.cpp | 22+++++++++++-----------
Msrc/Nio/Nio.cpp | 8++++----
Msrc/Nio/NulEngine.cpp | 3++-
Msrc/Nio/NulEngine.h | 2+-
Msrc/Nio/OssEngine.cpp | 6+++---
Msrc/Nio/OutMgr.cpp | 22+++++++++++++++-------
Msrc/Nio/OutMgr.h | 2+-
Msrc/Nio/WavEngine.h | 2+-
Msrc/Output/DSSIaudiooutput.cpp | 6+++---
Msrc/Params/LFOParams.cpp | 2+-
Msrc/Params/PADnoteParameters.cpp | 3++-
Msrc/Synth/ADnote.cpp | 27++++++++++++++-------------
Msrc/Synth/ADnote.h | 6+++---
Msrc/Synth/Envelope.cpp | 2+-
Msrc/Synth/OscilGen.cpp | 44++++++++++++++++++++++++++------------------
Msrc/Synth/PADnote.cpp | 5+++--
Msrc/Synth/PADnote.h | 2+-
Msrc/Synth/SUBnote.cpp | 2+-
Msrc/Tests/ControllerTest.h | 2+-
Msrc/Tests/EchoTest.h | 2+-
Msrc/Tests/MicrotonalTest.h | 2+-
Msrc/Tests/OscilGenTest.h | 2+-
Msrc/UI/NioUI.cpp | 4++--
Msrc/UI/WidgetPDial.cpp | 2+-
Msrc/globals.h | 21++++++++++-----------
Msrc/main.cpp | 79+++++++++++++++++++++++++++++++++++++------------------------------------------
Mstyle.sh | 3+++
71 files changed, 753 insertions(+), 584 deletions(-)

diff --git a/ExternalPrograms/Controller/Controller.C b/ExternalPrograms/Controller/Controller.C @@ -77,9 +77,8 @@ void Controller::send(int npar, float xval) { * (pars[npar].val2 - pars[npar].val1 - 1.0) * 0.9999 + pars[npar].val1 + 1.0); switch(pars[npar].mode) { - case 1: sendcontroller(pars[npar].ctl.par, val); break; - //case 2:break; - case 3: sendnrpn(npar, val); break; + case 1: sendcontroller(pars[npar].ctl.par, val); break; + //case 2:break; + case 3: sendnrpn(npar, val); break; } } - diff --git a/ExternalPrograms/Controller/main.C b/ExternalPrograms/Controller/main.C @@ -14,4 +14,3 @@ main() delete controllerUI; }; - diff --git a/ExternalPrograms/Spliter/Spliter.C b/ExternalPrograms/Spliter/Spliter.C @@ -10,11 +10,11 @@ int Pexitprogram; Spliter::Spliter() { //init Psplitpoint = 60; - Pchin = 0; - Pchout1 = 0; - Pchout2 = 1; - Poct1 = 0; - Poct2 = 0; + Pchin = 0; + Pchout1 = 0; + Pchout2 = 1; + Poct1 = 0; + Poct2 = 0; //ALSA init snd_seq_open(&midi_in, "default", SND_SEQ_OPEN_INPUT, 0); snd_seq_open(&midi_out, "default", SND_SEQ_OPEN_OUTPUT, 0); @@ -58,7 +58,7 @@ void Spliter::midievents() { midievent->data.note.channel = Pchout1; int tmp = midievent->data.note.note; tmp += Poct1 * 12; if(tmp > 127) - tmp = 127;if(tmp < 0) + tmp = 127; if(tmp < 0) tmp = 0; midievent->data.note.note = tmp; } @@ -66,7 +66,7 @@ void Spliter::midievents() { midievent->data.note.channel = Pchout2; int tmp = midievent->data.note.note; tmp += Poct2 * 12; if(tmp > 127) - tmp = 127;if(tmp < 0) + tmp = 127; if(tmp < 0) tmp = 0; midievent->data.note.note = tmp; } @@ -80,4 +80,3 @@ void Spliter::midievents() { } snd_seq_free_event(midievent); } - diff --git a/ExternalPrograms/Spliter/main.C b/ExternalPrograms/Spliter/main.C @@ -35,4 +35,3 @@ main() pthread_mutex_destroy(&mutex); delete spliterUI; }; - diff --git a/src/DSP/AnalogFilter.cpp b/src/DSP/AnalogFilter.cpp @@ -45,7 +45,7 @@ AnalogFilter::AnalogFilter(unsigned char Ftype, if(stages >= MAX_FILTER_STAGES) stages = MAX_FILTER_STAGES; cleanup(); - firsttime = false; + firsttime = false; setfreq_and_q(Ffreq, Fq); firsttime = true; coeff.d[0] = 0; //this is not used @@ -223,9 +223,9 @@ void AnalogFilter::computefiltercoefs(void) * ((tmpgain + 1.0f) - (tmpgain - 1.0f) * cs - beta * sn) / tmp; d[1] = -2.0f * ((tmpgain - 1.0f) + (tmpgain + 1.0f) * cs) - / tmp * -1.0f; + / tmp * -1.0f; d[2] = ((tmpgain + 1.0f) + (tmpgain - 1.0f) * cs - beta * sn) - / tmp * -1.0f; + / tmp * -1.0f; } else { c[0] = tmpgain; @@ -249,9 +249,9 @@ void AnalogFilter::computefiltercoefs(void) * ((tmpgain + 1.0f) + (tmpgain - 1.0f) * cs - beta * sn) / tmp; d[1] = 2.0f * ((tmpgain - 1.0f) - (tmpgain + 1.0f) * cs) - / tmp * -1.0f; + / tmp * -1.0f; d[2] = ((tmpgain + 1.0f) - (tmpgain - 1.0f) * cs - beta * sn) - / tmp * -1.0f; + / tmp * -1.0f; } else { c[0] = 1.0f; diff --git a/src/DSP/FormantFilter.cpp b/src/DSP/FormantFilter.cpp @@ -149,18 +149,19 @@ void FormantFilter::setpos(float input) currentformants[i].freq = currentformants[i].freq * (1.0f - formantslowness) + (formantpar[p1][i].freq - * (1.0f - pos) + formantpar[p2][i].freq * pos) + * (1.0f - pos) + formantpar[p2][i].freq * pos) * formantslowness; currentformants[i].amp = currentformants[i].amp * (1.0f - formantslowness) + (formantpar[p1][i].amp * (1.0f - pos) - + formantpar[p2][i].amp * pos) * formantslowness; + + formantpar[p2][i].amp * pos) * formantslowness; currentformants[i].q = currentformants[i].q - * (1.0f - formantslowness) - + (formantpar[p1][i].q * (1.0f - pos) - + formantpar[p2][i].q * pos) * formantslowness; + * (1.0f - formantslowness) + + (formantpar[p1][i].q * (1.0f - pos) + + formantpar[p2][i].q + * pos) * formantslowness; formant[i]->setfreq_and_q(currentformants[i].freq, diff --git a/src/DSP/FormantFilter.h b/src/DSP/FormantFilter.h @@ -44,7 +44,7 @@ class FormantFilter:public Filter void setpos(float input); - class AnalogFilter *formant[FF_MAX_FORMANTS]; + class AnalogFilter * formant[FF_MAX_FORMANTS]; struct { float freq, amp, q; //frequency,amplitude,Q diff --git a/src/DSP/Unison.cpp b/src/DSP/Unison.cpp @@ -26,16 +26,16 @@ Unison::Unison(int update_period_samples_, float max_delay_sec_) :unison_size(0), - base_freq(1.0f), - uv(NULL), - update_period_samples(update_period_samples_), - update_period_sample_k(0), - max_delay((int)(synth->samplerate_f * max_delay_sec_) + 1), - delay_k(0), - first_time(false), - delay_buffer(NULL), - unison_amplitude_samples(0.0f), - unison_bandwidth_cents(10.0f) + base_freq(1.0f), + uv(NULL), + update_period_samples(update_period_samples_), + update_period_sample_k(0), + max_delay((int)(synth->samplerate_f * max_delay_sec_) + 1), + delay_k(0), + first_time(false), + delay_buffer(NULL), + unison_amplitude_samples(0.0f), + unison_bandwidth_cents(10.0f) { if(max_delay < 10) max_delay = 10; @@ -100,7 +100,7 @@ void Unison::updateParameters(void) float max_speed = powf(2.0f, unison_bandwidth_cents / 1200.0f); unison_amplitude_samples = 0.125f * (max_speed - 1.0f) - * synth->samplerate_f / base_freq; + * synth->samplerate_f / base_freq; #warning \ todo: test if unison_amplitude_samples is to big and reallocate bigger memory @@ -163,7 +163,8 @@ void Unison::updateUnisonData() pos = -1.0f; step = -step; } - else if(pos >= 1.0f) { + else + if(pos >= 1.0f) { pos = 1.0f; step = -step; } @@ -173,8 +174,8 @@ void Unison::updateUnisonData() #warning \ I have to enlarge (reallocate) the buffer to make place for the whole delay float newval = 1.0f + 0.5f - * (vibratto_val + 1.0f) * unison_amplitude_samples - * uv[k].relative_amplitude; + * (vibratto_val + 1.0f) * unison_amplitude_samples + * uv[k].relative_amplitude; if(first_time) uv[k].realpos1 = uv[k].realpos2 = newval; diff --git a/src/DSP/Unison.h b/src/DSP/Unison.h @@ -54,11 +54,11 @@ class Unison float lin_fpos; float lin_ffreq; UnisonVoice() { - position = RND * 1.8f - 0.9f; - realpos1 = 0.0f; - realpos2 = 0.0f; - step = 0.0f; - relative_amplitude = 1.0f; + position = RND * 1.8f - 0.9f; + realpos1 = 0.0f; + realpos2 = 0.0f; + step = 0.0f; + relative_amplitude = 1.0f; } } *uv; diff --git a/src/Effects/Alienwah.cpp b/src/Effects/Alienwah.cpp @@ -25,8 +25,8 @@ Alienwah::Alienwah(bool insertion_, float *efxoutl_, float *efxoutr_) :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0), - oldl(NULL), - oldr(NULL) + oldl(NULL), + oldr(NULL) { setpreset(Ppreset); cleanup(); @@ -168,7 +168,7 @@ void Alienwah::setpreset(unsigned char npreset) 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 + changepar(0, presets[npreset][0] / 2); //lower the volume if this is system effect Ppreset = npreset; } diff --git a/src/Effects/Chorus.cpp b/src/Effects/Chorus.cpp @@ -28,8 +28,8 @@ using namespace std; Chorus::Chorus(bool insertion_, float *const efxoutl_, float *efxoutr_) :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0), - maxdelay((int)(MAX_CHORUS_DELAY / 1000.0f * synth->samplerate_f)), - delaySample(new float[maxdelay], new float[maxdelay]) + maxdelay((int)(MAX_CHORUS_DELAY / 1000.0f * synth->samplerate_f)), + delaySample(new float[maxdelay], new float[maxdelay]) { dlk = 0; drk = 0; @@ -55,8 +55,9 @@ float Chorus::getdelay(float xlfo) //check if delay is too big (caused by bad setdelay() and setdepth() if((result + 0.5f) >= maxdelay) { - cerr << - "WARNING: Chorus.cpp::getdelay(..) too big delay (see setdelay and setdepth funcs.)" + cerr + << + "WARNING: Chorus.cpp::getdelay(..) too big delay (see setdelay and setdepth funcs.)" << endl; result = maxdelay - 1.0f; } @@ -85,18 +86,20 @@ void Chorus::out(const Stereo<float *> &input) //Left channel //compute the delay in samples using linear interpolation between the lfo delays - float mdel = (dl1 * (synth->buffersize - i) + dl2 * i) / synth->buffersize_f; + float mdel = + (dl1 * (synth->buffersize - i) + dl2 * i) / synth->buffersize_f; if(++dlk >= maxdelay) dlk = 0; float tmp = dlk - mdel + maxdelay * 2.0f; //where should I get the sample from - dlhi = (int) tmp; + dlhi = (int) tmp; dlhi %= maxdelay; - float dlhi2 = (dlhi - 1 + maxdelay) % maxdelay; - float dllo = 1.0f - fmod(tmp, one); - efxoutl[i] = cinterpolate(delaySample.l, maxdelay, dlhi2) * dllo + - cinterpolate(delaySample.l, maxdelay, dlhi) * (1.0f - dllo); + float dlhi2 = (dlhi - 1 + maxdelay) % maxdelay; + float dllo = 1.0f - fmod(tmp, one); + efxoutl[i] = cinterpolate(delaySample.l, maxdelay, dlhi2) * dllo + + cinterpolate(delaySample.l, maxdelay, + dlhi) * (1.0f - dllo); delaySample.l[dlk] = inL + efxoutl[i] * fb; //Right channel @@ -107,13 +110,14 @@ void Chorus::out(const Stereo<float *> &input) drk = 0; tmp = drk * 1.0f - mdel + maxdelay * 2.0f; //where should I get the sample from - dlhi = (int) tmp; + dlhi = (int) tmp; dlhi %= maxdelay; - dlhi2 = (dlhi - 1 + maxdelay) % maxdelay; - dllo = 1.0f - fmodf(tmp, one); - efxoutr[i] = cinterpolate(delaySample.r, maxdelay, dlhi2) * dllo + - cinterpolate(delaySample.r, maxdelay, dlhi) * (1.0f - dllo); + dlhi2 = (dlhi - 1 + maxdelay) % maxdelay; + dllo = 1.0f - fmodf(tmp, one); + efxoutr[i] = cinterpolate(delaySample.r, maxdelay, dlhi2) * dllo + + cinterpolate(delaySample.r, maxdelay, + dlhi) * (1.0f - dllo); delaySample.r[dlk] = inR + efxoutr[i] * fb; } diff --git a/src/Effects/Chorus.h b/src/Effects/Chorus.h @@ -98,8 +98,8 @@ class Chorus:public Effect float depth, delay, fb; float dl1, dl2, dr1, dr2, lfol, lfor; int maxdelay; - Stereo<float*> delaySample; - int dlk, drk, dlhi; + Stereo<float *> delaySample; + int dlk, drk, dlhi; float getdelay(float xlfo); }; diff --git a/src/Effects/Distorsion.cpp b/src/Effects/Distorsion.cpp @@ -27,15 +27,15 @@ Distorsion::Distorsion(bool insertion_, float *efxoutl_, float *efxoutr_) :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0), - Pvolume(50), - Pdrive(90), - Plevel(64), - Ptype(0), - Pnegate(0), - Plpf(127), - Phpf(0), - Pstereo(0), - Pprefiltering(0) + Pvolume(50), + Pdrive(90), + Plevel(64), + Ptype(0), + Pnegate(0), + Plpf(127), + Phpf(0), + Pstereo(0), + Pprefiltering(0) { lpfl = new AnalogFilter(2, 22000, 1, 0); lpfr = new AnalogFilter(2, 22000, 1, 0); @@ -175,7 +175,7 @@ void Distorsion::setpreset(unsigned char npreset) for(int n = 0; n < PRESET_SIZE; ++n) changepar(n, presets[npreset][n]); if(!insertion) //lower the volume if this is system effect - changepar(0, (int) (presets[npreset][0] / 1.5f)); + changepar(0, (int) (presets[npreset][0] / 1.5f)); Ppreset = npreset; cleanup(); } @@ -201,7 +201,7 @@ void Distorsion::changepar(int npar, unsigned char value) break; case 5: if(value > 13) - Ptype = 13; //this must be increased if more distorsion types are added + Ptype = 13; //this must be increased if more distorsion types are added else Ptype = value; break; diff --git a/src/Effects/Distorsion.h b/src/Effects/Distorsion.h @@ -55,7 +55,7 @@ class Distorsion:public Effect void sethpf(unsigned char _Phpf); //Real Parameters - class AnalogFilter *lpfl, *lpfr, *hpfl, *hpfr; + class AnalogFilter * lpfl, *lpfr, *hpfl, *hpfr; }; #endif diff --git a/src/Effects/DynamicFilter.h b/src/Effects/DynamicFilter.h @@ -58,7 +58,7 @@ class DynamicFilter:public Effect //Internal Values float depth, ampsns, ampsmooth; - class Filter *filterl, *filterr; + class Filter * filterl, *filterr; float ms1, ms2, ms3, ms4; //mean squares }; diff --git a/src/Effects/EQ.cpp b/src/Effects/EQ.cpp @@ -116,7 +116,7 @@ void EQ::changepar(int npar, unsigned char value) case 0: filter[nb].Ptype = value; if(value > 9) - filter[nb].Ptype = 0; //has to be changed if more filters will be added + filter[nb].Ptype = 0; //has to be changed if more filters will be added if(filter[nb].Ptype != 0) { filter[nb].l->settype(value - 1); filter[nb].r->settype(value - 1); diff --git a/src/Effects/EQ.h b/src/Effects/EQ.h @@ -30,7 +30,7 @@ class EQ:public Effect { public: EQ(bool insertion_, float *efxoutl_, float *efxoutr_); - ~EQ() {}; + ~EQ() {} void out(const Stereo<float *> &smp); void setpreset(unsigned char npreset); void changepar(int npar, unsigned char value); @@ -48,7 +48,7 @@ class EQ:public Effect //parameters unsigned char Ptype, Pfreq, Pgain, Pq, Pstages; //internal values - class AnalogFilter *l, *r; + class AnalogFilter * l, *r; } filter[MAX_EQ_BANDS]; }; diff --git a/src/Effects/Echo.cpp b/src/Effects/Echo.cpp @@ -98,9 +98,9 @@ void Echo::out(const Stereo<float *> &input) //LowPass Filter old.l = delay.l[(pos.l + delta.l) % (MAX_DELAY * synth->samplerate)] = - ldl * hidamp + old.l * (1.0f - hidamp); + ldl * hidamp + old.l * (1.0f - hidamp); old.r = delay.r[(pos.r + delta.r) % (MAX_DELAY * synth->samplerate)] = - rdl * hidamp + old.r * (1.0f - hidamp); + rdl * hidamp + old.r * (1.0f - hidamp); //increment ++pos.l; // += delta.l; @@ -184,7 +184,7 @@ void Echo::setpreset(unsigned char npreset) 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 + setvolume(presets[npreset][0] / 2); //lower the volume if this is insertion effect Ppreset = npreset; } diff --git a/src/Effects/Effect.cpp b/src/Effects/Effect.cpp @@ -26,12 +26,12 @@ #include <cmath> Effect::Effect(bool insertion_, float *efxoutl_, float *efxoutr_, - FilterParams *filterpars_, unsigned char Ppreset_) + FilterParams *filterpars_, unsigned char Ppreset_) :Ppreset(Ppreset_), - efxoutl(efxoutl_), - efxoutr(efxoutr_), - filterpars(filterpars_), - insertion(insertion_) + efxoutl(efxoutl_), + efxoutr(efxoutr_), + filterpars(filterpars_), + insertion(insertion_) {} void Effect::out(float *const smpsl, float *const smpsr) diff --git a/src/Effects/Effect.h b/src/Effects/Effect.h @@ -43,7 +43,7 @@ class Effect * @param Ppreset_ chosen preset * @return Initialized Effect object*/ Effect(bool insertion_, float *efxoutl_, float *efxoutr_, - FilterParams *filterpars_, unsigned char Ppreset_); + FilterParams *filterpars_, unsigned char Ppreset_); virtual ~Effect() {} /** * Choose a preset @@ -76,7 +76,7 @@ class Effect unsigned char Ppreset; /**<Currently used preset*/ float *const efxoutl; /**<Effect out Left Channel*/ float *const efxoutr; /**<Effect out Right Channel*/ - float outvolume;/**<This is the volume of effect and is public because + float outvolume; /**<This is the volume of effect and is public because * it is needed in system effects. * The out volume of such effects are always 1.0f, so * this setting tells me how is the volume to the diff --git a/src/Effects/EffectLFO.cpp b/src/Effects/EffectLFO.cpp @@ -27,16 +27,16 @@ EffectLFO::EffectLFO(void) :Pfreq(40), - Prandomness(0), - PLFOtype(0), - Pstereo(64), - xl(0.0f), - xr(0.0f), - ampl1(RND), - ampl2(RND), - ampr1(RND), - ampr2(RND), - lfornd(0.0f) + Prandomness(0), + PLFOtype(0), + Pstereo(64), + xl(0.0f), + xr(0.0f), + ampl1(RND), + ampl2(RND), + ampr1(RND), + ampr2(RND), + lfornd(0.0f) { updateparams(); } @@ -49,13 +49,13 @@ void EffectLFO::updateparams(void) float lfofreq = (powf(2.0f, Pfreq / 127.0f * 10.0f) - 1.0f) * 0.03f; incx = fabsf(lfofreq) * synth->buffersize_f / synth->samplerate_f; if(incx > 0.49999999f) - incx = 0.499999999f; //Limit the Frequency + incx = 0.499999999f; //Limit the Frequency lfornd = Prandomness / 127.0f; lfornd = (lfornd > 1.0f) ? 1.0f : lfornd; if(PLFOtype > 1) - PLFOtype = 1; //this has to be updated if more lfo's are added + PLFOtype = 1; //this has to be updated if more lfo's are added lfotype = PLFOtype; xr = fmodf(xl + (Pstereo - 64.0f) / 127.0f + 1.0f, 1.0f); } @@ -75,7 +75,7 @@ float EffectLFO::getlfoshape(float x) else out = 4.0f * x - 4.0f; break; - //when adding more, ensure ::updateparams() gets updated + //when adding more, ensure ::updateparams() gets updated default: out = cosf(x * 2.0f * PI); //EffectLFO_SINE } diff --git a/src/Effects/EffectMgr.cpp b/src/Effects/EffectMgr.cpp @@ -176,14 +176,13 @@ unsigned char EffectMgr::geteffectpar(int npar) void EffectMgr::out(float *smpsl, float *smpsr) { if(!efx) { - if(!insertion) { + if(!insertion) for(int i = 0; i < synth->buffersize; ++i) { smpsl[i] = 0.0f; smpsr[i] = 0.0f; efxoutl[i] = 0.0f; efxoutr[i] = 0.0f; } - } return; } for(int i = 0; i < synth->buffersize; ++i) { @@ -214,7 +213,7 @@ void EffectMgr::out(float *smpsl, float *smpsr) v2 = 1.0f; } if((nefx == 1) || (nefx == 2)) - v2 *= v2; //for Reverb and Echo, the wet function is not liniar + v2 *= v2; //for Reverb and Echo, the wet function is not liniar if(dryonly) //this is used for instrument effect only for(int i = 0; i < synth->buffersize; ++i) { diff --git a/src/Effects/EffectMgr.h b/src/Effects/EffectMgr.h @@ -69,7 +69,7 @@ class EffectMgr:public Presets unsigned char geteffectpar(int npar); const bool insertion; - float *efxoutl, *efxoutr; + float *efxoutl, *efxoutr; // used by UI float getEQfreqresponse(float freq); @@ -80,7 +80,7 @@ class EffectMgr:public Presets int nefx; Effect *efx; pthread_mutex_t *mutex; - bool dryonly; + bool dryonly; }; #endif diff --git a/src/Effects/Reverb.cpp b/src/Effects/Reverb.cpp @@ -29,7 +29,7 @@ //todo: EarlyReflections, Prdelay, Perbalance Reverb::Reverb(bool insertion_, float *efxoutl_, float *efxoutr_) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0), + :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0), // defaults Pvolume(48), Ptime(64), @@ -152,7 +152,7 @@ void Reverb::out(const Stereo<float *> &smp) for(int i = 0; i < synth->buffersize; ++i) inputbuf[i] = (smp.l[i] + smp.r[i]) / 2.0f; - if(idelay) { + if(idelay) for(int i = 0; i < synth->buffersize; ++i) { //Initial delay r float tmp = inputbuf[i] + idelay[idelayk] * idelayfb; @@ -162,7 +162,6 @@ void Reverb::out(const Stereo<float *> &smp) if(idelayk >= idelaylen) idelayk = 0; } - } if(bandwidth) bandwidth->process(synth->buffersize, inputbuf); @@ -370,7 +369,7 @@ void Reverb::setroomsize(unsigned char _Proomsize) { Proomsize = _Proomsize; if(!Proomsize) - this->Proomsize = 64; //this is because the older versions consider roomsize=0 + this->Proomsize = 64; //this is because the older versions consider roomsize=0 roomsize = (this->Proomsize - 64.0f) / 64.0f; if(roomsize > 0.0f) roomsize *= 2.0f; @@ -425,7 +424,7 @@ void Reverb::setpreset(unsigned char npreset) for(int n = 0; n < PRESET_SIZE; ++n) changepar(n, presets[npreset][n]); if(insertion) - changepar(0, presets[npreset][0] / 2); //lower the volume if reverb is insertion effect + changepar(0, presets[npreset][0] / 2); //lower the volume if reverb is insertion effect Ppreset = npreset; } diff --git a/src/Effects/Reverb.h b/src/Effects/Reverb.h @@ -72,16 +72,16 @@ class Reverb:public Effect float erbalance; //Parameters - int lohidamptype; //0=disable, 1=highdamp (lowpass), 2=lowdamp (highpass) - int idelaylen, rdelaylen; - int idelayk; - float lohifb; - float idelayfb; - float roomsize; - float rs; //rs is used to "normalise" the volume according to the roomsize - int comblen[REV_COMBS * 2]; - int aplen[REV_APS * 2]; - class Unison *bandwidth; + int lohidamptype; //0=disable, 1=highdamp (lowpass), 2=lowdamp (highpass) + int idelaylen, rdelaylen; + int idelayk; + float lohifb; + float idelayfb; + float roomsize; + float rs; //rs is used to "normalise" the volume according to the roomsize + int comblen[REV_COMBS * 2]; + int aplen[REV_APS * 2]; + class Unison * bandwidth; //Internal Variables float *comb[REV_COMBS * 2]; @@ -91,8 +91,7 @@ class Reverb:public Effect float *ap[REV_APS * 2]; int apk[REV_APS * 2]; float *idelay; - class AnalogFilter *lpf, *hpf; //filters - + class AnalogFilter * lpf, *hpf; //filters }; #endif diff --git a/src/Misc/Bank.cpp b/src/Misc/Bank.cpp @@ -219,7 +219,7 @@ int Bank::loadbank(string bankdirname) } if((startname + 1) < strlen(filename)) - startname++; //to take out the "-" + startname++; //to take out the "-" string name = filename; @@ -408,7 +408,7 @@ int Bank::addtobank(int pos, string filename, string name) { if((pos >= 0) && (pos < BANK_SIZE)) { if(ins[pos].used) - pos = -1; //force it to find a new free position + pos = -1; //force it to find a new free position } else if(pos >= BANK_SIZE) @@ -423,7 +423,7 @@ int Bank::addtobank(int pos, string filename, string name) } if(pos < 0) - return -1; //the bank is full + return -1; //the bank is full deletefrombank(pos); diff --git a/src/Misc/Bank.h b/src/Misc/Bank.h @@ -49,9 +49,9 @@ class Bank /**Empties out the selected slot*/ void clearslot(unsigned int ninstrument); /**Saves the given Part to slot*/ - void savetoslot(unsigned int ninstrument, class Part *part); + void savetoslot(unsigned int ninstrument, class Part * part); /**Loads the given slot into a Part*/ - void loadfromslot(unsigned int ninstrument, class Part *part); + void loadfromslot(unsigned int ninstrument, class Part * part); /**Swaps Slots*/ void swapslot(unsigned int n1, unsigned int n2); diff --git a/src/Misc/Dump.cpp b/src/Misc/Dump.cpp @@ -38,9 +38,11 @@ Dump::~Dump() { if(file != NULL) { int duration = tick * synth->buffersize_f / synth->samplerate_f; - fprintf(file, + fprintf( + file, "\n# statistics: duration = %d seconds; keyspressed = %d\n\n\n\n", - duration, keyspressed); + duration, + keyspressed); fclose(file); } } @@ -86,7 +88,7 @@ void Dump::dumpnote(char chan, char note, char vel) if(vel == 0) fprintf(file, "n %d -> %d %d \n", tick, chan, note); //note off else - fprintf(file, "N %d -> %d %d %d \n", tick, chan, note, vel); //note on + fprintf(file, "N %d -> %d %d %d \n", tick, chan, note, vel); //note on if(vel != 0) keyspressed++; diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp @@ -42,7 +42,7 @@ using namespace std; vuData::vuData(void) :outpeakl(0.0f), outpeakr(0.0f), maxoutpeakl(0.0f), maxoutpeakr(0.0f), - rmspeakl(0.0f), rmspeakr(0.0f), clipped(0) + rmspeakl(0.0f), rmspeakr(0.0f), clipped(0) {} Master::Master() @@ -182,7 +182,8 @@ void Master::setController(char chan, int type, int par) } ; } - else if(type == C_bankselectmsb) { // Change current bank + else + if(type == C_bankselectmsb) { // Change current bank if(((unsigned int)par < bank.banks.size()) && (bank.banks[par].dir != bank.bankfiletitle)) bank.loadbank(bank.banks[par].dir); @@ -204,7 +205,7 @@ void Master::setController(char chan, int type, int par) void Master::setProgram(char chan, unsigned int pgm) { - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { + for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) if(chan == part[npart]->Prcvchn) { bank.loadfromslot(pgm, part[npart]); @@ -215,7 +216,6 @@ void Master::setProgram(char chan, unsigned int pgm) part[npart]->applyparameters(); pthread_mutex_lock(&mutex); } - } } void Master::vuUpdate(const float *outl, const float *outr) @@ -356,7 +356,7 @@ void Master::AudioOut(float *outl, float *outr) //System effects for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) { if(sysefx[nefx]->geteffect() == 0) - continue; //the effect is disabled + continue; //the effect is disabled float *tmpmixl = getTmpBuffer(); float *tmpmixr = getTmpBuffer(); diff --git a/src/Misc/Master.h b/src/Misc/Master.h @@ -113,7 +113,7 @@ class Master void partonoff(int npart, int what); /**parts \todo see if this can be made to be dynamic*/ - class Part *part[NUM_MIDI_PARTS]; + class Part * part[NUM_MIDI_PARTS]; //parameters @@ -129,8 +129,8 @@ class Master void setPsysefxsend(int Pefxfrom, int Pefxto, char Pvol); //effects - class EffectMgr *sysefx[NUM_SYS_EFX]; //system - class EffectMgr *insefx[NUM_INS_EFX]; //insertion + class EffectMgr * sysefx[NUM_SYS_EFX]; //system + class EffectMgr * insefx[NUM_INS_EFX]; //insertion // void swapcopyeffects(int what,int type,int neff1,int neff2); //HDD recorder @@ -157,7 +157,7 @@ class Master Microtonal microtonal; Bank bank; - class FFTwrapper *fft; + class FFTwrapper * fft; pthread_mutex_t mutex; pthread_mutex_t vumutex; diff --git a/src/Misc/Microtonal.cpp b/src/Misc/Microtonal.cpp @@ -186,8 +186,8 @@ float Microtonal::getnotefreq(int note, int keyshift) const float oct = octave[octavesize - 1].tuning; float freq = - octave[(ntkey + octavesize - 1) % octavesize].tuning *powf(oct, - ntoct) + octave[(ntkey + octavesize - 1) % octavesize].tuning * powf(oct, + ntoct) * PAfreq; if(ntkey == 0) freq /= oct; @@ -209,11 +209,11 @@ bool Microtonal::operator!=(const Microtonal &micro) const //A simple macro to test equality MiCRotonal EQuals (not the perfect //approach, but good enough) #define MCREQ(x) if(x != micro.x) \ - return true; + return true //for floats #define FMCREQ(x) if(!((x < micro.x + 0.0001f) && (x > micro.x - 0.0001f))) \ - return true; + return true MCREQ(Pinvertupdown); MCREQ(Pinvertupdowncenter); diff --git a/src/Misc/NSM.C b/src/Misc/NSM.C @@ -33,94 +33,100 @@ extern int Pexitprogram; extern MasterUI *ui; extern NSM_Client *nsm; -extern char *instance_name; +extern char *instance_name; -NSM_Client::NSM_Client ( ) +NSM_Client::NSM_Client() { project_filename = 0; - display_name = 0; + display_name = 0; } -int command_open ( const char *name, const char *display_name, const char *client_id, char **out_msg ); -int command_save ( char **out_msg ); +int command_open(const char *name, + const char *display_name, + const char *client_id, + char **out_msg); +int command_save(char **out_msg); int -NSM_Client::command_save ( char **out_msg ) +NSM_Client::command_save(char **out_msg) { int r = ERR_OK; - ui->do_save_master( project_filename ); - + ui->do_save_master(project_filename); + return r; } int -NSM_Client::command_open ( const char *name, const char *display_name, const char *client_id, char **out_msg ) +NSM_Client::command_open(const char *name, + const char *display_name, + const char *client_id, + char **out_msg) { Nio::stop(); - if ( instance_name ) - free( instance_name ); - - instance_name = strdup( client_id ); + if(instance_name) + free(instance_name); + + instance_name = strdup(client_id); Nio::start(); char *new_filename; - - asprintf( &new_filename, "%s.xmz", name ); + + asprintf(&new_filename, "%s.xmz", name); struct stat st; int r = ERR_OK; - if ( 0 == stat( new_filename, &st ) ) - { - if ( ui->do_load_master_unconditional( new_filename, display_name ) < 0 ) - { - *out_msg = strdup( "Failed to load for unknown reason" ); + if(0 == stat(new_filename, &st)) { + if(ui->do_load_master_unconditional(new_filename, display_name) < 0) { + *out_msg = strdup("Failed to load for unknown reason"); r = ERR_GENERAL; return r; } } else - { ui->do_new_master_unconditional(); - } - if ( project_filename ) - free( project_filename ); + if(project_filename) + free(project_filename); + + if(this->display_name) + free(this->display_name); - if ( this->display_name ) - free( this->display_name ); - project_filename = new_filename; - this->display_name = strdup( display_name ); + this->display_name = strdup(display_name); return r; } void -NSM_Client::command_active ( bool active ) +NSM_Client::command_active(bool active) { - if ( active ) - { - const_cast<Fl_Menu_Item *>( ui->mastermenu->find_item( "&File/&Open Parameters..." ) )->deactivate(); - const_cast<Fl_Menu_Item *>( ui->simplemastermenu->find_item( "&File/&Open Parameters..." ) )->deactivate(); + if(active) { + const_cast<Fl_Menu_Item *>(ui->mastermenu->find_item( + "&File/&Open Parameters..."))-> + deactivate(); + const_cast<Fl_Menu_Item *>(ui->simplemastermenu->find_item( + "&File/&Open Parameters..."))-> + deactivate(); ui->sm_indicator1->value(1); ui->sm_indicator2->value(1); - ui->sm_indicator1->tooltip( session_manager_name() ); - ui->sm_indicator2->tooltip( session_manager_name() ); + ui->sm_indicator1->tooltip(session_manager_name()); + ui->sm_indicator2->tooltip(session_manager_name()); } - else - { - const_cast<Fl_Menu_Item *>( ui->mastermenu->find_item( "&File/&Open Parameters..." ) )->activate(); - const_cast<Fl_Menu_Item *>( ui->simplemastermenu->find_item( "&File/&Open Parameters..." ) )->activate(); + else { + const_cast<Fl_Menu_Item *>(ui->mastermenu->find_item( + "&File/&Open Parameters..."))->activate(); + const_cast<Fl_Menu_Item *>(ui->simplemastermenu->find_item( + "&File/&Open Parameters..."))->activate(); ui->sm_indicator1->value(0); ui->sm_indicator2->value(0); - ui->sm_indicator1->tooltip( NULL ); - ui->sm_indicator2->tooltip( NULL ); + ui->sm_indicator1->tooltip(NULL); + ui->sm_indicator2->tooltip(NULL); } } diff --git a/src/Misc/NSM.H b/src/Misc/NSM.H @@ -22,21 +22,24 @@ #if USE_NSM #include "NSM/Client.H" -class NSM_Client : public NSM::Client +class NSM_Client:public NSM::Client { -public: + public: - char *project_filename; - char *display_name; + char *project_filename; + char *display_name; - NSM_Client ( ); - ~NSM_Client ( ) { }; - -protected: + NSM_Client(); + ~NSM_Client() { } - int command_open ( const char *name, const char *display_name, const char *client_id, char **out_msg ); - int command_save ( char **out_msg ); + protected: - void command_active ( bool active ); + int command_open(const char *name, + const char *display_name, + const char *client_id, + char **out_msg); + int command_save(char **out_msg); + + void command_active(bool active); }; #endif diff --git a/src/Misc/NSM/Client.C b/src/Misc/NSM/Client.C @@ -27,7 +27,6 @@ namespace NSM { - /************************/ /* OSC Message Handlers */ /************************/ @@ -35,168 +34,240 @@ namespace NSM #undef OSC_REPLY #undef OSC_REPLY_ERR -#define OSC_REPLY( value ) lo_send_from( ((NSM::Client*)user_data)->nsm_addr, ((NSM::Client*)user_data)->_server, LO_TT_IMMEDIATE, "/reply", "ss", path, value ) - -#define OSC_REPLY_ERR( errcode, value ) lo_send_from( ((NSM::Client*)user_data)->nsm_addr, ((NSM::Client*)user_data)->_server, LO_TT_IMMEDIATE, "/error", "sis", path, errcode, value ) - - Client::Client ( ) +#define OSC_REPLY(value) lo_send_from(((NSM::Client *)user_data)->nsm_addr, \ + ((NSM::Client *)user_data)->_server, \ + LO_TT_IMMEDIATE, \ + "/reply", \ + "ss", \ + path, \ + value) + +#define OSC_REPLY_ERR(errcode, value) lo_send_from( \ + ((NSM::Client *)user_data)->nsm_addr, \ + ((NSM::Client *)user_data)->_server, \ + LO_TT_IMMEDIATE, \ + "/error", \ + "sis", \ + path, \ + errcode, \ + value) + + Client::Client() { - nsm_addr = 0; + nsm_addr = 0; nsm_client_id = 0; _session_manager_name = 0; nsm_is_active = false; _server = 0; - _st = 0; + _st = 0; } - Client::~Client ( ) + Client::~Client() { - if ( _st ) + if(_st) stop(); - - if ( _st ) - lo_server_thread_free( _st ); + + if(_st) + lo_server_thread_free(_st); else - lo_server_free ( _server ); + lo_server_free(_server); } void - Client::announce ( const char *application_name, const char *capabilities, const char *process_name ) + Client::announce(const char *application_name, + const char *capabilities, + const char *process_name) { // MESSAGE( "Announcing to NSM" ); - lo_address to = lo_address_new_from_url( nsm_url ); + lo_address to = lo_address_new_from_url(nsm_url); - if ( ! to ) - { - // MESSAGE( "Bad address" ); + if(!to) + // MESSAGE( "Bad address" ); return; - } int pid = (int)getpid(); - lo_send_from( to, _server, LO_TT_IMMEDIATE, "/nsm/server/announce", "sssiii", - application_name, - capabilities, - process_name, - 1, /* api_major_version */ - 0, /* api_minor_version */ - pid ); - - lo_address_free( to ); + lo_send_from(to, + _server, + LO_TT_IMMEDIATE, + "/nsm/server/announce", + "sssiii", + application_name, + capabilities, + process_name, + 1, + /* api_major_version */ + 0, + /* api_minor_version */ + pid); + + lo_address_free(to); } void - Client::progress ( float p ) + Client::progress(float p) { - if ( nsm_is_active ) - { - lo_send_from( nsm_addr, _server, LO_TT_IMMEDIATE, "/nsm/client/progress", "f", p ); - } + if(nsm_is_active) + lo_send_from(nsm_addr, + _server, + LO_TT_IMMEDIATE, + "/nsm/client/progress", + "f", + p); } void - Client::is_dirty ( void ) + Client::is_dirty(void) { - if ( nsm_is_active ) - { - lo_send_from( nsm_addr, _server, LO_TT_IMMEDIATE, "/nsm/client/is_dirty", "" ); - } + if(nsm_is_active) + lo_send_from(nsm_addr, + _server, + LO_TT_IMMEDIATE, + "/nsm/client/is_dirty", + ""); } void - Client::is_clean ( void ) + Client::is_clean(void) { - if ( nsm_is_active ) - { - lo_send_from( nsm_addr, _server, LO_TT_IMMEDIATE, "/nsm/client/is_clean", "" ); - } + if(nsm_is_active) + lo_send_from(nsm_addr, + _server, + LO_TT_IMMEDIATE, + "/nsm/client/is_clean", + ""); } void - Client::message ( int priority, const char *msg ) + Client::message(int priority, const char *msg) { - if ( nsm_is_active ) - { - lo_send_from( nsm_addr, _server, LO_TT_IMMEDIATE, "/nsm/client/message", "is", priority, msg ); - } + if(nsm_is_active) + lo_send_from(nsm_addr, + _server, + LO_TT_IMMEDIATE, + "/nsm/client/message", + "is", + priority, + msg); } - + void - Client::broadcast ( lo_message msg ) + Client::broadcast(lo_message msg) { - if ( nsm_is_active ) - { - lo_send_message_from( nsm_addr, _server, "/nsm/server/broadcast", msg ); - } + if(nsm_is_active) + lo_send_message_from(nsm_addr, + _server, + "/nsm/server/broadcast", + msg); } void - Client::check ( int timeout ) + Client::check(int timeout) { - if ( lo_server_wait( _server, timeout ) ) - while ( lo_server_recv_noblock( _server, 0 ) ) {} + if(lo_server_wait(_server, timeout)) + while(lo_server_recv_noblock(_server, 0)) {} } void - Client::start ( ) + Client::start() { - lo_server_thread_start( _st ); + lo_server_thread_start(_st); } void - Client::stop ( ) + Client::stop() { - lo_server_thread_stop( _st ); + lo_server_thread_stop(_st); } int - Client::init ( const char *nsm_url ) + Client::init(const char *nsm_url) { this->nsm_url = nsm_url; - lo_address addr = lo_address_new_from_url( nsm_url ); - int proto = lo_address_get_protocol( addr ); - lo_address_free( addr ); + lo_address addr = lo_address_new_from_url(nsm_url); + int proto = lo_address_get_protocol(addr); + lo_address_free(addr); - _server = lo_server_new_with_proto( NULL, proto, NULL ); + _server = lo_server_new_with_proto(NULL, proto, NULL); - if ( ! _server ) + if(!_server) return -1; - lo_server_add_method( _server, "/error", "sis", &Client::osc_error, this ); - lo_server_add_method( _server, "/reply", "ssss", &Client::osc_announce_reply, this ); - lo_server_add_method( _server, "/nsm/client/open", "sss", &Client::osc_open, this ); - lo_server_add_method( _server, "/nsm/client/save", "", &Client::osc_save, this ); - lo_server_add_method( _server, "/nsm/client/session_is_loaded", "", &Client::osc_session_is_loaded, this ); - lo_server_add_method( _server, NULL, NULL, &Client::osc_broadcast, this ); + lo_server_add_method(_server, "/error", "sis", &Client::osc_error, this); + lo_server_add_method(_server, + "/reply", + "ssss", + &Client::osc_announce_reply, + this); + lo_server_add_method(_server, + "/nsm/client/open", + "sss", + &Client::osc_open, + this); + lo_server_add_method(_server, + "/nsm/client/save", + "", + &Client::osc_save, + this); + lo_server_add_method(_server, + "/nsm/client/session_is_loaded", + "", + &Client::osc_session_is_loaded, + this); + lo_server_add_method(_server, NULL, NULL, &Client::osc_broadcast, this); return 0; } int - Client::init_thread ( const char *nsm_url ) + Client::init_thread(const char *nsm_url) { this->nsm_url = nsm_url; - lo_address addr = lo_address_new_from_url( nsm_url ); - int proto = lo_address_get_protocol( addr ); - lo_address_free( addr ); - - _st = lo_server_thread_new_with_proto( NULL, proto, NULL ); - _server = lo_server_thread_get_server( _st ); - - if ( ! _server || ! _st ) + lo_address addr = lo_address_new_from_url(nsm_url); + int proto = lo_address_get_protocol(addr); + lo_address_free(addr); + + _st = lo_server_thread_new_with_proto(NULL, proto, NULL); + _server = lo_server_thread_get_server(_st); + + if(!_server || !_st) return -1; - lo_server_thread_add_method( _st, "/error", "sis", &Client::osc_error, this ); - lo_server_thread_add_method( _st, "/reply", "ssss", &Client::osc_announce_reply, this ); - lo_server_thread_add_method( _st, "/nsm/client/open", "sss", &Client::osc_open, this ); - lo_server_thread_add_method( _st, "/nsm/client/save", "", &Client::osc_save, this ); - lo_server_thread_add_method( _st, "/nsm/client/session_is_loaded", "", &Client::osc_session_is_loaded, this ); - lo_server_thread_add_method( _st, NULL, NULL, &Client::osc_broadcast, this ); - + lo_server_thread_add_method(_st, + "/error", + "sis", + &Client::osc_error, + this); + lo_server_thread_add_method(_st, + "/reply", + "ssss", + &Client::osc_announce_reply, + this); + lo_server_thread_add_method(_st, + "/nsm/client/open", + "sss", + &Client::osc_open, + this); + lo_server_thread_add_method(_st, + "/nsm/client/save", + "", + &Client::osc_save, + this); + lo_server_thread_add_method(_st, + "/nsm/client/session_is_loaded", + "", + &Client::osc_session_is_loaded, + this); + lo_server_thread_add_method(_st, + NULL, + NULL, + &Client::osc_broadcast, + this); + return 0; } @@ -205,55 +276,78 @@ namespace NSM /************************/ int - Client::osc_broadcast ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + Client::osc_broadcast(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data) { - return ((NSM::Client*)user_data)->command_broadcast( path, msg ); + return ((NSM::Client *)user_data)->command_broadcast(path, msg); } int - Client::osc_save ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + Client::osc_save(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data) { char *out_msg = NULL; - - int r = ((NSM::Client*)user_data)->command_save(&out_msg); - if ( r ) - OSC_REPLY_ERR( r, ( out_msg ? out_msg : "") ); + int r = ((NSM::Client *)user_data)->command_save(&out_msg); + + if(r) + OSC_REPLY_ERR(r, (out_msg ? out_msg : "")); else - OSC_REPLY( "OK" ); + OSC_REPLY("OK"); - if ( out_msg ) - free( out_msg ); + if(out_msg) + free(out_msg); - return 0; + return 0; } int - Client::osc_open ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + Client::osc_open(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data) { char *out_msg = NULL; - NSM::Client *nsm = (NSM::Client*)user_data; - - nsm->nsm_client_id = strdup( &argv[2]->s ); + NSM::Client *nsm = (NSM::Client *)user_data; + + nsm->nsm_client_id = strdup(&argv[2]->s); + + int r = ((NSM::Client *)user_data)->command_open(&argv[0]->s, + &argv[1]->s, + &argv[2]->s, + &out_msg); - int r = ((NSM::Client*)user_data)->command_open( &argv[0]->s, &argv[1]->s, &argv[2]->s, &out_msg); - - if ( r ) - OSC_REPLY_ERR( r, ( out_msg ? out_msg : "") ); + if(r) + OSC_REPLY_ERR(r, (out_msg ? out_msg : "")); else - OSC_REPLY( "OK" ); + OSC_REPLY("OK"); - if ( out_msg ) - free( out_msg ); + if(out_msg) + free(out_msg); return 0; } int - Client::osc_session_is_loaded ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + Client::osc_session_is_loaded(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data) { - NSM::Client *nsm = (NSM::Client*)user_data; + NSM::Client *nsm = (NSM::Client *)user_data; nsm->command_session_is_loaded(); @@ -261,36 +355,48 @@ namespace NSM } int - Client::osc_error ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + Client::osc_error(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data) { - if ( strcmp( &argv[0]->s, "/nsm/server/announce" ) ) + if(strcmp(&argv[0]->s, "/nsm/server/announce")) return -1; - - NSM::Client *nsm = (NSM::Client*)user_data; + + NSM::Client *nsm = (NSM::Client *)user_data; // WARNING( "Failed to register with NSM: %s", &argv[2]->s ); nsm->nsm_is_active = false; - - nsm->command_active( nsm->nsm_is_active ); + + nsm->command_active(nsm->nsm_is_active); return 0; } int - Client::osc_announce_reply ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ) + Client::osc_announce_reply(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data) { - if ( strcmp( &argv[0]->s, "/nsm/server/announce" ) ) + if(strcmp(&argv[0]->s, "/nsm/server/announce")) return -1; - - NSM::Client *nsm = (NSM::Client*)user_data; + + NSM::Client *nsm = (NSM::Client *)user_data; // MESSAGE( "Successfully registered. NSM says: %s", &argv[1]->s ); nsm->nsm_is_active = true; - nsm->_session_manager_name = strdup( &argv[2]->s ); - nsm->nsm_addr = lo_address_new_from_url( lo_address_get_url( lo_message_get_source( msg ) )); - - nsm->command_active( nsm->nsm_is_active ); + nsm->_session_manager_name = strdup(&argv[2]->s); + nsm->nsm_addr = + lo_address_new_from_url(lo_address_get_url(lo_message_get_source( + msg))); + + nsm->command_active(nsm->nsm_is_active); return 0; } diff --git a/src/Misc/NSM/Client.H b/src/Misc/NSM/Client.H @@ -23,87 +23,121 @@ namespace NSM { - class Client { - - private: - - const char *nsm_url; - - lo_server _server; - lo_server_thread _st; - lo_address nsm_addr; - - bool nsm_is_active; - char *nsm_client_id; - char *_session_manager_name; - - public: - - enum - { - ERR_OK = 0, - ERR_GENERAL = -1, - ERR_INCOMPATIBLE_API = -2, - ERR_BLACKLISTED = -3, - ERR_LAUNCH_FAILED = -4, - ERR_NO_SUCH_FILE = -5, - ERR_NO_SESSION_OPEN = -6, - ERR_UNSAVED_CHANGES = -7, - ERR_NOT_NOW = -8 - }; - - Client ( ); - virtual ~Client ( ); - - bool is_active ( void ) { return nsm_is_active; } - - const char *session_manager_name ( void ) { return _session_manager_name; } - - /* Client->Server methods */ - void is_dirty ( void ); - void is_clean ( void ); - void progress ( float f ); - void message( int priority, const char *msg ); - void announce ( const char *appliction_name, const char *capabilities, const char *process_name ); - - void broadcast ( lo_message msg ); - - /* init without threading */ - int init ( const char *nsm_url ); - /* init with threading */ - int init_thread ( const char *nsm_url ); - - /* call this periodically to check for new messages */ - void check ( int timeout = 0 ); - - /* or call these to start and stop a thread (must do your own locking in handler!) */ - void start ( void ); - void stop ( void ); - - protected: - - /* Server->Client methods */ - virtual int command_open ( const char *name, const char *display_name, const char *client_id, char **out_msg ) = 0; - virtual int command_save ( char **out_msg ) = 0; - - virtual void command_active ( bool ) { } - - virtual void command_session_is_loaded ( void ) { } - - /* invoked when an unrecognized message is received. Should return 0 if you handled it, -1 otherwise. */ - virtual int command_broadcast ( const char *, lo_message ) { return -1; } - - private: - - /* osc handlers */ - static int osc_open ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); - static int osc_save ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); - static int osc_announce_reply ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); - static int osc_error ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); - static int osc_session_is_loaded ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); - static int osc_broadcast ( const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data ); - + private: + + const char *nsm_url; + + lo_server _server; + lo_server_thread _st; + lo_address nsm_addr; + + bool nsm_is_active; + char *nsm_client_id; + char *_session_manager_name; + + public: + + enum { + ERR_OK = 0, + ERR_GENERAL = -1, + ERR_INCOMPATIBLE_API = -2, + ERR_BLACKLISTED = -3, + ERR_LAUNCH_FAILED = -4, + ERR_NO_SUCH_FILE = -5, + ERR_NO_SESSION_OPEN = -6, + ERR_UNSAVED_CHANGES = -7, + ERR_NOT_NOW = -8 + }; + + Client(); + virtual ~Client(); + + bool is_active(void) { return nsm_is_active; } + + const char *session_manager_name(void) { + return + _session_manager_name; + } + + /* Client->Server methods */ + void is_dirty(void); + void is_clean(void); + void progress(float f); + void message(int priority, const char *msg); + void announce(const char *appliction_name, + const char *capabilities, + const char *process_name); + + void broadcast(lo_message msg); + + /* init without threading */ + int init(const char *nsm_url); + /* init with threading */ + int init_thread(const char *nsm_url); + + /* call this periodically to check for new messages */ + void check(int timeout = 0); + + /* or call these to start and stop a thread (must do your own locking in handler!) */ + void start(void); + void stop(void); + + protected: + + /* Server->Client methods */ + virtual int command_open(const char *name, + const char *display_name, + const char *client_id, + char **out_msg) = 0; + virtual int command_save(char **out_msg) = 0; + + virtual void command_active(bool) { } + + virtual void command_session_is_loaded(void) { } + + /* invoked when an unrecognized message is received. Should return 0 if you handled it, -1 otherwise. */ + virtual int command_broadcast(const char *, lo_message) { return -1; } + + private: + + /* osc handlers */ + static int osc_open(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data); + static int osc_save(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data); + static int osc_announce_reply(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data); + static int osc_error(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data); + static int osc_session_is_loaded(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data); + static int osc_broadcast(const char *path, + const char *types, + lo_arg **argv, + int argc, + lo_message msg, + void *user_data); }; }; diff --git a/src/Misc/Part.cpp b/src/Misc/Part.cpp @@ -227,7 +227,7 @@ void Part::NoteOn(unsigned char note, I'm not sure why though... */ if((partnote[lastpos].status != KEY_PLAYING) && (partnote[lastpos].status != KEY_RELASED_AND_SUSTAINED)) - ismonofirstnote = true; // No other keys are held or sustained. + ismonofirstnote = true; // No other keys are held or sustained. } else // Poly mode is On so just make sure the list is empty. @@ -394,7 +394,7 @@ void Part::NoteOn(unsigned char note, if((lastnotecopy < kit[item].Pminkey) || (lastnotecopy > kit[item].Pmaxkey)) - continue; // We will not perform legato across 2 key regions. + continue; // We will not perform legato across 2 key regions. partnote[pos].kititem[ci].sendtoparteffect = (kit[item].Psendtoparteffect < @@ -635,7 +635,7 @@ void Part::NoteOff(unsigned char note) //relase the key if((partnote[i].status == KEY_PLAYING) && (partnote[i].note == note)) { if(ctl.sustain.sustain == 0) { //the sustain pedal is not pushed if((Ppolymode == 0) && (not monomemnotes.empty())) - MonoMemRenote(); // To play most recent still held note. + MonoMemRenote(); // To play most recent still held note. else RelaseNotePos(i); /// break; @@ -745,7 +745,7 @@ void Part::RelaseSustainedKeys() // Let's call MonoMemRenote() on some conditions: if((Ppolymode == 0) && (not monomemnotes.empty())) if(monomemnotes.back() != lastnote) // Sustain controller manipulation would cause repeated same note respawn without this check. - MonoMemRenote(); // To play most recent still held note. + MonoMemRenote(); // To play most recent still held note. for(int i = 0; i < POLIPHONY; ++i) if(partnote[i].status == KEY_RELASED_AND_SUSTAINED) diff --git a/src/Misc/Part.h b/src/Misc/Part.h @@ -166,8 +166,8 @@ class Part int itemsplaying; struct { SynthNote *adnote, - *subnote, - *padnote; + *subnote, + *padnote; int sendtoparteffect; } kititem[NUM_KIT_ITEMS]; int time; diff --git a/src/Misc/Recorder.cpp b/src/Misc/Recorder.cpp @@ -46,7 +46,8 @@ int Recorder::preparefile(std::string filename_, int overwrite) return 1; } - OutMgr::getInstance(). wave->newFile(new WavFile(filename_, synth->samplerate, 2)); + OutMgr::getInstance(). wave->newFile(new WavFile(filename_, + synth->samplerate, 2)); status = 1; //ready diff --git a/src/Misc/Util.cpp b/src/Misc/Util.cpp @@ -206,17 +206,17 @@ float SYNTH_T::numRandom() const float interpolate(const float *data, size_t len, float pos) { - assert(len > (size_t)pos+1); - const int l_pos = (int)pos, - r_pos = l_pos + 1; + assert(len > (size_t)pos + 1); + const int l_pos = (int)pos, + r_pos = l_pos + 1; const float leftness = pos - l_pos; return data[l_pos] * leftness + data[r_pos] * (1.0f - leftness); } float cinterpolate(const float *data, size_t len, float pos) { - const int l_pos = ((int)pos) % len, - r_pos = (l_pos + 1) % len; + const int l_pos = ((int)pos) % len, + r_pos = (l_pos + 1) % len; const float leftness = pos - l_pos; return data[l_pos] * leftness + data[r_pos] * (1.0f - leftness); } diff --git a/src/Misc/Util.h b/src/Misc/Util.h @@ -84,7 +84,7 @@ T stringTo(const char *x) template<class T> T limit(T val, T min, T max) { - return (val<min ? min : (val> max ? max : val)); + return val < min ? min : (val > max ? max : val); } //Random number generator @@ -93,7 +93,7 @@ typedef uint32_t prng_t; extern prng_t prng_state; // Portable Pseudo-Random Number Generator -inline prng_t prng_r(prng_t & p) +inline prng_t prng_r(prng_t &p) { return p = p * 1103515245 + 12345; } diff --git a/src/Misc/XMLwrapper.cpp b/src/Misc/XMLwrapper.cpp @@ -313,7 +313,7 @@ int XMLwrapper::loadXMLfile(const string &filename) const char *xmldata = doloadfile(filename.c_str()); if(xmldata == NULL) - return -1; //the file could not be loaded or uncompressed + return -1; //the file could not be loaded or uncompressed root = tree = mxmlLoadString(NULL, trimLeadingWhite( xmldata), MXML_OPAQUE_CALLBACK); @@ -321,7 +321,7 @@ int XMLwrapper::loadXMLfile(const string &filename) delete[] xmldata; if(tree == NULL) - return -2; //this is not XML + return -2; //this is not XML node = root = mxmlFindElement(tree, tree, @@ -330,7 +330,7 @@ int XMLwrapper::loadXMLfile(const string &filename) NULL, MXML_DESCEND); if(root == NULL) - return -3; //the XML doesnt embbed zynaddsubfx data + return -3; //the XML doesnt embbed zynaddsubfx data //fetch version information version.Major = stringTo<int>(mxmlElementGetAttr(root, "version-major")); diff --git a/src/Nio/EngineMgr.cpp b/src/Nio/EngineMgr.cpp @@ -134,7 +134,8 @@ bool EngineMgr::setInDefault(string name) } //Warn user - cerr << "Error: " << name << " is not a recognized MIDI input source" << endl; + cerr << "Error: " << name << " is not a recognized MIDI input source" + << endl; cerr << " Defaulting to the NULL input source" << endl; return false; diff --git a/src/Nio/InMgr.cpp b/src/Nio/InMgr.cpp @@ -9,22 +9,22 @@ using namespace std; ostream &operator<<(ostream &out, const MidiEvent &ev) { switch(ev.type) { - case M_NOTE: - out << "MidiNote: note(" << ev.num << ")\n" + case M_NOTE: + out << "MidiNote: note(" << ev.num << ")\n" << " channel(" << ev.channel << ")\n" << " velocity(" << ev.value << ")"; - break; + break; - case M_CONTROLLER: - out << "MidiCtl: controller(" << ev.num << ")\n" + case M_CONTROLLER: + out << "MidiCtl: controller(" << ev.num << ")\n" << " channel(" << ev.channel << ")\n" << " value(" << ev.value << ")"; - break; + break; - case M_PGMCHANGE: - out << "PgmChange: program(" << ev.num << ")\n" + case M_PGMCHANGE: + out << "PgmChange: program(" << ev.num << ")\n" << " channel(" << ev.channel << ")"; - break; + break; } return out; @@ -69,23 +69,23 @@ void InMgr::flush() //cout << ev << endl; switch(ev.type) { - case M_NOTE: - dump.dumpnote(ev.channel, ev.num, ev.value); - - if(ev.value) - master.noteOn(ev.channel, ev.num, ev.value); - else - master.noteOff(ev.channel, ev.num); - break; - - case M_CONTROLLER: - dump.dumpcontroller(ev.channel, ev.num, ev.value); - master.setController(ev.channel, ev.num, ev.value); - break; - - case M_PGMCHANGE: - master.setProgram(ev.channel, ev.num); - break; + case M_NOTE: + dump.dumpnote(ev.channel, ev.num, ev.value); + + if(ev.value) + master.noteOn(ev.channel, ev.num, ev.value); + else + master.noteOff(ev.channel, ev.num); + break; + + case M_CONTROLLER: + dump.dumpcontroller(ev.channel, ev.num, ev.value); + master.setController(ev.channel, ev.num, ev.value); + break; + + case M_PGMCHANGE: + master.setProgram(ev.channel, ev.num); + break; } } } diff --git a/src/Nio/InMgr.h b/src/Nio/InMgr.h @@ -8,7 +8,7 @@ enum midi_type { M_NOTE = 1, M_CONTROLLER = 2, - M_PGMCHANGE = 3 + M_PGMCHANGE = 3 }; //type=1 for note, type=2 for controller, type=3 for program change struct MidiEvent { diff --git a/src/Nio/JackEngine.cpp b/src/Nio/JackEngine.cpp @@ -60,22 +60,22 @@ bool JackEngine::connectServer(string server) jack_status_t jackstatus; bool use_server_name = server.size() && server.compare("default") != 0; jack_options_t jopts = (jack_options_t) - (((! instance_name && use_server_name) ? JackServerName : + (((!instance_name + && use_server_name) ? JackServerName : JackNullOption) | ((autostart_jack) ? JackNullOption : JackNoStartServer)); - if ( instance_name ) - { - jackClient = jack_client_open(instance_name, jopts, &jackstatus); - } - else - { + if(instance_name) + jackClient = jack_client_open(instance_name, jopts, &jackstatus); + else { if(use_server_name) - jackClient = jack_client_open(clientname.c_str(), jopts, &jackstatus, - server.c_str()); + jackClient = jack_client_open( + clientname.c_str(), jopts, &jackstatus, + server.c_str()); else - jackClient = jack_client_open(clientname.c_str(), jopts, &jackstatus); + jackClient = jack_client_open( + clientname.c_str(), jopts, &jackstatus); } @@ -308,7 +308,7 @@ bool JackEngine::processAudio(jack_nframes_t nframes) return true; } -int JackEngine::_xrunCallback(void * /*/arg*/) +int JackEngine::_xrunCallback(void *) { cerr << "Jack reports xrun" << endl; return 0; diff --git a/src/Nio/Nio.cpp b/src/Nio/Nio.cpp @@ -16,11 +16,11 @@ OutMgr *out = NULL; EngineMgr *eng = NULL; string postfix; -bool Nio::autoConnect = false; +bool Nio::autoConnect = false; string Nio::defaultSource = IN_DEFAULT; -string Nio::defaultSink = OUT_DEFAULT; +string Nio::defaultSink = OUT_DEFAULT; -void Nio::init ( void ) +void Nio::init(void) { in = &InMgr::getInstance(); //Enable input wrapper out = &OutMgr::getInstance(); //Initialize the Output Systems @@ -105,7 +105,7 @@ string Nio::getSink() void Nio::preferedSampleRate(unsigned &rate) { jack_client_t *client = jack_client_open("temp-client", - JackNoStartServer, 0); + JackNoStartServer, 0); if(client) { rate = jack_get_sample_rate(client); jack_client_close(client); diff --git a/src/Nio/NulEngine.cpp b/src/Nio/NulEngine.cpp @@ -62,7 +62,8 @@ void *NulEngine::AudioThread() if(remaining < 0) cerr << "WARNING - too late" << endl; } - playing_until.tv_usec += synth->buffersize * 1000000 / synth->samplerate; + playing_until.tv_usec += synth->buffersize * 1000000 + / synth->samplerate; if(remaining < 0) playing_until.tv_usec -= remaining; playing_until.tv_sec += playing_until.tv_usec / 1000000; diff --git a/src/Nio/NulEngine.h b/src/Nio/NulEngine.h @@ -42,7 +42,7 @@ class NulEngine:public AudioOut, MidiIn bool getAudioEn() const; void setMidiEn(bool) {} - bool getMidiEn() const {return true;} + bool getMidiEn() const {return true; } protected: void *AudioThread(); diff --git a/src/Nio/OssEngine.cpp b/src/Nio/OssEngine.cpp @@ -59,7 +59,7 @@ OssEngine::~OssEngine() bool OssEngine::openAudio() { if(audio.handle != -1) - return true; //already open + return true; //already open int snd_bitsize = 16; int snd_fragment = 0x00080009; //fragment size (?); @@ -159,7 +159,7 @@ bool OssEngine::openMidi() { int handle = midi.handle; if(handle != -1) - return true; //already open + return true; //already open handle = open(config.cfg.LinuxOSSSeqInDev, O_RDONLY, 0); @@ -229,7 +229,7 @@ void *OssEngine::thread() } int handle = audio.handle; if(handle != -1) - write(handle, audio.smps, synth->buffersize * 4); // *2 because is 16 bit, again * 2 because is stereo + write(handle, audio.smps, synth->buffersize * 4); // *2 because is 16 bit, again * 2 because is stereo else break; } diff --git a/src/Nio/OutMgr.cpp b/src/Nio/OutMgr.cpp @@ -118,11 +118,15 @@ string OutMgr::getSink() const //perform a cheap linear interpolation for resampling //This will result in some distortion at frame boundries //returns number of samples produced -static size_t resample(float *dest, const float *src, float s_in, float s_out, size_t elms) +static size_t resample(float *dest, + const float *src, + float s_in, + float s_out, + size_t elms) { - size_t out_elms = elms*s_out/s_in; - float r_pos = 0.0f; - for(int i = 0; i < (int)out_elms; ++i, r_pos += s_in/s_out) + size_t out_elms = elms * s_out / s_in; + float r_pos = 0.0f; + for(int i = 0; i < (int)out_elms; ++i, r_pos += s_in / s_out) dest[i] = interpolate(src, elms, r_pos); return out_elms; @@ -133,11 +137,15 @@ void OutMgr::addSmps(float *l, float *r) //allow wave file to syphon off stream wave->push(Stereo<float *>(l, r), synth->buffersize); - const int s_out = currentOut->getSampleRate(), + const int s_out = currentOut->getSampleRate(), s_sys = synth->samplerate; if(s_out != s_sys) { //we need to resample - const size_t steps = resample(priBuffCurrent.l, l, s_sys, s_out, synth->buffersize); + const size_t steps = resample(priBuffCurrent.l, + l, + s_sys, + s_out, + synth->buffersize); resample(priBuffCurrent.r, r, s_sys, s_out, synth->buffersize); priBuffCurrent.l += steps; @@ -158,7 +166,7 @@ void OutMgr::removeStaleSmps() const int leftover = storedSmps() - stales; - assert(leftover>-1); + assert(leftover > -1); //leftover samples [seen at very low latencies] if(leftover) { diff --git a/src/Nio/OutMgr.h b/src/Nio/OutMgr.h @@ -43,7 +43,7 @@ class OutMgr private: OutMgr(); void addSmps(float *l, float *r); - unsigned int storedSmps() const {return priBuffCurrent.l - priBuf.l;} + unsigned int storedSmps() const {return priBuffCurrent.l - priBuf.l; } void removeStaleSmps(); AudioOut *currentOut; /**<The current output driver*/ diff --git a/src/Nio/WavEngine.h b/src/Nio/WavEngine.h @@ -40,7 +40,7 @@ class WavEngine:public AudioOut void Stop(); void setAudioEn(bool /*nval*/) {} - bool getAudioEn() const {return true;} + bool getAudioEn() const {return true; } void push(Stereo<float *> smps, size_t len); diff --git a/src/Output/DSSIaudiooutput.cpp b/src/Output/DSSIaudiooutput.cpp @@ -512,7 +512,7 @@ const DSSI_Descriptor *DSSIaudiooutput::getDssiDescriptor(unsigned long index) // // Initialise the DSSI descriptor, statically: -DSSI_Descriptor *DSSIaudiooutput:: dssiDescriptor = +DSSI_Descriptor *DSSIaudiooutput::dssiDescriptor = DSSIaudiooutput::initDssiDescriptor(); /** @@ -657,13 +657,13 @@ DSSIaudiooutput::ProgramDescriptor::ProgramDescriptor(unsigned long _bank, /** * The map of programs available; held as a single shared statically allocated object. */ -vector<DSSIaudiooutput::ProgramDescriptor> DSSIaudiooutput:: programMap = +vector<DSSIaudiooutput::ProgramDescriptor> DSSIaudiooutput::programMap = vector<DSSIaudiooutput::ProgramDescriptor>(); /** * Index controlling the map of banks */ -long DSSIaudiooutput:: bankNoToMap = 1; +long DSSIaudiooutput::bankNoToMap = 1; /** * Queries and maps the next available bank of instruments. diff --git a/src/Params/LFOParams.cpp b/src/Params/LFOParams.cpp @@ -25,7 +25,7 @@ #include "../globals.h" #include "LFOParams.h" -int LFOParams:: time; +int LFOParams::time; LFOParams::LFOParams(char Pfreq_, char Pintensity_, diff --git a/src/Params/PADnoteParameters.cpp b/src/Params/PADnoteParameters.cpp @@ -458,7 +458,8 @@ void PADnoteParameters::generatespectrum_bandwidthMode(float *spectrum, if(ibw > profilesize) { //if the bandwidth is larger than the profilesize float rap = sqrt((float)profilesize / (float)ibw); int cfreq = - (int) (realfreq / (synth->samplerate_f * 0.5f) * size) - ibw / 2; + (int) (realfreq + / (synth->samplerate_f * 0.5f) * size) - ibw / 2; for(int i = 0; i < ibw; ++i) { int src = (int)(i * rap * rap); int spfreq = i + cfreq; diff --git a/src/Synth/ADnote.cpp b/src/Synth/ADnote.cpp @@ -164,8 +164,8 @@ ADnote::ADnote(ADnoteParameters *pars, (unison_real_spread - 1.0f) * unison_vibratto_a; float increments_per_second = synth->samplerate_f / synth->buffersize_f; - float vibratto_base_period = 0.25f - * powf( + float vibratto_base_period = 0.25f + * powf( 2.0f, (1.0f - pars->VoicePar[nvoice]. @@ -440,7 +440,7 @@ void ADnote::legatonote(float freq, float velocity, int portamento_, for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { if(NoteVoicePar[nvoice].Enabled == OFF) - continue; //(gf) Stay the same as first note in legato. + continue; //(gf) Stay the same as first note in legato. NoteVoicePar[nvoice].fixedfreq = pars->VoicePar[nvoice].Pfixedfreq; NoteVoicePar[nvoice].fixedfreqET = pars->VoicePar[nvoice].PfixedfreqET; @@ -591,7 +591,7 @@ void ADnote::legatonote(float freq, float velocity, int portamento_, NoteVoicePar[nvoice].Volume = -NoteVoicePar[nvoice].Volume; if(partparams->VoicePar[nvoice].PPanning == 0) - NoteVoicePar[nvoice].Panning = RND; // random panning + NoteVoicePar[nvoice].Panning = RND; // random panning else NoteVoicePar[nvoice].Panning = partparams->VoicePar[nvoice].PPanning / 128.0f; @@ -744,7 +744,7 @@ void ADnote::initparameters() vce.Volume = -vce.Volume; if(param.PPanning == 0) - vce.Panning = RND; // random panning + vce.Panning = RND; // random panning else vce.Panning = param.PPanning / 128.0f; @@ -812,7 +812,8 @@ void ADnote::initparameters() vce.FMSmp[synth->oscilsize + i] = vce.FMSmp[i]; int oscposhiFM_add = (int)((param.PFMoscilphase - - 64.0f) / 128.0f * synth->oscilsize + synth->oscilsize * 4); + - 64.0f) / 128.0f * synth->oscilsize + + synth->oscilsize * 4); for(int k = 0; k < unison_size[nvoice]; ++k) { oscposhiFM[nvoice][k] += oscposhiFM_add; oscposhiFM[nvoice][k] %= synth->oscilsize; @@ -924,7 +925,7 @@ float ADnote::getvoicebasefreq(int nvoice) const + NoteGlobalPar.Detune / 100.0f; if(NoteVoicePar[nvoice].fixedfreq == 0) - return this->basefreq *powf(2, detune / 12.0f); + return this->basefreq * powf(2, detune / 12.0f); else { //the fixed freq is enabled float fixedfreq = 440.0f; int fixedfreqET = NoteVoicePar[nvoice].fixedfreqET; @@ -986,7 +987,7 @@ void ADnote::computecurrentparameters() if(portamento != 0) { //this voice use portamento portamentofreqrap = ctl->portamento.freqrap; if(ctl->portamento.used == 0) //the portamento has finished - portamento = 0; //this note is no longer "portamented" + portamento = 0; //this note is no longer "portamented" } //compute parameters for all voices @@ -1082,7 +1083,7 @@ inline void ADnote::fadein(float *smps) const int zerocrossings = 0; for(int i = 1; i < synth->buffersize; ++i) if((smps[i - 1] < 0.0f) && (smps[i] > 0.0f)) - zerocrossings++; //this is only the possitive crossings + zerocrossings++; //this is only the possitive crossings float tmp = (synth->buffersize_f - 1.0f) / (zerocrossings + 1) / 3.0f; if(tmp < 8.0f) @@ -1342,8 +1343,8 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, //normalize: makes all sample-rates, oscil_sizes to produce same sound if(FMmode != 0) { //Frequency modulation - float normalize = synth->oscilsize_f / 262144.0f * 44100.0f - / synth->samplerate_f; + float normalize = synth->oscilsize_f / 262144.0f * 44100.0f + / synth->samplerate_f; for(int k = 0; k < unison_size[nvoice]; ++k) { float *tw = tmpwave_unison[k]; float fmold = FMoldsmp[nvoice][k]; @@ -1733,9 +1734,9 @@ void ADnote::Voice::releasekey() } template<class T> -static inline void nullify(T &t) {delete t; t = NULL;} +static inline void nullify(T &t) {delete t; t = NULL; } template<class T> -static inline void arrayNullify(T &t) {delete [] t; t = NULL;} +static inline void arrayNullify(T &t) {delete [] t; t = NULL; } void ADnote::Voice::kill() { diff --git a/src/Synth/ADnote.h b/src/Synth/ADnote.h @@ -155,7 +155,7 @@ class ADnote:public SynthNote /****************************************** * FILTER GLOBAL PARAMETERS * ******************************************/ - class Filter *GlobalFilterL, *GlobalFilterR; + class Filter * GlobalFilterL, *GlobalFilterR; float FilterCenterPitch; //octaves float FilterQ; @@ -217,8 +217,8 @@ class ADnote:public SynthNote * FILTER PARAMETERS * *************************/ - class Filter *VoiceFilterL; - class Filter *VoiceFilterR; + class Filter * VoiceFilterL; + class Filter * VoiceFilterR; float FilterCenterPitch; /* Filter center Pitch*/ float FilterFreqTracking; diff --git a/src/Synth/Envelope.cpp b/src/Synth/Envelope.cpp @@ -53,7 +53,7 @@ Envelope::Envelope(EnvelopeParams *envpars, float basefreq) if(tmp > bufferdt) envdt[i] = bufferdt / tmp; else - envdt[i] = 2.0f; //any value larger than 1 + envdt[i] = 2.0f; //any value larger than 1 switch(mode) { case 2: diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp @@ -89,7 +89,7 @@ void rmsNormalize(fft_t *freqs) sum += normal(freqs, i); if(sum < 0.000001f) - return; //data is all ~zero, do not amplify noise + return; //data is all ~zero, do not amplify noise const float gain = 1.0f / sqrt(sum); @@ -156,7 +156,7 @@ void OscilGen::defaults() if(ADvsPAD) Prand = 127; //max phase randomness (usefull if the oscil will be imported to a ADsynth from a PADsynth else - Prand = 64; //no randomness + Prand = 64; //no randomness Pcurrentbasefunc = 0; Pbasefuncpar = 64; @@ -746,7 +746,7 @@ void OscilGen::adaptiveharmonicpostprocess(fft_t *f, int size) if(Padaptiveharmonics == 2) { //2n+1 for(int i = 0; i < size; ++i) if((i % 2) == 0) - f[i] += inf[i]; //i=0 pt prima armonica,etc. + f[i] += inf[i]; //i=0 pt prima armonica,etc. } else { //celelalte moduri int nh = (Padaptiveharmonics - 3) / 2 + 2; @@ -841,7 +841,8 @@ short int OscilGen::get(float *smps, float freqHz, int resonance) outoscilFFTfreqs[i] = oscilFFTfreqs[i]; adaptiveharmonic(outoscilFFTfreqs, freqHz); - adaptiveharmonicpostprocess(&outoscilFFTfreqs[1], synth->oscilsize / 2 - 1); + adaptiveharmonicpostprocess(&outoscilFFTfreqs[1], + synth->oscilsize / 2 - 1); nyquist = realnyquist; } @@ -927,7 +928,8 @@ void OscilGen::getspectrum(int n, float *spc, int what) if(what == 0) { for(int i = 0; i < n; ++i) outoscilFFTfreqs[i] = fft_t(spc[i], spc[i]); - memset(outoscilFFTfreqs + n, 0, (synth->oscilsize / 2 - n) * sizeof(fft_t)); + memset(outoscilFFTfreqs + n, 0, + (synth->oscilsize / 2 - n) * sizeof(fft_t)); adaptiveharmonic(outoscilFFTfreqs, 0.0f); adaptiveharmonicpostprocess(outoscilFFTfreqs, n - 1); for(int i = 0; i < n; ++i) @@ -1270,19 +1272,21 @@ FUNC(spike) { float b = a * 0.66666; // the width of the range: if a == 0.5, b == 0.33333 - if(x < 0.5){ - if(x < (0.5 - (b / 2.0))) return 0.0; + if(x < 0.5) { + if(x < (0.5 - (b / 2.0))) + return 0.0; else { x = (x + (b / 2) - 0.5) * (2.0 / b); // shift to zero, and expand to range from 0 to 1 return x * (2.0 / b); // this is the slope: 1 / (b / 2) } } else { - if(x > (0.5 + (b / 2.0))) return 0.0; - else { - x = (x - 0.5) * (2.0 / b); - return (1 - x) * (2.0 / b); - } + if(x > (0.5 + (b / 2.0))) + return 0.0; + else { + x = (x - 0.5) * (2.0 / b); + return (1 - x) * (2.0 / b); + } } } @@ -1294,15 +1298,19 @@ FUNC(circle) b = 2 - (a * 2); // b goes from 2 to 0 x = x * 4; - if (x < 2){ + if(x < 2) { x = x - 1; // x goes from -1 to 1 - if ((x < -b) || (x > b)) y = 0; - else y = sqrt(1 - (pow(x, 2) / pow(b, 2))); // normally * a^2, but a stays 1 + if((x < -b) || (x > b)) + y = 0; + else + y = sqrt(1 - (pow(x, 2) / pow(b, 2))); // normally * a^2, but a stays 1 } - else{ + else { x = x - 3; // x goes from -1 to 1 as well - if ((x < -b) || (x > b)) y = 0; - else y = -sqrt(1 - (pow(x, 2) / pow(b, 2))); + if((x < -b) || (x > b)) + y = 0; + else + y = -sqrt(1 - (pow(x, 2) / pow(b, 2))); } return y; } diff --git a/src/Synth/PADnote.cpp b/src/Synth/PADnote.cpp @@ -129,7 +129,8 @@ void PADnote::setup(float freq, float time = powf(10, 3.0f * pars->PPunchTime / 127.0f) / 10000.0f; //0.1f .. 100 ms float stretch = powf(440.0f / freq, pars->PPunchStretch / 64.0f); - NoteGlobalPar.Punch.dt = 1.0f / (time * synth->samplerate_f * stretch); + NoteGlobalPar.Punch.dt = 1.0f + / (time * synth->samplerate_f * stretch); } else NoteGlobalPar.Punch.Enabled = 0; @@ -247,7 +248,7 @@ void PADnote::computecurrentparameters() if(portamento != 0) { //this voice use portamento portamentofreqrap = ctl->portamento.freqrap; if(ctl->portamento.used == 0) //the portamento has finished - portamento = 0; //this note is no longer "portamented" + portamento = 0; //this note is no longer "portamented" ; } diff --git a/src/Synth/PADnote.h b/src/Synth/PADnote.h @@ -101,7 +101,7 @@ class PADnote:public SynthNote /****************************************** * FILTER GLOBAL PARAMETERS * ******************************************/ - class Filter *GlobalFilterL, *GlobalFilterR; + class Filter * GlobalFilterL, *GlobalFilterR; float FilterCenterPitch; //octaves float FilterQ; diff --git a/src/Synth/SUBnote.cpp b/src/Synth/SUBnote.cpp @@ -396,7 +396,7 @@ void SUBnote::computecurrentparameters() if(portamento != 0) { //portamento is used envfreq *= ctl->portamento.freqrap; if(ctl->portamento.used == 0) //the portamento has finished - portamento = 0; //this note is no longer "portamented" + portamento = 0; //this note is no longer "portamented" ; } diff --git a/src/Tests/ControllerTest.h b/src/Tests/ControllerTest.h @@ -29,7 +29,7 @@ class ControllerTest:public CxxTest::TestSuite { public: void setUp() { - synth = new SYNTH_T; + synth = new SYNTH_T; testCtl = new Controller(); } diff --git a/src/Tests/EchoTest.h b/src/Tests/EchoTest.h @@ -34,7 +34,7 @@ class EchoTest:public CxxTest::TestSuite public: void setUp() { synth = new SYNTH_T; - outL = new float[synth->buffersize]; + outL = new float[synth->buffersize]; for(int i = 0; i < synth->buffersize; ++i) outL[i] = 0.0f; outR = new float[synth->buffersize]; diff --git a/src/Tests/MicrotonalTest.h b/src/Tests/MicrotonalTest.h @@ -34,7 +34,7 @@ class MicrotonalTest:public CxxTest::TestSuite { public: void setUp() { - synth = new SYNTH_T; + synth = new SYNTH_T; testMicro = new Microtonal(); } diff --git a/src/Tests/OscilGenTest.h b/src/Tests/OscilGenTest.h @@ -18,7 +18,7 @@ class OscilGenTest:public CxxTest::TestSuite synth = new SYNTH_T; //First the sensible settings and variables that have to be set: synth->buffersize = 256; - synth->oscilsize = 1024; + synth->oscilsize = 1024; outL = new float[synth->oscilsize]; outR = new float[synth->oscilsize]; diff --git a/src/UI/NioUI.cpp b/src/UI/NioUI.cpp @@ -32,7 +32,7 @@ NioUI::NioUI() string source = Nio::getSource(); int midival = 0; for(set<string>::iterator itr = midiList.begin(); - itr != midiList.end(); ++itr) { + itr != midiList.end(); ++itr) { midi->add(itr->c_str()); if(*itr == source) midival = midi->size() - 2; @@ -46,7 +46,7 @@ NioUI::NioUI() string sink = Nio::getSink(); int audioval = 0; for(set<string>::iterator itr = audioList.begin(); - itr != audioList.end(); ++itr) { + itr != audioList.end(); ++itr) { audio->add(itr->c_str()); if(*itr == sink) audioval = audio->size() - 2; diff --git a/src/UI/WidgetPDial.cpp b/src/UI/WidgetPDial.cpp @@ -81,7 +81,7 @@ void TipWin::redraw() { // Recalc size of window fl_font(labelfont(), labelsize()); - int W=0, H=0; + int W = 0, H = 0; fl_measure(getStr(), W, H, 0); //provide a bit of extra space W += 8; diff --git a/src/globals.h b/src/globals.h @@ -156,12 +156,12 @@ #define ZERO(data, size) {char *data_ = (char *) data; for(int i = 0; \ i < size; \ i++) \ - data_[i] = 0;} + data_[i] = 0; } #define ZERO_float(data, size) {float *data_ = (float *) data; \ for(int i = 0; \ i < size; \ i++) \ - data_[i] = 0.0f;} + data_[i] = 0.0f; } enum ONOFFTYPE { OFF = 0, ON = 1 @@ -169,8 +169,8 @@ enum ONOFFTYPE { enum MidiControllers { C_bankselectmsb = 0, C_pitchwheel = 1000, C_NULL = 1001, - C_expression = 11, C_panning = 10, C_bankselectlsb = 32, - C_filtercutoff = 74, C_filterq = 71, C_bandwidth = 75, C_modwheel = 1, + C_expression = 11, C_panning = 10, C_bankselectlsb = 32, + C_filtercutoff = 74, C_filterq = 71, C_bandwidth = 75, C_modwheel = 1, C_fmamp = 76, C_volume = 7, C_sustain = 64, C_allnotesoff = 123, C_allsoundsoff = 120, C_resetallcontrollers = 121, @@ -201,8 +201,7 @@ enum LegatoMsg { #endif //temporary include for synth->{samplerate/buffersize} members -struct SYNTH_T -{ +struct SYNTH_T { SYNTH_T(void) :samplerate(44100), buffersize(256), oscilsize(1024) { @@ -220,14 +219,14 @@ struct SYNTH_T * If you increase this you'll ecounter big latencies, but if you * decrease this the CPU requirements gets high. */ - int buffersize; + int buffersize; /** * The size of ADnote Oscillator * Decrease this => poor quality * Increase this => CPU requirements gets high (only at start of the note) */ - int oscilsize; + int oscilsize; //Alias for above terms float samplerate_f; @@ -239,9 +238,9 @@ struct SYNTH_T inline void alias(void) { halfsamplerate_f = (samplerate_f = samplerate) / 2.0f; - buffersize_f = buffersize; - bufferbytes = buffersize * sizeof(float); - oscilsize_f = oscilsize; + buffersize_f = buffersize; + bufferbytes = buffersize * sizeof(float); + oscilsize_f = oscilsize; } float numRandom(void) const; //defined in Util.cpp for now }; diff --git a/src/main.cpp b/src/main.cpp @@ -97,8 +97,8 @@ void initprogram(int argc, char **argv) cerr << std::fixed; cerr << "\nSample Rate = \t\t" << synth->samplerate << endl; cerr << "Sound Buffer Size = \t" << synth->buffersize << " samples" << endl; - cerr << "Internal latency = \t" << synth->buffersize_f * 1000.0f / - synth->samplerate_f << " ms" << endl; + cerr << "Internal latency = \t" << synth->buffersize_f * 1000.0f + / synth->samplerate_f << " ms" << endl; cerr << "ADsynth Oscil.Size = \t" << synth->oscilsize << " samples" << endl; @@ -124,11 +124,11 @@ void exitprogram() delete ui; #endif #if LASH - if ( lash ) + if(lash) delete lash; #endif #if USE_NSM - if ( nsm ) + if(nsm) delete nsm; #endif @@ -142,8 +142,8 @@ int main(int argc, char *argv[]) dump.startnow(); int noui = 0; cerr - << "\nZynAddSubFX - Copyright (c) 2002-2011 Nasca Octavian Paul and others" - << endl; + << "\nZynAddSubFX - Copyright (c) 2002-2011 Nasca Octavian Paul and others" + << endl; cerr << "Compiled: " << __DATE__ << " " << __TIME__ << endl; cerr << "This program is free software (GNU GPL v.2 or later) and \n"; cerr << "it comes with ABSOLUTELY NO WARRANTY.\n" << endl; @@ -154,7 +154,7 @@ int main(int argc, char *argv[]) synth->samplerate = config.cfg.SampleRate; synth->buffersize = config.cfg.SoundBufferSize; synth->oscilsize = config.cfg.OscilSize; - swaplr = config.cfg.SwapStereo; + swaplr = config.cfg.SwapStereo; Nio::preferedSampleRate(synth->samplerate); @@ -195,7 +195,7 @@ int main(int argc, char *argv[]) "help", 2, NULL, 'h' }, { - "version",2,NULL,'v' + "version", 2, NULL, 'v' }, { "named", 1, NULL, 'N' @@ -232,10 +232,10 @@ int main(int argc, char *argv[]) &option_index); char *optarguments = optarg; -#define GETOP(x) if(optarguments) \ - x = optarguments -#define GETOPNUM(x) if(optarguments) \ - x = atoi(optarguments) +#define GETOP(x) if(optarguments) \ + x = optarguments +#define GETOPNUM(x) if(optarguments) \ + x = atoi(optarguments) if(opt == -1) @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) case 'v': exitwithversion = 1; break; - case 'Y':/* this command a dummy command (has NO effect) + case 'Y': /* this command a dummy command (has NO effect) and is used because I need for NSIS installer (NSIS sometimes forces a command line for a program, even if I don't need that; eg. when @@ -286,12 +286,13 @@ int main(int argc, char *argv[]) if(synth->oscilsize < MAX_AD_HARMONICS * 2) synth->oscilsize = MAX_AD_HARMONICS * 2; synth->oscilsize = - (int) powf(2, ceil(logf(synth->oscilsize - 1.0f) / logf(2.0f))); + (int) powf(2, + ceil(logf(synth->oscilsize - 1.0f) / logf(2.0f))); if(tmp != synth->oscilsize) cerr - << - "synth->oscilsize is wrong (must be 2^n) or too small. Adjusting to " - << synth->oscilsize << "." << endl; + << + "synth->oscilsize is wrong (must be 2^n) or too small. Adjusting to " + << synth->oscilsize << "." << endl; break; case 'S': swaplr = 1; @@ -337,12 +338,12 @@ int main(int argc, char *argv[]) << " -L file, --load-instrument=FILE\t Loads a .xiz file\n" << " -r SR, --sample-rate=SR\t\t Set the sample rate SR\n" << - " -b BS, --buffer-size=SR\t\t Set the buffer size (granularity)\n" + " -b BS, --buffer-size=SR\t\t Set the buffer size (granularity)\n" << " -o OS, --oscil-size=OS\t\t Set the ADsynth oscil. size\n" << " -S , --swap\t\t\t\t Swap Left <--> Right\n" << " -D , --dump\t\t\t\t Dumps midi note ON/OFF commands\n" << - " -U , --no-gui\t\t\t\t Run ZynAddSubFX without user interface\n" + " -U , --no-gui\t\t\t\t Run ZynAddSubFX without user interface\n" << " -N , --named\t\t\t\t Postfix IO Name when possible\n" << " -a , --auto-connect\t\t\t AutoConnect when using JACK\n" << " -O , --output\t\t\t\t Set Output Engine\n" @@ -401,30 +402,26 @@ int main(int argc, char *argv[]) #ifndef DISABLE_GUI ui = new MasterUI(master, &Pexitprogram); - if(!noui) - { + if(!noui) { ui->showUI(); if(!ioGood) - fl_alert("Default IO did not initialize.\nDefaulting to NULL backend."); + fl_alert( + "Default IO did not initialize.\nDefaulting to NULL backend."); } #endif #ifndef DISABLE_GUI #if USE_NSM - char *nsm_url = getenv( "NSM_URL" ); + char *nsm_url = getenv("NSM_URL"); - if ( nsm_url ) - { + if(nsm_url) { nsm = new NSM_Client; - if ( ! nsm->init( nsm_url ) ) - { - nsm->announce( "ZynAddSubFX", ":switch:", argv[0] ); - } - else - { + if(!nsm->init(nsm_url)) + nsm->announce("ZynAddSubFX", ":switch:", argv[0]); + else { delete nsm; nsm = NULL; } @@ -433,26 +430,24 @@ int main(int argc, char *argv[]) #endif #if USE_NSM - if ( ! nsm ) + if(!nsm) #endif { #if LASH - lash = new LASHClient(&argc, &argv); + lash = new LASHClient(&argc, &argv); #ifndef DISABLE_GUI - ui->sm_indicator1->value(1); - ui->sm_indicator2->value(1); - ui->sm_indicator1->tooltip( "LASH" ); - ui->sm_indicator2->tooltip( "LASH" ); + ui->sm_indicator1->value(1); + ui->sm_indicator2->value(1); + ui->sm_indicator1->tooltip("LASH"); + ui->sm_indicator2->tooltip("LASH"); #endif #endif } - while(Pexitprogram == 0) - { + while(Pexitprogram == 0) { #ifndef DISABLE_GUI #if USE_NSM - if ( nsm ) - { + if(nsm) { nsm->check(); goto done; } @@ -477,7 +472,7 @@ int main(int argc, char *argv[]) } #endif //LASH - done: +done: Fl::wait(0.1f); #else diff --git a/style.sh b/style.sh @@ -1,3 +1,6 @@ #!/bin/sh uncrustify -c style.cfg --no-backup -l CPP `find . | grep -e "\.h$"` uncrustify -c style.cfg --no-backup -l CPP `find . | grep -e "\.cpp$"` +#cover nsm code +uncrustify -c style.cfg --no-backup -l CPP `find . | grep -e "\.H$"` +uncrustify -c style.cfg --no-backup -l CPP `find . | grep -e "\.C$"`