aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-13 16:04:14 +0000
committerDavid Robillard <d@drobilla.net>2009-05-13 16:04:14 +0000
commite39cbfb9dcf0c00133945eab186072274b45358a (patch)
tree646d496e9bb964ead2ec493e976b01f4de115590 /src
parentc74440a8ae0169010167befafd80d44e23805f6b (diff)
downloadmda.lv2-e39cbfb9dcf0c00133945eab186072274b45358a.tar.gz
mda.lv2-e39cbfb9dcf0c00133945eab186072274b45358a.tar.bz2
mda.lv2-e39cbfb9dcf0c00133945eab186072274b45358a.zip
Strip trailing whitespace.
git-svn-id: http://svn.drobilla.net/lad/trunk/mda-lv2@1999 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/mdaAmbience.cpp38
-rw-r--r--src/mdaBandisto.cpp88
-rw-r--r--src/mdaBeatBox.cpp138
-rw-r--r--src/mdaCombo.cpp110
-rw-r--r--src/mdaDX10.cpp78
-rw-r--r--src/mdaDX10.h8
-rw-r--r--src/mdaDeEss.cpp42
-rw-r--r--src/mdaDegrade.cpp62
-rw-r--r--src/mdaDelay.cpp52
-rw-r--r--src/mdaDetune.cpp12
-rw-r--r--src/mdaDither.cpp50
-rw-r--r--src/mdaDubDelay.cpp64
-rw-r--r--src/mdaDynamics.cpp86
-rw-r--r--src/mdaEPiano.cpp130
-rw-r--r--src/mdaEPiano.h2
-rw-r--r--src/mdaImage.cpp46
-rw-r--r--src/mdaLeslie.cpp112
-rw-r--r--src/mdaLeslie.h10
-rw-r--r--src/mdaLimiter.cpp50
-rw-r--r--src/mdaLooplex.cpp70
-rw-r--r--src/mdaLooplex.h4
-rw-r--r--src/mdaLoudness.cpp20
-rw-r--r--src/mdaMultiBand.cpp110
-rw-r--r--src/mdaOverdrive.cpp50
-rw-r--r--src/mdaPiano.cpp72
-rw-r--r--src/mdaPiano.h4
-rw-r--r--src/mdaRePsycho.cpp112
-rw-r--r--src/mdaRezFilter.cpp100
-rw-r--r--src/mdaRingMod.cpp36
-rw-r--r--src/mdaRoundPan.cpp38
-rw-r--r--src/mdaShepard.cpp72
-rw-r--r--src/mdaSpecMeterGUI.cpp12
-rw-r--r--src/mdaSplitter.cpp20
-rw-r--r--src/mdaStereo.cpp68
-rw-r--r--src/mdaTalkBox.cpp48
-rw-r--r--src/mdaTestTone.cpp146
-rw-r--r--src/mdaTestTone.h2
-rw-r--r--src/mdaThruZero.cpp42
-rw-r--r--src/mdaTracker.cpp106
-rw-r--r--src/mdaTransient.cpp66
-rw-r--r--src/mdaVocInput.cpp38
-rw-r--r--src/mdaVocoder.cpp72
42 files changed, 1243 insertions, 1243 deletions
diff --git a/src/mdaAmbience.cpp b/src/mdaAmbience.cpp
index f70809e..5794046 100644
--- a/src/mdaAmbience.cpp
+++ b/src/mdaAmbience.cpp
@@ -26,14 +26,14 @@ mdaAmbience::mdaAmbience(audioMasterCallback audioMaster) : AudioEffectX(audioMa
fil = 0.0f;
den = pos=0;
-
- setNumInputs(2);
- setNumOutputs(2);
+
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaAmb"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Small Space Ambience");
-
+
suspend(); // flush buffer
setParameter(0, 0.7f); //go and set initial values!
}
@@ -41,7 +41,7 @@ mdaAmbience::mdaAmbience(audioMasterCallback audioMaster) : AudioEffectX(audioMa
void mdaAmbience::setParameter(LvzInt32 index, float value)
{
float tmp;
-
+
switch(index)
{
case 0: fParam0 = value; break;
@@ -54,7 +54,7 @@ void mdaAmbience::setParameter(LvzInt32 index, float value)
damp = 0.05f + 0.9f * fParam1;
tmp = (float)pow(10.0f, 2.0f * fParam3 - 1.0f);
dry = tmp - fParam2 * fParam2 * tmp;
- wet = (0.4f + 0.4f) * fParam2 * tmp;
+ wet = (0.4f + 0.4f) * fParam2 * tmp;
tmp = 0.025f + 2.665f * fParam0;
if(size!=tmp) rdy=0; //need to flush buffer
@@ -148,7 +148,7 @@ void mdaAmbience::process(float **inputs, float **outputs, LvzInt32 sampleFrames
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d, r;
+ float a, b, c, d, r;
float t, f=fil, fb=fbak, dmp=damp, y=dry, w=wet;
long p=pos, d1, d2, d3, d4;
@@ -159,14 +159,14 @@ void mdaAmbience::process(float **inputs, float **outputs, LvzInt32 sampleFrames
d3 = (p + (long)(277 * size)) & 1023;
d4 = (p + (long)(379 * size)) & 1023;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
-
+
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
c = out1[1];
d = out2[1]; //process from here...
@@ -183,7 +183,7 @@ void mdaAmbience::process(float **inputs, float **outputs, LvzInt32 sampleFrames
r -= fb * t;
*(buf2 + d2) = r; //allpass
r += t;
-
+
t = *(buf3 + p);
r -= fb * t;
*(buf3 + d3) = r; //allpass
@@ -216,7 +216,7 @@ void mdaAmbience::processReplacing(float **inputs, float **outputs, LvzInt32 sam
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, r;
+ float a, b, r;
float t, f=fil, fb=fbak, dmp=damp, y=dry, w=wet;
long p=pos, d1, d2, d3, d4;
@@ -227,8 +227,8 @@ void mdaAmbience::processReplacing(float **inputs, float **outputs, LvzInt32 sam
d3 = (p + (long)(277 * size)) & 1023;
d4 = (p + (long)(379 * size)) & 1023;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
@@ -249,7 +249,7 @@ void mdaAmbience::processReplacing(float **inputs, float **outputs, LvzInt32 sam
r -= fb * t;
*(buf2 + d2) = r; //allpass
r += t;
-
+
t = *(buf3 + p);
r -= fb * t;
*(buf3 + d3) = r; //allpass
@@ -273,5 +273,5 @@ void mdaAmbience::processReplacing(float **inputs, float **outputs, LvzInt32 sam
}
pos=p;
if(fabs(f)>1.0e-10) { fil=f; den=0; } //catch denormals
- else { fil=0.0f; if(den==0) { den=1; suspend(); } }
+ else { fil=0.0f; if(den==0) { den=1; suspend(); } }
}
diff --git a/src/mdaBandisto.cpp b/src/mdaBandisto.cpp
index 2da3d9a..c4e4cee 100644
--- a/src/mdaBandisto.cpp
+++ b/src/mdaBandisto.cpp
@@ -23,11 +23,11 @@ mdaBandisto::mdaBandisto(audioMasterCallback audioMaster) : AudioEffectX(audioMa
fParam9 = (float)0.50; //H trim
fParam10 = (float)0.4; //transistor/valve
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaBand"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Multi-Band Distortion");
//calcs here!
@@ -36,17 +36,17 @@ mdaBandisto::mdaBandisto(audioMasterCallback audioMaster) : AudioEffectX(audioMa
driv3 = (float)pow(10.0,(6.0 * fParam6 *fParam6) - 1.0);
valve = int(1.99 * fParam10);
- if(valve)
+ if(valve)
{
- trim1 = (float)(0.5);
- trim2 = (float)(0.5);
- trim3 = (float)(0.5);
+ trim1 = (float)(0.5);
+ trim2 = (float)(0.5);
+ trim3 = (float)(0.5);
}
else
{
- trim1 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam4,3.f)));//(0.5 + 500.0 * pow(fParam4,6.0));
- trim2 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam5,3.f)));
- trim3 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam6,3.f)));
+ trim1 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam4,3.f)));//(0.5 + 500.0 * pow(fParam4,6.0));
+ trim2 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam5,3.f)));
+ trim3 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam6,3.f)));
}
trim1 = (float)(trim1 * pow(10.0, 2.0 * fParam7 - 1.0));
trim2 = (float)(trim2 * pow(10.0, 2.0 * fParam8 - 1.0));
@@ -65,7 +65,7 @@ mdaBandisto::mdaBandisto(audioMasterCallback audioMaster) : AudioEffectX(audioMa
mdaBandisto::~mdaBandisto()
{
-
+
}
bool mdaBandisto::getProductString(char* text) { strcpy(text, "MDA Bandisto"); return true; }
@@ -103,17 +103,17 @@ void mdaBandisto::setParameter(LvzInt32 index, float value)
driv3 = (float)pow(10.0,(6.0 * fParam6 *fParam6) - 1.0);
valve = int(1.99 * fParam10);
- if(valve)
+ if(valve)
{
- trim1 = (float)(0.5);
- trim2 = (float)(0.5);
- trim3 = (float)(0.5);
+ trim1 = (float)(0.5);
+ trim2 = (float)(0.5);
+ trim3 = (float)(0.5);
}
else
{
- trim1 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam4,3.f)));//(0.5 + 500.0 * pow(fParam4,6.0));
- trim2 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam5,3.f)));
- trim3 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam6,3.f)));
+ trim1 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam4,3.f)));//(0.5 + 500.0 * pow(fParam4,6.0));
+ trim2 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam5,3.f)));
+ trim3 = 0.3f*(float)pow(10.0,(4.0 * pow(fParam6,3.f)));
}
trim1 = (float)(trim1 * pow(10.0, 2.0 * fParam7 - 1.0));
trim2 = (float)(trim2 * pow(10.0, 2.0 * fParam8 - 1.0));
@@ -174,7 +174,7 @@ void mdaBandisto::getParameterDisplay(LvzInt32 index, char *text)
case 0: switch(int(fParam1*5.0))
{ case 0: strcpy(text, "Low"); break;
case 1: strcpy(text, "Mid"); break;
- case 2: strcpy(text, "High"); break;
+ case 2: strcpy(text, "High"); break;
default: strcpy(text, "Output"); break; } break;
case 1: sprintf(text, "%.0f", getSampleRate() * fi1 * (0.098 + 0.09*fi1 + 0.5*pow(fi1,8.2f))); break;
case 2: sprintf(text, "%.0f", getSampleRate() * fi2 * (0.015 + 0.15*fi2 + 0.9*pow(fi2,8.2f))); break;
@@ -184,7 +184,7 @@ void mdaBandisto::getParameterDisplay(LvzInt32 index, char *text)
case 6: sprintf(text, "%.0f", 40.0 * fParam7 - 20.0); break;
case 7: sprintf(text, "%.0f", 40.0 * fParam8 - 20.0); break;
case 8: sprintf(text, "%.0f", 40.0 * fParam9 - 20.0); break;
- case 9: if(fParam10>0.5) { strcpy(text, "Unipolar"); }
+ case 9: if(fParam10>0.5) { strcpy(text, "Unipolar"); }
else { strcpy(text, "Bipolar"); } break;
}
}
@@ -195,14 +195,14 @@ void mdaBandisto::getParameterLabel(LvzInt32 index, char *label)
{
case 0: strcpy(label, ""); break;
case 1: strcpy(label, "Hz"); break;
- case 2: strcpy(label, "Hz"); break;
- case 3: strcpy(label, "dB"); break;
- case 4: strcpy(label, "dB"); break;
- case 5: strcpy(label, "dB"); break;
- case 6: strcpy(label, "dB"); break;
- case 7: strcpy(label, "dB"); break;
- case 8: strcpy(label, "dB"); break;
- case 9: strcpy(label, ""); break;
+ case 2: strcpy(label, "Hz"); break;
+ case 3: strcpy(label, "dB"); break;
+ case 4: strcpy(label, "dB"); break;
+ case 5: strcpy(label, "dB"); break;
+ case 6: strcpy(label, "dB"); break;
+ case 7: strcpy(label, "dB"); break;
+ case 8: strcpy(label, "dB"); break;
+ case 9: strcpy(label, ""); break;
}
}
@@ -215,28 +215,28 @@ void mdaBandisto::process(float **inputs, float **outputs, LvzInt32 sampleFrames
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d, g, l=fb3, m, h, s, sl=slev;
+ float a, b, c, d, g, l=fb3, m, h, s, sl=slev;
float f1i=fi1, f1o=fo1, f2i=fi2, f2o=fo2, b1=fb1, b2=fb2;
float g1, d1=driv1, t1=trim1;
float g2, d2=driv2, t2=trim2;
float g3, d3=driv3, t3=trim3;
int v=valve;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
c = out1[1];
d = out2[1]; //process from here...
s = (a - b) * sl; //keep stereo component for later
- a += (float)(b + 0.00002); //dope filter at low level
+ a += (float)(b + 0.00002); //dope filter at low level
b2 = (f2i * a) + (f2o * b2); //crossovers
- b1 = (f1i * b2) + (f1o * b1);
+ b1 = (f1i * b2) + (f1o * b1);
l = (f1i * b1) + (f1o * l);
m=b2-l; h=a-b2;
@@ -257,8 +257,8 @@ void mdaBandisto::process(float **inputs, float **outputs, LvzInt32 sampleFrames
a = (l*g1*t1) + (m*g2*t2) + (h*g3*t3);
c += a + s; // output
d += a - s;
-
- *++out1 = c;
+
+ *++out1 = c;
*++out2 = d;
}
fb1=b1; fb2=b2, fb3=l;
@@ -270,26 +270,26 @@ void mdaBandisto::processReplacing(float **inputs, float **outputs, LvzInt32 sam
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d, g, l=fb3, m, h, s, sl=slev;
+ float a, b, c, d, g, l=fb3, m, h, s, sl=slev;
float f1i=fi1, f1o=fo1, f2i=fi2, f2o=fo2, b1=fb1, b2=fb2;
float g1, d1=driv1, t1=trim1;
float g2, d2=driv2, t2=trim2;
float g3, d3=driv3, t3=trim3;
int v=valve;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2; //process from here...
-
+
s = (a - b) * sl; //keep stereo component for later
a += (float)(b + 0.00002); //dope filter at low level
b2 = (f2i * a) + (f2o * b2); //crossovers
- b1 = (f1i * b2) + (f1o * b1);
+ b1 = (f1i * b2) + (f1o * b1);
l = (f1i * b1) + (f1o * l);
m=b2-l; h=a-b2;
@@ -310,7 +310,7 @@ void mdaBandisto::processReplacing(float **inputs, float **outputs, LvzInt32 sam
a = (l*g1*t1) + (m*g2*t2) + (h*g3*t3);
c = a + s; // output
d = a - s;
-
+
*++out1 = c;
*++out2 = d;
}
diff --git a/src/mdaBeatBox.cpp b/src/mdaBeatBox.cpp
index a4ca550..69ac090 100644
--- a/src/mdaBeatBox.cpp
+++ b/src/mdaBeatBox.cpp
@@ -13,14 +13,14 @@ mdaBeatBox::mdaBeatBox(audioMasterCallback audioMaster) : AudioEffectX(audioMast
fParam1 = 0.30f; //hat thresh
fParam2 = 0.45f; //hat rate
fParam3 = 0.50f; //hat mix
- fParam4 = 0.46f; //kick thresh
+ fParam4 = 0.46f; //kick thresh
fParam5 = 0.15f; //kick key
fParam6 = 0.50f; //kick mix
fParam7 = 0.50f; //snare thresh
fParam8 = 0.70f; //snare key
fParam9 = 0.50f; //snare mix
fParam10 = 0.00f; //dynamics
- fParam11 = 0.00f; //record
+ fParam11 = 0.00f; //record
fParam12 = 0.00f; //thru mix
hbuflen = 20000;
@@ -35,7 +35,7 @@ mdaBeatBox::mdaBeatBox(audioMasterCallback audioMaster) : AudioEffectX(audioMast
setNumInputs(2); // stereo in
setNumOutputs(2); // stereo out
setUniqueID("mdaBBox"); // identify
- DECLARE_LVZ_DEPRECATED(canMono) ();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
canProcessReplacing(); // supports both accumulating and replacing output
strcpy(programName, "BeatBox - Drum Replacer"); // default program name
synth();
@@ -51,7 +51,7 @@ mdaBeatBox::mdaBeatBox(audioMasterCallback audioMaster) : AudioEffectX(audioMast
hlev = (float)(0.0001f + fParam3 * fParam3 * 4.f);
klev = (float)(0.0001f + fParam6 * fParam6 * 4.f);
slev = (float)(0.0001f + fParam9 * fParam9 * 4.f);
-
+
kww = (float)pow(10.0,-3.0 + 2.2 * fParam5);
ksf1 = (float)cos(3.1415927 * kww); //p
ksf2 = (float)sin(3.1415927 * kww); //q
@@ -109,7 +109,7 @@ void mdaBeatBox::setParameter(LvzInt32 index, float value)
hlev = (float)(0.0001f + fParam3 * fParam3 * 4.f);
klev = (float)(0.0001f + fParam6 * fParam6 * 4.f);
slev = (float)(0.0001f + fParam9 * fParam9 * 4.f);
-
+
wwx=ww;
ww = (float)pow(10.0,-3.0 + 2.2 * fParam8);
sf1 = (float)cos(3.1415927 * ww); //p
@@ -121,17 +121,17 @@ void mdaBeatBox::setParameter(LvzInt32 index, float value)
ksf1 = (float)cos(3.1415927 * kww); //p
ksf2 = (float)sin(3.1415927 * kww); //q
- if(wwx != ww) sfx = (long)(2 * getSampleRate());
+ if(wwx != ww) sfx = (long)(2 * getSampleRate());
if(kwwx != kww) ksfx = (long)(2 * getSampleRate());
-
- rec = (long)(4.9 * fParam11);
+
+ rec = (long)(4.9 * fParam11);
if ((rec!=recx) && (recpos>0)) //finish sample
{
switch(rec)
{
case 2: while(recpos<hbuflen) *(hbuf + recpos++) = 0.f; break;
case 3: while(recpos<kbuflen) *(kbuf + recpos++) = 0.f; break;
- case 4: while(recpos<sbuflen) { *(sbuf + recpos) = 0.f;
+ case 4: while(recpos<sbuflen) { *(sbuf + recpos) = 0.f;
*(sbuf2 + recpos) = 0.f; recpos++; } break;
}
}
@@ -154,34 +154,34 @@ void mdaBeatBox::suspend()
void mdaBeatBox::synth()
{
- long t;
- float e=0.00012f, de, o, o1=0.f, o2=0.f, p=0.2f, dp;
+ long t;
+ float e=0.00012f, de, o, o1=0.f, o2=0.f, p=0.2f, dp;
memset(hbuf, 0, hbuflen * sizeof(float)); //generate hi-hat
de = (float)pow(10.0,-36.0/getSampleRate());
- for(t=0;t<5000;t++)
- {
- o = (float)((rand() % 2000) - 1000);
- *(hbuf + t) = e * ( 2.f * o1 - o2 - o);
+ for(t=0;t<5000;t++)
+ {
+ o = (float)((rand() % 2000) - 1000);
+ *(hbuf + t) = e * ( 2.f * o1 - o2 - o);
e *= de; o2=o1; o1=o;
}
memset(kbuf, 0, kbuflen * sizeof(float)); //generate kick
de = (float)pow(10.0,-3.8/getSampleRate());
e=0.5f; dp = 1588.f / getSampleRate();
- for(t=0;t<14000;t++)
- {
- *(kbuf + t) = e * (float)sin(p);
+ for(t=0;t<14000;t++)
+ {
+ *(kbuf + t) = e * (float)sin(p);
e *= de; p = (float)fmod(p + dp * e ,6.2831853f);
}
memset(sbuf, 0, sbuflen * sizeof(float)); //generate snare
de = (float)pow(10.0,-15.0/getSampleRate());
e=0.38f; dp = 1103.f / getSampleRate();
- for(t=0;t<7000;t++)
- {
- o = (0.3f * o) + (float)((rand() % 2000) - 1000);
- *(sbuf + t) = (float)(e * (sin(p) + 0.0004 * o));
+ for(t=0;t<7000;t++)
+ {
+ o = (0.3f * o) + (float)((rand() % 2000) - 1000);
+ *(sbuf + t) = (float)(e * (sin(p) + 0.0004 * o));
*(sbuf2 + t) = *(sbuf + t);
e *= de; p = (float)fmod(p + 0.025,6.2831853);
}
@@ -245,10 +245,10 @@ void mdaBeatBox::getParameterDisplay(LvzInt32 index, char *text)
case 6: float2strng((float)(40.0*fParam7 - 40.0),text); break;
case 7: long2string((long)(0.5 * ww * getSampleRate()), text); break;
case 8: long2string((long)(20.f * log10(slev)),text); break;
- case 9: long2string((long)(100.f * fParam10),text); break;
+ case 9: long2string((long)(100.f * fParam10),text); break;
case 11: long2string((long)(20.f * log10(fParam12)),text); break;
- case 10: switch(rec)
+ case 10: switch(rec)
{ case 0: strcpy(text, "-"); break;
case 1: strcpy(text, "MONITOR"); break;
case 2: strcpy(text, "-> HAT"); break;
@@ -263,16 +263,16 @@ void mdaBeatBox::getParameterLabel(LvzInt32 index, char *label)
{
case 0: strcpy(label, "dB"); break;
case 1: strcpy(label, "ms"); break;
- case 2: strcpy(label, "dB"); break;
- case 3: strcpy(label, "dB"); break;
- case 4: strcpy(label, "Hz"); break;
- case 5: strcpy(label, "dB"); break;
- case 6: strcpy(label, "dB"); break;
+ case 2: strcpy(label, "dB"); break;
+ case 3: strcpy(label, "dB"); break;
+ case 4: strcpy(label, "Hz"); break;
+ case 5: strcpy(label, "dB"); break;
+ case 6: strcpy(label, "dB"); break;
case 7: strcpy(label, "Hz"); break;
case 8: strcpy(label, "dB"); break;
- case 9: strcpy(label, "%"); break;
- case 10:strcpy(label, ""); break;
- case 11:strcpy(label, "dB"); break;
+ case 9: strcpy(label, "%"); break;
+ case 10:strcpy(label, ""); break;
+ case 11:strcpy(label, "dB"); break;
}
}
@@ -288,19 +288,19 @@ void mdaBeatBox::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float a, b, c, d, e, o, hf=hfil, ht=hthr, mx3=0.f, mx1=mix;
long hp=hbufpos, hl=hbuflen-2, hd=hdel;
float kt=kthr;
- long kp=kbufpos, kl=kbuflen-2, kd=kdel;
+ long kp=kbufpos, kl=kbuflen-2, kd=kdel;
float st=sthr, s, f1=sb1, f2=sb2, b1=sf1, b2=sf2, b3=sf3;
float k, kf1=ksb1, kf2=ksb2, kb1=ksf1, kb2=ksf2;
- float hlv=hlev, klv=klev, slv=slev;
- long sp=sbufpos, sl=sbuflen-2, sd=sdel;
+ float hlv=hlev, klv=klev, slv=slev;
+ long sp=sbufpos, sl=sbuflen-2, sd=sdel;
float ya=dyna, yr=dynr, ye=dyne, ym=dynm, mx4;
-
+
if(sfx>0) { mx3=0.08f; slv=0.f; klv=0.f; hlv=0.f; mx1=0.f; sfx-=sampleFrames;} //key listen (snare)
if(ksfx>0) { mx3=0.03f; slv=0.f; klv=0.f; hlv=0.f; mx1=0.f; ksfx-=sampleFrames;
b1=ksf1; b2=ksf2; } //key listen (kick)
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
@@ -311,7 +311,7 @@ void mdaBeatBox::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
a = *++in1; //input
b = *++in2;
e = a + b;
-
+
ye = (e<ye)? ye * yr : e - ya * (e - ye); //dynamics envelope
hf = e - hf; //high
@@ -319,13 +319,13 @@ void mdaBeatBox::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
o = hlv * *(hbuf + hp);
k = e + (kf1 * kb1) - (kf2 * kb2);
- kf2 = b3 * ((kf1 * kb2) + (kf2 * kb1));
+ kf2 = b3 * ((kf1 * kb2) + (kf2 * kb1));
kf1 = b3 * k;
if((kp>kd) && (k>kt)) kp=0; else { kp++; if(kp>kl)kp=kl; }
o += klv * *(kbuf + kp);
-
+
s = hf + (0.3f * e) + (f1 * b1) - (f2 * b2);
- f2 = b3 * ((f1 * b2) + (f2 * b1));
+ f2 = b3 * ((f1 * b2) + (f2 * b1));
f1 = b3 * s;
if((sp>sd) && (s>st)) sp=0; else { sp++; if(sp>sl)sp=sl; }
@@ -334,8 +334,8 @@ void mdaBeatBox::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
c = out1[1] + mx1*a + mx3*s + mx4*(o + slv * *(sbuf + sp));
d = out2[1] + mx1*b + mx3*s + mx4*(o + slv * *(sbuf2 + sp));
- *++out1 = c;
- *++out2 = d;
+ *++out1 = c;
+ *++out2 = d;
hf=e;
}
@@ -344,28 +344,28 @@ void mdaBeatBox::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
{
while(--sampleFrames >= 0)
{
-
+
a = *++in1;
b = *++in2;
e = 0.5f * (a + b);
if((recpos==0) && (fabs(e) < 0.004)) e=0.f;
- else
- {
+ else
+ {
switch(rec)
{
case 1: break; //echo
case 2: if(recpos<hl) *(hbuf + recpos++) = e; else e=0.f; break;
case 3: if(recpos<kl) *(kbuf + recpos++) = e; else e=0.f; break;
- case 4: if(recpos<sl)
+ case 4: if(recpos<sl)
{ *(sbuf+recpos)=a; *(sbuf2+recpos)=b; recpos++; }
else e=0.f; break;
}
}
c = out1[1] + e;
d = out2[1] + e;
- *++out1 = c;
- *++out2 = d;
+ *++out1 = c;
+ *++out2 = d;
}
}
hfil=hf; hbufpos=hp;
@@ -383,19 +383,19 @@ void mdaBeatBox::processReplacing(float **inputs, float **outputs, LvzInt32 samp
float a, b, e, o, hf=hfil, ht=hthr, mx3=0.f, mx1=mix;
long hp=hbufpos, hl=hbuflen-2, hd=hdel;
float kt=kthr;
- long kp=kbufpos, kl=kbuflen-2, kd=kdel;
+ long kp=kbufpos, kl=kbuflen-2, kd=kdel;
float st=sthr, s, f1=sb1, f2=sb2, b1=sf1, b2=sf2, b3=sf3;
float k, kf1=ksb1, kf2=ksb2, kb1=ksf1, kb2=ksf2;
- float hlv=hlev, klv=klev, slv=slev;
- long sp=sbufpos, sl=sbuflen-2, sd=sdel;
+ float hlv=hlev, klv=klev, slv=slev;
+ long sp=sbufpos, sl=sbuflen-2, sd=sdel;
float ya=dyna, yr=dynr, ye=dyne, ym=dynm, mx4;
if(sfx>0) { mx3=0.08f; slv=0.f; klv=0.f; hlv=0.f; mx1=0.f; sfx-=sampleFrames;} //key listen (snare)
if(ksfx>0) { mx3=0.03f; slv=0.f; klv=0.f; hlv=0.f; mx1=0.f; ksfx-=sampleFrames;
b1=ksf1; b2=ksf2; } //key listen (kick)
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
@@ -406,29 +406,29 @@ void mdaBeatBox::processReplacing(float **inputs, float **outputs, LvzInt32 samp
a = *++in1;
b = *++in2;
e = a + b;
-
+
ye = (e<ye)? ye * yr : e - ya * (e - ye); //dynamics envelope
hf = e - hf; //high filter
if((hp>hd) && (hf>ht)) hp=0; else { hp++; if(hp>hl)hp=hl; }
o = hlv * *(hbuf + hp); //hat
-
+
k = e + (kf1 * kb1) - (kf2 * kb2); //low filter
- kf2 = b3 * ((kf1 * kb2) + (kf2 * kb1));
+ kf2 = b3 * ((kf1 * kb2) + (kf2 * kb1));
kf1 = b3 * k;
if((kp>kd) && (k>kt)) kp=0; else { kp++; if(kp>kl)kp=kl; }
o += klv * *(kbuf + kp); //kick
-
+
s = hf + (0.3f * e) + (f1 * b1) - (f2 * b2); //mid filter
- f2 = b3 * ((f1 * b2) + (f2 * b1));
+ f2 = b3 * ((f1 * b2) + (f2 * b1));
f1 = b3 * s;
if((sp>sd) && (s>st)) sp=0; else { sp++; if(sp>sl)sp=sl; }
-
+
mx4 = 1.f + ym * (ye + ye - 1.f); //dynamics
- *++out1 = mx1*a + mx3*s + mx4*(o + slv * *(sbuf + sp));
- *++out2 = mx1*a + mx3*s + mx4*(o + slv * *(sbuf2 + sp));
+ *++out1 = mx1*a + mx3*s + mx4*(o + slv * *(sbuf + sp));
+ *++out2 = mx1*a + mx3*s + mx4*(o + slv * *(sbuf2 + sp));
hf=e;
}
@@ -442,23 +442,23 @@ void mdaBeatBox::processReplacing(float **inputs, float **outputs, LvzInt32 samp
e = 0.5f * (a + b);
if((recpos==0) && (fabs(e) < 0.004)) e=0.f;
- else
- {
+ else
+ {
switch(rec)
{
case 1: break; //echo
case 2: if(recpos<hl) *(hbuf + recpos++) = e; else e=0.f; break;
case 3: if(recpos<kl) *(kbuf + recpos++) = e; else e=0.f; break;
- case 4: if(recpos<sl)
+ case 4: if(recpos<sl)
{ *(sbuf+recpos)=a; *(sbuf2+recpos)=b; recpos++; }
else e=0.f; break;
}
}
- *++out1 = e;
- *++out2 = e;
+ *++out1 = e;
+ *++out2 = e;
}
}
- hfil=hf; hbufpos=hp;
+ hfil=hf; hbufpos=hp;
sbufpos=sp; sb1 = f1; sb2 = f2;
kbufpos=kp; ksb1 = kf1; ksb2 = kf2;
dyne=ye;
diff --git a/src/mdaCombo.cpp b/src/mdaCombo.cpp
index c73fc15..b23c9b9 100644
--- a/src/mdaCombo.cpp
+++ b/src/mdaCombo.cpp
@@ -24,11 +24,11 @@ mdaCombo::mdaCombo(audioMasterCallback audioMaster) : AudioEffectX(audioMaster,
buffer = new float[size];
buffe2 = new float[size];
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaCombo"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Amp & Speaker Simulator");
suspend(); // flush buffer
@@ -58,49 +58,49 @@ void mdaCombo::setParameter(LvzInt32 index, float value)
{
case 0: trim = 0.5f; lpf = 0.f; //DI
mix1 = (float)0.0; mix2 = (float)0.0;
- del1 = 0; del2 = 0;
+ del1 = 0; del2 = 0;
break;
case 1: trim = 0.53f; lpf = filterFreq(2700.f); //speaker sim
mix1 = (float)0.0; mix2 = (float)0.0;
del1 = 0; del2 = 0;
- hpf = filterFreq(382.f);
+ hpf = filterFreq(382.f);
break;
case 2: trim = 1.10f; lpf = filterFreq(1685.f); //radio
- mix1 = -1.70f; mix2 = 0.82f;
+ mix1 = -1.70f; mix2 = 0.82f;
del1 = int(getSampleRate() / 6546.f);
- del2 = int(getSampleRate() / 4315.f);
+ del2 = int(getSampleRate() / 4315.f);
break;
case 3: trim = 0.98f; lpf = filterFreq(1385.f); //mesa boogie 1"
mix1 = -0.53f; mix2 = 0.21f;
del1 = int(getSampleRate() / 7345.f);
- del2 = int(getSampleRate() / 1193.f);
+ del2 = int(getSampleRate() / 1193.f);
break;
case 4: trim = 0.96f; lpf = filterFreq(1685.f); //mesa boogie 8"
- mix1 = -0.85f; mix2 = 0.41f;
+ mix1 = -0.85f; mix2 = 0.41f;
del1 = int(getSampleRate() / 6546.f);
- del2 = int(getSampleRate() / 3315.f);
+ del2 = int(getSampleRate() / 3315.f);
break;
-
- case 5: trim = 0.59f; lpf = lpf = filterFreq(2795.f);
+
+ case 5: trim = 0.59f; lpf = lpf = filterFreq(2795.f);
mix1 = -0.29f; mix2 = 0.38f; //Marshall 4x12" celestion
del1 = int(getSampleRate() / 982.f);
del2 = int(getSampleRate() / 2402.f);
- hpf = filterFreq(459.f);
+ hpf = filterFreq(459.f);
break;
-
- case 6: trim = 0.30f; lpf = filterFreq(1744.f); //scooped-out metal
- mix1 = -0.96f; mix2 = 1.6f;
+
+ case 6: trim = 0.30f; lpf = filterFreq(1744.f); //scooped-out metal
+ mix1 = -0.96f; mix2 = 1.6f;
del1 = int(getSampleRate() / 356.f);
del2 = int(getSampleRate() / 1263.f);
- hpf = filterFreq(382.f);
+ hpf = filterFreq(382.f);
break;
}
- mode = (fParam2<0.5)? 1 : 0;
+ mode = (fParam2<0.5)? 1 : 0;
if(mode) //soft clipping
{
drive = (float)pow(10.f, 2.f - 6.f * fParam2);
@@ -146,7 +146,7 @@ void mdaCombo::suspend()
float mdaCombo::filterFreq(float hz)
{
float j, k, r=0.999f;
-
+
j = r * r - 1;
k = (float)(2.f - 2.f * r * r * cos(0.647f * hz / getSampleRate() ));
return (float)((sqrt(k*k - 4.f*j*j) - k) / (2.f*j));
@@ -202,7 +202,7 @@ void mdaCombo::getParameterDisplay(LvzInt32 index, char *text)
switch(index)
{
case 0: switch(int(fParam1*6.9))
- {
+ {
case 0: strcpy(text, "D.I."); break;
case 1: strcpy(text, "Spkr Sim"); break;
//case 2: strcpy(text, "Phone"); break;
@@ -216,7 +216,7 @@ void mdaCombo::getParameterDisplay(LvzInt32 index, char *text)
case 1: long2string((long)(200 * fParam2 - 100), text); break;
case 2: long2string((long)(200 * fParam3 - 100), text); break;
case 3: long2string((long)(40 * fParam4 - 20), text); break;
- case 4: if(fParam5>0.5) strcpy(text, "STEREO");
+ case 4: if(fParam5>0.5) strcpy(text, "STEREO");
else strcpy(text, "MONO"); break;
case 5: long2string((long)(100 * fParam6), text); break;
case 6: long2string((long)(100 * fParam7), text); break;
@@ -246,7 +246,7 @@ void mdaCombo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d, trm, m1=mix1, m2=mix2, clp=clip;
+ float a, b, c, d, trm, m1=mix1, m2=mix2, clp=clip;
float o=lpf, i=1.f-lpf, o2=hpf, i2=1.f-hpf, bi=bias, drv=drive;
float f1=ff1, f2=ff2, f3=ff3, f4=ff4, f5=ff5;
float a2, b2, f6=ff6, f7=ff7, f8=ff8, f9=ff9, f10=ff10;
@@ -255,11 +255,11 @@ void mdaCombo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
trm = trim * i * i * i * i;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
-
+
if(fParam5>0.5) //stereo
{
while(--sampleFrames >= 0)
@@ -279,10 +279,10 @@ void mdaCombo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
b = (a<-clp)? -clp : b; b2 = (a2<-clp)? -clp : b2;
}
- *(buffer + bp) = b; *(buffe2 + bp) = b2;
+ *(buffer + bp) = b; *(buffe2 + bp) = b2;
b += (m1* *(buffer+((bp+d1)%1000))) + (m2* *(buffer+((bp+d2)%1000)));
b2+= (m1* *(buffe2+((bp+d1)%1000))) + (m2* *(buffe2+((bp+d2)%1000)));
-
+
f1 = o * f1 + trm * b; f6 = o * f6 + trm * b2;
f2 = o * f2 + f1; f7 = o * f7 + f6;
f3 = o * f3 + f2; f8 = o * f8 + f7;
@@ -293,7 +293,7 @@ void mdaCombo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
bp = (bp==0)? 999 : bp - 1; //buffer position
- *++out1 = c + b;
+ *++out1 = c + b;
*++out2 = d + b2;
bp=bufpos;
}
@@ -307,13 +307,13 @@ void mdaCombo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
a = drv * (*++in1 + *++in2 + bi);
c = out1[1];
d = out2[1]; //process from here...
-
+
b = (a>0.f)? a : -a;
b = a / (1.f + b);
- *(buffer + bp) = b;
+ *(buffer + bp) = b;
b += (m1* *(buffer+((bp+d1)%1000))) + (m2* *(buffer+((bp+d2)%1000)));
-
+
f1 = o * f1 + trm * b;
f2 = o * f2 + f1;
f3 = o * f3 + f2;
@@ -324,7 +324,7 @@ void mdaCombo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
bp = (bp==0)? 999 : bp - 1; //buffer position
- *++out1 = c + b;
+ *++out1 = c + b;
*++out2 = d + b;
}
}
@@ -335,13 +335,13 @@ void mdaCombo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
a = drv * (*++in1 + *++in2 + bi);
c = out1[1];
d = out2[1]; //process from here...
-
+
b = (a>clp)? clp : a; //distort
b = (a<-clp)? -clp : b;
-
- *(buffer + bp) = b;
+
+ *(buffer + bp) = b;
b += (m1* *(buffer+((bp+d1)%1000))) + (m2* *(buffer+((bp+d2)%1000)));
-
+
f1 = o * f1 + trm * b;
f2 = o * f2 + f1;
f3 = o * f3 + f2;
@@ -352,7 +352,7 @@ void mdaCombo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
bp = (bp==0)? 999 : bp - 1; //buffer position
- *++out1 = c + b;
+ *++out1 = c + b;
*++out2 = d + b;
}
}
@@ -360,7 +360,7 @@ void mdaCombo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
bufpos = bp;
if(fabs(f1)<1.0e-10) { ff1=0.f; ff2=0.f; ff3=0.f; ff4=0.f; ff5=0.f; }
else { ff1=f1; ff2=f2; ff3=f3; ff4=f4; ff5=f5; }
- if(fabs(f6)<1.0e-10) { ff6=0.f; ff7=0.f; ff8=0.f; ff9=0.f; ff10=0.f; }
+ if(fabs(f6)<1.0e-10) { ff6=0.f; ff7=0.f; ff8=0.f; ff9=0.f; ff10=0.f; }
else { ff6=f6; ff7=f7; ff8=f8; ff9=f9; ff10=f10; }
if(fabs(h0)<1.0e-10) { hh0 = hh1 = 0.0f; } else { hh0=h0; hh1=h1; }
}
@@ -371,17 +371,17 @@ void mdaCombo::processReplacing(float **inputs, float **outputs, LvzInt32 sample
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, trm, m1=mix1, m2=mix2, clp=clip;
+ float a, b, trm, m1=mix1, m2=mix2, clp=clip;
float o=lpf, i=1.f-lpf, o2=hpf, bi=bias, drv=drive;
float f1=ff1, f2=ff2, f3=ff3, f4=ff4, f5=ff5;
float a2, b2, f6=ff6, f7=ff7, f8=ff8, f9=ff9, f10=ff10;
float hf=hhf, hq=hhq, h0=hh0, h1=hh1;
long d1=del1, d2=del2, bp = bufpos;
-
+
trm = trim * i * i * i * i;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
@@ -402,10 +402,10 @@ void mdaCombo::processReplacing(float **inputs, float **outputs, LvzInt32 sample
b = (a<-clp)? -clp : b; b2 = (a2<-clp)? -clp : b2;
}
- *(buffer + bp) = b; *(buffe2 + bp) = b2;
+ *(buffer + bp) = b; *(buffe2 + bp) = b2;
b += (m1* *(buffer+((bp+d1)%1000))) + (m2* *(buffer+((bp+d2)%1000)));
b2+= (m1* *(buffe2+((bp+d1)%1000))) + (m2* *(buffe2+((bp+d2)%1000)));
-
+
f1 = o * f1 + trm * b; f6 = o * f6 + trm * b2;
f2 = o * f2 + f1; f7 = o * f7 + f6;
f3 = o * f3 + f2; f8 = o * f8 + f7;
@@ -415,8 +415,8 @@ void mdaCombo::processReplacing(float **inputs, float **outputs, LvzInt32 sample
b = f4 - f5; b2 = f9 - f10;
if(bp==0) bufpos=999; else bufpos=bp-1;
-
- *++out1 = b;
+
+ *++out1 = b;
*++out2 = b2;
}
}
@@ -427,7 +427,7 @@ void mdaCombo::processReplacing(float **inputs, float **outputs, LvzInt32 sample
while(--sampleFrames >= 0)
{
a = drv * (*++in1 + *++in2 + bi);
-
+
h0 += hf * (h1 + a); //resonant highpass (Chamberlin SVF)
h1 -= hf * (h0 + hq * h1);
a += h1;
@@ -435,9 +435,9 @@ void mdaCombo::processReplacing(float **inputs, float **outputs, LvzInt32 sample
b = (a>0.f)? a : -a;
b = a / (1.f + b);
- *(buffer + bp) = b;
+ *(buffer + bp) = b;
b += (m1* *(buffer+((bp+d1)%1000))) + (m2* *(buffer+((bp+d2)%1000)));
-
+
f1 = o * f1 + trm * b;
f2 = o * f2 + f1;
f3 = o * f3 + f2;
@@ -457,17 +457,17 @@ void mdaCombo::processReplacing(float **inputs, float **outputs, LvzInt32 sample
while(--sampleFrames >= 0)
{
a = drv * (*++in1 + *++in2 + bi);
-
+
h0 += hf * (h1 + a); //resonant highpass (Chamberlin SVF)
h1 -= hf * (h0 + hq * h1);
a += h1;
b = (a>clp)? clp : a; //distort
b = (a<-clp)? -clp : b;
-
- *(buffer + bp) = b;
+
+ *(buffer + bp) = b;
b += (m1* *(buffer+((bp+d1)%1000))) + (m2* *(buffer+((bp+d2)%1000)));
-
+
f1 = o * f1 + trm * b;
f2 = o * f2 + f1;
f3 = o * f3 + f2;
@@ -486,7 +486,7 @@ void mdaCombo::processReplacing(float **inputs, float **outputs, LvzInt32 sample
bufpos = bp;
if(fabs(f1)<1.0e-10) { ff1=0.f; ff2=0.f; ff3=0.f; ff4=0.f; ff5=0.f; }
else { ff1=f1; ff2=f2; ff3=f3; ff4=f4; ff5=f5; }
- if(fabs(f6)<1.0e-10) { ff6=0.f; ff7=0.f; ff8=0.f; ff9=0.f; ff10=0.f; }
+ if(fabs(f6)<1.0e-10) { ff6=0.f; ff7=0.f; ff8=0.f; ff9=0.f; ff10=0.f; }
else { ff6=f6; ff7=f7; ff8=f8; ff9=f9; ff10=f10; }
if(fabs(h0)<1.0e-10) { hh0 = hh1 = 0.0f; } else { hh0=h0; hh1=h1; }
}
diff --git a/src/mdaDX10.cpp b/src/mdaDX10.cpp
index df88605..8a0d60f 100644
--- a/src/mdaDX10.cpp
+++ b/src/mdaDX10.cpp
@@ -20,7 +20,7 @@ mdaDX10::mdaDX10(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, NP
{
long i=0;
Fs = 44100.0f;
-
+
programs = new mdaDX10Program[NPROGS];
if(programs)
{ //Att Dec Rel | Rat C Rat F Att Dec Sus Rel Vel | Vib Oct Fine Rich Thru LFO
@@ -56,22 +56,22 @@ mdaDX10::mdaDX10(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, NP
fillpatch(i++, "Harmonics", 0.000f, 0.500f, 0.500f, 0.280f, 0.000f, 0.330f, 0.200f, 0.000f, 0.700f, 0.500f, 0.000f, 0.500f, 0.500f, 0.151f, 0.079f, 0.500f);
fillpatch(i++, "Scratch", 0.000f, 0.500f, 0.000f, 0.000f, 0.240f, 0.580f, 0.630f, 0.000f, 0.000f, 0.500f, 0.000f, 0.600f, 0.500f, 0.816f, 0.243f, 0.500f);
fillpatch(i++, "Syn Tom", 0.000f, 0.355f, 0.350f, 0.000f, 0.105f, 0.000f, 0.000f, 0.200f, 0.500f, 0.500f, 0.000f, 0.645f, 0.500f, 1.000f, 0.296f, 0.500f);
-
+
setProgram(0);
}
-
+
setUniqueID("mdaDX10");
if(audioMaster)
{
- setNumInputs(0);
+ setNumInputs(0);
setNumOutputs(NOUTS);
canProcessReplacing();
isSynth();
}
//initialise...
- for(i=0; i<NVOICES; i++)
+ for(i=0; i<NVOICES; i++)
{
voice[i].env = 0.0f;
voice[i].car = voice[i].dcar = 0.0f;
@@ -98,9 +98,9 @@ void mdaDX10::update() //parameter change //if multitimbral would have to move
rati = param[3];
rati = (float)floor(40.1f * rati * rati);
- if(param[4]<0.5f)
+ if(param[4]<0.5f)
ratf = 0.2f * param[4] * param[4];
- else
+ else
switch((long)(8.9f * param[4]))
{
case 4: ratf = 0.25f; break;
@@ -118,7 +118,7 @@ void mdaDX10::update() //parameter change //if multitimbral would have to move
vibrato = 0.001f * param[10] * param[10];
catt = 1.0f - (float)exp(-ifs * exp(8.0 - 8.0 * param[0]));
- if(param[1]>0.98f) cdec = 1.0f; else
+ if(param[1]>0.98f) cdec = 1.0f; else
cdec = (float)exp(-ifs * exp(5.0 - 8.0 * param[1]));
crel = (float)exp(-ifs * exp(5.0 - 5.0 * param[2]));
mdec = 1.0f - (float)exp(-ifs * exp(6.0 - 7.0 * param[6]));
@@ -139,7 +139,7 @@ void mdaDX10::setSampleRate(float rate)
void mdaDX10::resume()
-{
+{
DECLARE_LVZ_DEPRECATED (wantEvents) ();
lfo0 = 0.0f;
lfo1 = 1.0f; //reset LFO phase
@@ -171,9 +171,9 @@ void mdaDX10::setParameter(LvzInt32 index, float value)
}
-void mdaDX10::fillpatch(long p, const char *name,
- float p0, float p1, float p2, float p3, float p4, float p5,
- float p6, float p7, float p8, float p9, float p10, float p11,
+void mdaDX10::fillpatch(long p, const char *name,
+ float p0, float p1, float p2, float p3, float p4, float p5,
+ float p6, float p7, float p8, float p9, float p10, float p11,
float p12, float p13, float p14, float p15)
{
strcpy(programs[p].name, name);
@@ -267,7 +267,7 @@ void mdaDX10::getParameterName(LvzInt32 index, char *label)
void mdaDX10::getParameterDisplay(LvzInt32 index, char *text)
{
char string[16];
-
+
switch(index)
{
case 3: sprintf(string, "%.0f", rati); break;
@@ -303,10 +303,10 @@ void mdaDX10::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
long event=0, frame=0, frames, v;
float o, x, e, mw=MW, w=rich, m=modmix;
long k=K;
-
+
if(activevoices>0 || notes[event]<sampleFrames) //detect & bypass completely empty blocks
- {
- while(frame<sampleFrames)
+ {
+ while(frame<sampleFrames)
{
frames = notes[event++];
if(frames>sampleFrames) frames = sampleFrames;
@@ -336,14 +336,14 @@ void mdaDX10::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
x = V->dmod * V->mod0 - V->mod1; //could add more modulator blocks like
V->mod1 = V->mod0; //this for a wider range of FM sounds
- V->mod0 = x;
+ V->mod0 = x;
V->menv += V->mdec * (V->mlev - V->menv);
x = V->car + V->dcar + x * V->menv + mw; //carrier phase
while(x > 1.0f) x -= 2.0f; //wrap phase
while(x < -1.0f) x += 2.0f;
V->car = x;
- o += V->cenv * (m * V->mod1 + (x + x * x * x * (w * x * x - 1.0f - w)));
+ o += V->cenv * (m * V->mod1 + (x + x * x * x * (w * x * x - 1.0f - w)));
} //amp env //mod thru-mix //5th-order sine approximation
V++;
}
@@ -358,7 +358,7 @@ void mdaDX10::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
noteOn(note, vel);
}
}
-
+
activevoices = NVOICES;
for(v=0; v<NVOICES; v++)
{
@@ -383,10 +383,10 @@ void mdaDX10::processReplacing(float **inputs, float **outputs, LvzInt32 sampleF
long event=0, frame=0, frames, v;
float o, x, e, mw=MW, w=rich, m=modmix;
long k=K;
-
+
if(activevoices>0 || notes[event]<sampleFrames) //detect & bypass completely empty blocks
- {
- while(frame<sampleFrames)
+ {
+ while(frame<sampleFrames)
{
frames = notes[event++];
if(frames>sampleFrames) frames = sampleFrames;
@@ -416,19 +416,19 @@ void mdaDX10::processReplacing(float **inputs, float **outputs, LvzInt32 sampleF
x = V->dmod * V->mod0 - V->mod1; //could add more modulator blocks like
V->mod1 = V->mod0; //this for a wider range of FM sounds
- V->mod0 = x;
+ V->mod0 = x;
V->menv += V->mdec * (V->mlev - V->menv);
x = V->car + V->dcar + x * V->menv + mw; //carrier phase
while(x > 1.0f) x -= 2.0f; //wrap phase
while(x < -1.0f) x += 2.0f;
V->car = x;
- o += V->cenv * (m * V->mod1 + (x + x * x * x * (w * x * x - 1.0f - w)));
+ o += V->cenv * (m * V->mod1 + (x + x * x * x * (w * x * x - 1.0f - w)));
} //amp env //mod thru-mix //5th-order sine approximation
/// xx = x * x;
/// x + x + x * xx * (xx - 3.0f);
-
+
V++;
}
*out1++ = o;
@@ -442,7 +442,7 @@ void mdaDX10::processReplacing(float **inputs, float **outputs, LvzInt32 sampleF
noteOn(note, vel);
}
}
-
+
activevoices = NVOICES;
for(v=0; v<NVOICES; v++)
{
@@ -471,8 +471,8 @@ void mdaDX10::noteOn(long note, long velocity)
{
float l = 1.0f;
long v, vl=0;
-
- if(velocity>0)
+
+ if(velocity>0)
{
for(v=0; v<NVOICES; v++) //find quietest voice
{
@@ -492,7 +492,7 @@ void mdaDX10::noteOn(long note, long velocity)
voice[vl].dmod = ratio * voice[vl].dcar; //sine oscillator
voice[vl].mod0 = 0.0f;
- voice[vl].mod1 = (float)sin(voice[vl].dmod);
+ voice[vl].mod1 = (float)sin(voice[vl].dmod);
voice[vl].dmod = 2.0f * (float)cos(voice[vl].dmod);
//scale volume with richness
voice[vl].env = (1.5f - param[13]) * volume * (velocity + 10);
@@ -521,13 +521,13 @@ void mdaDX10::noteOn(long note, long velocity)
LvzInt32 mdaDX10::processEvents(LvzEvents* ev)
{
long npos=0;
-
+
for (long i=0; i<ev->numEvents; i++)
{
if((ev->events[i])->type != kLvzMidiType) continue;
LvzMidiEvent* event = (LvzMidiEvent*)ev->events[i];
char* midiData = event->midiData;
-
+
switch(midiData[0] & 0xf0) //status byte (all channels)
{
case 0x80: //note off
@@ -548,11 +548,11 @@ LvzInt32 mdaDX10::processEvents(LvzEvents* ev)
case 0x01: //mod wheel
modwhl = 0.00000005f * (float)(midiData[2] * midiData[2]);
break;
-
+
case 0x07: //volume
volume = 0.00000035f * (float)(midiData[2] * midiData[2]);
break;
-
+
case 0x40: //sustain
sustain = midiData[2] & 0x40;
if(sustain==0)
@@ -564,8 +564,8 @@ LvzInt32 mdaDX10::processEvents(LvzEvents* ev)
break;
default: //all notes off
- if(midiData[1]>0x7A)
- {
+ if(midiData[1]>0x7A)
+ {
for(long v=0; v<NVOICES; v++) voice[v].cdec=0.99f;
sustain = 0;
}
@@ -576,13 +576,13 @@ LvzInt32 mdaDX10::processEvents(LvzEvents* ev)
case 0xC0: //program change
if(midiData[1]<NPROGS) setProgram(midiData[1]);
break;
-
+
case 0xE0: //pitch bend
pbend = (float)(midiData[1] + 128 * midiData[2] - 8192);
- if(pbend>0.0f) pbend = 1.0f + 0.000014951f * pbend;
- else pbend = 1.0f + 0.000013318f * pbend;
+ if(pbend>0.0f) pbend = 1.0f + 0.000014951f * pbend;
+ else pbend = 1.0f + 0.000013318f * pbend;
break;
-
+
default: break;
}
diff --git a/src/mdaDX10.h b/src/mdaDX10.h
index 6ab11d4..1041e31 100644
--- a/src/mdaDX10.h
+++ b/src/mdaDX10.h
@@ -29,7 +29,7 @@ private:
struct VOICE //voice state
{
float env; //carrier envelope
- float dmod; //modulator oscillator
+ float dmod; //modulator oscillator
float mod0;
float mod1;
float menv; //modulator envelope
@@ -80,9 +80,9 @@ public:
private:
void update(); //my parameter update
void noteOn(long note, long velocity);
- void fillpatch(long p, const char *name,
- float p0, float p1, float p2, float p3, float p4, float p5,
- float p6, float p7, float p8, float p9, float p10, float p11,
+ void fillpatch(long p, const char *name,
+ float p0, float p1, float p2, float p3, float p4, float p5,
+ float p6, float p7, float p8, float p9, float p10, float p11,
float p12, float p13, float p14, float p15);
float param[NPARAMS];
diff --git a/src/mdaDeEss.cpp b/src/mdaDeEss.cpp
index 13e625f..5aa23a2 100644
--- a/src/mdaDeEss.cpp
+++ b/src/mdaDeEss.cpp
@@ -14,11 +14,11 @@ mdaDeEss::mdaDeEss(audioMasterCallback audioMaster) : AudioEffectX(audioMaster,
fParam1 = (float)0.15f; //thresh
fParam2 = (float)0.60f; //f
fParam3 = (float)0.50f; //drive
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaDeEss"); //identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "De-esser");
env=0.f;
@@ -101,7 +101,7 @@ void mdaDeEss::getParameterLabel(LvzInt32 index, char *label)
{
case 0: strcpy(label, "dB"); break;
case 1: strcpy(label, "Hz"); break;
- case 2: strcpy(label, "dB"); break;
+ case 2: strcpy(label, "dB"); break;
}
}
@@ -114,17 +114,17 @@ void mdaDeEss::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d;
+ float a, b, c, d;
float f1=fbuf1, f2=fbuf2, tmp, fi=fil, fo=(1.f-fil);
float at=att, re=rel, en=env, th=thr, g, gg=gai;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
c = out1[1];
d = out2[1];
@@ -134,10 +134,10 @@ void mdaDeEss::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
tmp -= f1;
f2 = fo * f2 + fi * tmp;
tmp = gg*(tmp - f2); //extra HF gain
-
+
en=(tmp>en)? en+at*(tmp-en) : en*re; //envelope
- if(en>th) g=f1+f2+tmp*(th/en); else g=f1+f2+tmp; //limit
-
+ if(en>th) g=f1+f2+tmp*(th/en); else g=f1+f2+tmp; //limit
+
c += g;
d += g;
*++out1 = c;
@@ -153,27 +153,27 @@ void mdaDeEss::processReplacing(float **inputs, float **outputs, LvzInt32 sample
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b;
+ float a, b;
float f1=fbuf1, f2=fbuf2, tmp, fi=fil, fo=(1.f-fil);
float at=att, re=rel, en=env, th=thr, g, gg=gai;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
- b = *++in2;
-
+ a = *++in1;
+ b = *++in2;
+
tmp = 0.5f * (a + b); //2nd order crossover
f1 = fo * f1 + fi * tmp;
tmp -= f1;
f2 = fo * f2 + fi * tmp;
tmp = gg*(tmp - f2); //extra HF gain
-
+
en=(tmp>en)? en+at*(tmp-en) : en*re; //envelope
- if(en>th) g=f1+f2+tmp*(th/en); else g=f1+f2+tmp; //limit
+ if(en>th) g=f1+f2+tmp*(th/en); else g=f1+f2+tmp; //limit
//brackets for full-band!!!
*++out1 = g;
*++out2 = g;
diff --git a/src/mdaDegrade.cpp b/src/mdaDegrade.cpp
index 2dbab87..c6f2806 100644
--- a/src/mdaDegrade.cpp
+++ b/src/mdaDegrade.cpp
@@ -18,11 +18,11 @@ mdaDegrade::mdaDegrade(audioMasterCallback audioMaster) : AudioEffectX(audioMast
fParam5 = (float)0.58; //non-lin
fParam6 = (float)0.5; //level
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaDegrade"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Degrade");
buf0 = buf1 = buf2 = buf3 = buf4 = buf5 = buf6 = buf7 = buf8 = buf9 = 0.0f;
@@ -37,31 +37,31 @@ bool mdaDegrade::getEffectName(char* name) { strcpy(name, "Degrade"); return
void mdaDegrade::setParameter(LvzInt32 index, float value)
{
float f;
-
+
switch(index)
{
case 0: fParam1 = value; break;
case 1: fParam2 = value; break;
case 2: fParam3 = value; break;
case 3: fParam4 = value; break;
- case 4: fParam5 = value; break;
+ case 4: fParam5 = value; break;
case 5: fParam6 = value; break;
}
//calcs here
if(fParam3>0.5) { f = fParam3 - 0.5f; mode = 1.0f; }
else { f = 0.5f - fParam3; mode = 0.0f; }
-
+
tn = (int)exp(18.0f * f);
-
+
//tn = (int)(18.0 * fParam3 - 8.0); mode=1.f; }
// else { tn = (int)(10.0 - 18.0 * fParam3); mode=0.f; }
tcount = 1;
clp = (float)(pow(10.0,(-1.5 + 1.5 * fParam1)) );
fo2 = filterFreq((float)pow(10.0f, 2.30104f + 2.f*fParam4));
fi2 = (1.f-fo2); fi2=fi2*fi2; fi2=fi2*fi2;
- float _g1 = (float)(pow(2.0,2.0 + int(fParam2*12.0)));
+ float _g1 = (float)(pow(2.0,2.0 + int(fParam2*12.0)));
g2 = (float)(1.0/(2.0 * _g1));
- if(fParam3>0.5) g1 = -_g1/(float)tn; else g1= -_g1;
+ if(fParam3>0.5) g1 = -_g1/(float)tn; else g1= -_g1;
g3 = (float)(pow(10.0,2.0*fParam6 - 1.0));
if(fParam5>0.5) { lin = (float)(pow(10.0,0.3 * (0.5 - fParam5))); lin2=lin; }
else { lin = (float)pow(10.0,0.3 * (fParam5 - 0.5)); lin2=1.0; }
@@ -78,7 +78,7 @@ void mdaDegrade::suspend()
float mdaDegrade::filterFreq(float hz)
{
float j, k, r=0.999f;
-
+
j = r * r - 1;
k = (float)(2.f - 2.f * r * r * cos(0.647f * hz / getSampleRate() ));
return (float)((sqrt(k*k - 4.f*j*j) - k) / (2.f*j));
@@ -164,18 +164,18 @@ void mdaDegrade::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float cl=clp, i2=fi2, o2=fo2;
float b1=buf1, b2=buf2, b3=buf3, b4=buf4, b5=buf5;
float b6=buf6, b7=buf7, b8=buf8, b9=buf9;
- float gi=g1, go=g2, ga=g3, m=mode;
- int n=tn, t=tcount;
-
- --in1;
- --in2;
+ float gi=g1, go=g2, ga=g3, m=mode;
+ int n=tn, t=tcount;
+
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
c = out1[1];
d = out2[1]; //process from here...
-
+
b0 = (*++in1 + *++in2) + m * b0;
if(t==n)
@@ -187,7 +187,7 @@ void mdaDegrade::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
else
{ b5=-(float)pow(-b5,l); if(b5<-cl) b5=-cl; }
b0=0;
- }
+ }
t=t+1;
b1 = i2 * (b5 * ga) + o2 * b1;
@@ -202,14 +202,14 @@ void mdaDegrade::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
c += b9; // output
d += b9;
- *++out1 = c;
+ *++out1 = c;
*++out2 = d;
}
- if(fabs(b1)<1.0e-10)
+ if(fabs(b1)<1.0e-10)
{ buf1=0.f; buf2=0.f; buf3=0.f; buf4=0.f; buf6=0.f; buf7=0.f;
buf8=0.f; buf9=0.f; buf0=0.f; buf5=0.f; }
- else
- { buf1=b1; buf2=b2; buf3=b3; buf4=b4; buf6=b6; buf7=b7;
+ else
+ { buf1=b1; buf2=b2; buf3=b3; buf4=b4; buf6=b6; buf7=b7;
buf8=b8, buf9=b9; buf0=b0; buf5=b5; tcount=t; }
}
@@ -223,11 +223,11 @@ void mdaDegrade::processReplacing(float **inputs, float **outputs, LvzInt32 samp
float cl=clp, i2=fi2, o2=fo2;
float b1=buf1, b2=buf2, b3=buf3, b4=buf4, b5=buf5;
float b6=buf6, b7=buf7, b8=buf8, b9=buf9;
- float gi=g1, go=g2, ga=g3, m=mode;
- int n=tn, t=tcount;
-
- --in1;
- --in2;
+ float gi=g1, go=g2, ga=g3, m=mode;
+ int n=tn, t=tcount;
+
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
@@ -243,7 +243,7 @@ void mdaDegrade::processReplacing(float **inputs, float **outputs, LvzInt32 samp
else
{ b5=-(float)pow(-b5,l); if(b5<-cl) b5=-cl; }
b0=0;
- }
+ }
t=t+1;
b1 = i2 * (b5 * ga) + o2 * b1;
@@ -258,10 +258,10 @@ void mdaDegrade::processReplacing(float **inputs, float **outputs, LvzInt32 samp
*++out1 = b9;
*++out2 = b9;
}
- if(fabs(b1)<1.0e-10)
+ if(fabs(b1)<1.0e-10)
{ buf1=0.f; buf2=0.f; buf3=0.f; buf4=0.f; buf6=0.f; buf7=0.f;
buf8=0.f; buf9=0.f; buf0=0.f; buf5=0.f; }
- else
- { buf1=b1; buf2=b2; buf3=b3; buf4=b4; buf6=b6; buf7=b7;
+ else
+ { buf1=b1; buf2=b2; buf3=b3; buf4=b4; buf6=b6; buf7=b7;
buf8=b8, buf9=b9; buf0=b0; buf5=b5; tcount=t; }
}
diff --git a/src/mdaDelay.cpp b/src/mdaDelay.cpp
index 2d2dd41..6780679 100644
--- a/src/mdaDelay.cpp
+++ b/src/mdaDelay.cpp
@@ -23,15 +23,15 @@ mdaDelay::mdaDelay(audioMasterCallback audioMaster) : AudioEffectX(audioMaster,
ipos = 0;
fil0 = 0.0f;
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaDelay"); //identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Delay");
-
+
suspend(); //flush buffer
- setParameter(0, 0.5);
+ setParameter(0, 0.5);
}
bool mdaDelay::getProductString(char* text) { strcpy(text, "MDA Delay"); return true; }
@@ -54,7 +54,7 @@ void mdaDelay::setParameter(LvzInt32 index, float value)
//calcs here
ldel = (long)(size * fParam0 * fParam0);
if(ldel<4) ldel=4;
-
+
switch(int(fParam1 * 17.9f)) //fixed left/right ratios
{
case 17: tmp = 0.5000f; break;
@@ -76,13 +76,13 @@ void mdaDelay::setParameter(LvzInt32 index, float value)
if(fParam3>0.5f) //simultaneously change crossover frequency & high/low mix
{
- fil = 0.5f * fil - 0.25f;
+ fil = 0.5f * fil - 0.25f;
lmix = -2.0f * fil;
hmix = 1.0f;
}
- else
- {
- hmix = 2.0f * fil;
+ else
+ {
+ hmix = 2.0f * fil;
lmix = 1.0f - hmix;
}
fil = (float)exp(-6.2831853f * pow(10.0f, 2.2f + 4.5f * fil) / getSampleRate());
@@ -187,33 +187,33 @@ void mdaDelay::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
l = (i + ldel) % (s + 1);
r = (i + rdel) % (s + 1);
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
c = out1[1];
- d = out2[1];
+ d = out2[1];
ol = *(buffer + l);
or_ = *(buffer + r);
-
- tmp = w * (a + b) + fb * (ol + or_);
- f0 = f * (f0 - tmp) + tmp;
- *(buffer + i) = lx * f0 + hx * tmp;
+
+ tmp = w * (a + b) + fb * (ol + or_);
+ f0 = f * (f0 - tmp) + tmp;
+ *(buffer + i) = lx * f0 + hx * tmp;
i--; if(i<0) i=s;
l--; if(l<0) l=s;
r--; if(r<0) r=s;
- *++out1 = c + y * a + ol;
- *++out2 = d + y * b + or_;
+ *++out1 = c + y * a + ol;
+ *++out2 = d + y * b + or_;
}
ipos = i;
- if(fabs(f0)<1.0e-10) fil0=0.0f; else fil0=f0;
+ if(fabs(f0)<1.0e-10) fil0=0.0f; else fil0=f0;
}
void mdaDelay::processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames)
@@ -229,8 +229,8 @@ void mdaDelay::processReplacing(float **inputs, float **outputs, LvzInt32 sample
l = (i + ldel) % (s + 1);
r = (i + rdel) % (s + 1);
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
@@ -240,7 +240,7 @@ void mdaDelay::processReplacing(float **inputs, float **outputs, LvzInt32 sample
ol = *(buffer + l); //delay outputs
or_ = *(buffer + r);
-
+
tmp = w * (a + b) + fb * (ol + or_); //mix input & feedback
f0 = f * (f0 - tmp) + tmp; //low-pass filter
*(buffer + i) = lx * f0 + hx * tmp; //delay input
@@ -250,7 +250,7 @@ void mdaDelay::processReplacing(float **inputs, float **outputs, LvzInt32 sample
r--; if(r<0) r=s;
*++out1 = y * a + ol; //mix wet & dry
- *++out2 = y * b + or_;
+ *++out2 = y * b + or_;
}
ipos = i;
if(fabs(f0)<1.0e-10) fil0=0.0f; else fil0=f0; //trap denormals
diff --git a/src/mdaDetune.cpp b/src/mdaDetune.cpp
index a5492cb..43b6bec 100644
--- a/src/mdaDetune.cpp
+++ b/src/mdaDetune.cpp
@@ -34,7 +34,7 @@ mdaDetune::mdaDetune(audioMasterCallback audioMaster): AudioEffectX(audioMaster,
setNumInputs(2);
setNumOutputs(2);
setUniqueID("mdaDetune"); ///identify mdaDetune-in here
- DECLARE_LVZ_DEPRECATED(canMono) ();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
canProcessReplacing();
///initialise...
@@ -44,7 +44,7 @@ mdaDetune::mdaDetune(audioMasterCallback audioMaster): AudioEffectX(audioMaster,
programs = new mdaDetuneProgram[numPrograms];
setProgram(0);
-
+
///differences from default program...
programs[1].param[0] = 0.20f;
programs[3].param[0] = 0.90f;
@@ -60,7 +60,7 @@ mdaDetune::mdaDetune(audioMasterCallback audioMaster): AudioEffectX(audioMaster,
void mdaDetune::resume() ///update internal parameters...
{
long tmp;
-
+
semi = 3.0f * param[0] * param[0] * param[0];
dpos2 = (float)pow(1.0594631f, semi);
dpos1 = 1.0f / dpos2;
@@ -111,7 +111,7 @@ void mdaDetune::setProgram(LvzInt32 program)
void mdaDetune::setParameter(LvzInt32 index, float value)
-{
+{
programs[curProgram].param[index] = param[index] = value; //bug was here!
resume();
}
@@ -189,7 +189,7 @@ void mdaDetune::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
c += y * a;
d += y * b;
- --p0 &= l;
+ --p0 &= l;
*(buf + p0) = w * (a + b); //input
p1 -= d1;
@@ -262,7 +262,7 @@ void mdaDetune::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
c = y * a;
d = y * b;
- --p0 &= l;
+ --p0 &= l;
*(buf + p0) = w * (a + b); //input
p1 -= d1;
diff --git a/src/mdaDither.cpp b/src/mdaDither.cpp
index 23f9bdb..94c3a47 100644
--- a/src/mdaDither.cpp
+++ b/src/mdaDither.cpp
@@ -21,13 +21,13 @@ mdaDither::mdaDither(audioMasterCallback audioMaster) : AudioEffectX(audioMaster
sh1 = sh2 = sh3 = sh4 = 0.0f;
rnd1 = rnd3 = 0;
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaDither"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Dither & Noise Shaping");
-
+
setParameter(0, 0.5f);
}
@@ -47,7 +47,7 @@ void mdaDither::setParameter(LvzInt32 index, float value)
}
//calcs here
gain = 1.0f;
- bits = 8.0f + 2.0f * (float)floor(8.9f * fParam0);
+ bits = 8.0f + 2.0f * (float)floor(8.9f * fParam0);
if(fParam4>0.1f) //zoom to 6 bit & fade out audio
{
@@ -55,16 +55,16 @@ void mdaDither::setParameter(LvzInt32 index, float value)
gain = (1.0f - fParam4); gain*=gain;
}
else wlen = (float)pow(2.0f, bits - 1.0f); //word length in quanta
-
- //Using WaveLab 2.01 (unity gain) as a reference:
+
+ //Using WaveLab 2.01 (unity gain) as a reference:
// 16-bit output is (int)floor(floating_point_value*32768.0f)
-
+
offs = (4.0f * fParam3 - 1.5f) / wlen; //DC offset (plus 0.5 to round dither not truncate)
dith = 2.0f * fParam2 / (wlen * (float)32767);
shap=0.0f;
switch((long)(fParam1*3.9)) //dither mode
- {
+ {
case 0: dith = 0.0f; break; //off
case 3: shap = 0.5f; break; //noise shaping
default: break; //tri, hp-tri
@@ -134,7 +134,7 @@ void mdaDither::getParameterDisplay(LvzInt32 index, char *text)
} break;
case 2: float2strng(4.0f * fParam2, text); break;
case 3: float2strng(4.0f * fParam3 - 2.0f, text); break;
- case 4: if(fParam4>0.1f)
+ case 4: if(fParam4>0.1f)
if(gain<0.0001f) strcpy(text, "-80");
else long2string((long)(20.0 * log10(gain)), text);
else strcpy(text, "OFF"); break;
@@ -171,14 +171,14 @@ void mdaDither::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
long m=1; //dither mode
if((long)(fParam1 * 3.9f)==1) m=0; //what is the fastest if(?)
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
-
+
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
c = out1[1];
d = out2[1];
@@ -186,12 +186,12 @@ void mdaDither::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
r2=r1; r4=r3;
if(m==0) { r4=rand() & 0x7FFF; r2=(r4 & 0x7F)<<8; }
r1=rand() & 0x7FFF; r3=(r1 & 0x7F)<<8;
-
+
a = g * a + sl * (s1 + s1 - s2);
aa = a + o + dl * (float)(r1 - r2);
if(aa<0.0f) aa-=wi;
aa = wi * (float)(long)(w * aa);
- s2 = s1;
+ s2 = s1;
s1 = a - aa;
b = g * b + sl * (s3 + s3 - s4);
@@ -204,7 +204,7 @@ void mdaDither::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
*++out1 = c + aa;
*++out2 = d + bb;
}
-
+
sh1=s1; sh2=s2; sh3=s3; sh4=s4;
rnd1=r1; rnd3=r3;
}
@@ -224,8 +224,8 @@ void mdaDither::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
long m=1; //dither mode
if((long)(fParam1 * 3.9f)==1) m=0; //what is the fastest if(?)
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
@@ -237,12 +237,12 @@ void mdaDither::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
r2=r1; r4=r3; //HP-TRI dither (also used when noise shaping)
if(m==0) { r4=rand() & 0x7FFF; r2=(r4 & 0x7F)<<8; } //TRI dither
r1=rand() & 0x7FFF; r3=(r1 & 0x7F)<<8; //Assumes RAND_MAX=32767?
-
+
a = g * a + sl * (s1 + s1 - s2); //target level + error feedback
- aa = a + o + dl * (float)(r1 - r2); // + offset + dither
+ aa = a + o + dl * (float)(r1 - r2); // + offset + dither
if(aa<0.0f) aa-=wi; //(long) truncates towards zero!
- aa = wi * (float)(long)(w * aa); //truncate
- s2 = s1;
+ aa = wi * (float)(long)(w * aa); //truncate
+ s2 = s1;
s1 = a - aa; //error feedback: 2nd order noise shaping
b = g * b + sl * (s3 + s3 - s4);
@@ -255,7 +255,7 @@ void mdaDither::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
*++out1 = aa;
*++out2 = bb;
}
-
+
sh1=s1; sh2=s2; sh3=s3; sh4=s4; //doesn't actually matter if these are
rnd1=r1; rnd3=r3; //saved or not as effect is so small !
}
diff --git a/src/mdaDubDelay.cpp b/src/mdaDubDelay.cpp
index cebe98a..d6cc238 100644
--- a/src/mdaDubDelay.cpp
+++ b/src/mdaDubDelay.cpp
@@ -27,15 +27,15 @@ mdaDubDelay::mdaDubDelay(audioMasterCallback audioMaster) : AudioEffectX(audioMa
phi = 0.0f;
dlbuf= 0.0f;
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaDubDelay"); //identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Dub Feedback Delay");
-
+
suspend(); //flush buffer
- setParameter(0, 0.5);
+ setParameter(0, 0.5);
}
bool mdaDubDelay::getProductString(char* text) { strcpy(text, "MDA DubDelay"); return true; }
@@ -61,17 +61,17 @@ void mdaDubDelay::setParameter(LvzInt32 index, float value)
///CHANGED///del = fParam0 * fParam0 * fParam0 * (float)size;
del = fParam0 * fParam0 * (float)size;
mod = 0.049f * fParam3 * del;
-
+
fil = fParam2;
if(fParam2>0.5f) //simultaneously change crossover frequency & high/low mix
{
- fil = 0.5f * fil - 0.25f;
+ fil = 0.5f * fil - 0.25f;
lmix = -2.0f * fil;
hmix = 1.0f;
}
- else
- {
- hmix = 2.0f * fil;
+ else
+ {
+ hmix = 2.0f * fil;
lmix = 1.0f - hmix;
}
fil = (float)exp(-6.2831853f * pow(10.0f, 2.2f + 4.5f * fil) / fs);
@@ -183,8 +183,8 @@ void mdaDubDelay::process(float **inputs, float **outputs, LvzInt32 sampleFrames
float twopi=6.2831853f;
long i=ipos, l, s=size, k=0;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
@@ -192,7 +192,7 @@ void mdaDubDelay::process(float **inputs, float **outputs, LvzInt32 sampleFrames
a = *++in1;
b = *++in2;
c = out1[1];
- d = out2[1];
+ d = out2[1];
if(k==0) //update delay length at slower rate (could be improved!)
{
@@ -203,33 +203,33 @@ void mdaDubDelay::process(float **inputs, float **outputs, LvzInt32 sampleFrames
}
k--;
dl += ddl; //lin interp between points
-
+
i--; if(i<0) i=s; //delay positions
-
+
l = (long)dl;
tmp = dl - (float)l; //remainder
l += i; if(l>s) l-=(s+1);
-
+
ol = *(buffer + l); //delay output
-
- l++; if(l>s) l=0;
+
+ l++; if(l>s) l=0;
ol += tmp * (*(buffer + l) - ol); //lin interp
tmp = a + fb * ol; //mix input (left only!) & feedback
f0 = f * (f0 - tmp) + tmp; //low-pass filter
tmp = lx * f0 + hx * tmp;
-
+
g =(tmp<0.0f)? -tmp : tmp; //simple limiter
e *= r; if(g>e) e = g;
if(e>1.0f) tmp /= e;
*(buffer + i) = tmp; //delay input
-
+
ol *= w; //wet
*++out1 = c + y * a + ol; //dry
- *++out2 = d + y * b + ol;
+ *++out2 = d + y * b + ol;
}
ipos = i;
dlbuf=dl;
@@ -248,8 +248,8 @@ void mdaDubDelay::processReplacing(float **inputs, float **outputs, LvzInt32 sam
float twopi=6.2831853f;
long i=ipos, l, s=size, k=0;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
@@ -266,33 +266,33 @@ void mdaDubDelay::processReplacing(float **inputs, float **outputs, LvzInt32 sam
}
k--;
dl += ddl; //lin interp between points
-
+
i--; if(i<0) i=s; //delay positions
-
+
l = (long)dl;
tmp = dl - (float)l; //remainder
l += i; if(l>s) l-=(s+1);
-
+
ol = *(buffer + l); //delay output
-
- l++; if(l>s) l=0;
+
+ l++; if(l>s) l=0;
ol += tmp * (*(buffer + l) - ol); //lin interp
tmp = a + fb * ol; //mix input (left only!) & feedback
f0 = f * (f0 - tmp) + tmp; //low-pass filter
tmp = lx * f0 + hx * tmp;
-
+
g =(tmp<0.0f)? -tmp : tmp; //simple limiter
e *= r; if(g>e) e = g;
if(e>1.0f) tmp /= e;
*(buffer + i) = tmp; //delay input
-
+
ol *= w; //wet
*++out1 = y * a + ol; //dry
- *++out2 = y * b + ol;
+ *++out2 = y * b + ol;
}
ipos = i;
dlbuf=dl;
diff --git a/src/mdaDynamics.cpp b/src/mdaDynamics.cpp
index d847a50..f4b7901 100644
--- a/src/mdaDynamics.cpp
+++ b/src/mdaDynamics.cpp
@@ -23,7 +23,7 @@ mdaDynamics::mdaDynamics(audioMasterCallback audioMaster) : AudioEffectX(audioMa
setNumInputs(2); // stereo in
setNumOutputs(2); // stereo out
setUniqueID("mdaDynamics"); // identify
- DECLARE_LVZ_DEPRECATED(canMono) ();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
canProcessReplacing(); // supports both accumulating and replacing output
strcpy(programName, "Dynamics"); // default program name
@@ -67,7 +67,7 @@ void mdaDynamics::setParameter(LvzInt32 index, float value)
//calcs here
mode=0;
thr = (float)pow(10.f, 2.f * fParam1 - 2.f);
- rat = 2.5f * fParam2 - 0.5f;
+ rat = 2.5f * fParam2 - 0.5f;
if(rat>1.0) { rat = 1.f + 16.f*(rat-1.f) * (rat - 1.f); mode = 1; }
if(rat<0.0) { rat = 0.6f*rat; mode=1; }
trim = (float)pow(10.f, 2.f * fParam3); //was - 1.f);
@@ -75,11 +75,11 @@ void mdaDynamics::setParameter(LvzInt32 index, float value)
rel = (float)pow(10.f, -2.f - 3.f * fParam5);
if(fParam6>0.98) lthr=0.f; //limiter
- else { lthr=0.99f*(float)pow(10.0f,int(30.0*fParam6 - 20.0)/20.f);
- mode=1; }
-
+ else { lthr=0.99f*(float)pow(10.0f,int(30.0*fParam6 - 20.0)/20.f);
+ mode=1; }
+
if(fParam7<0.02) { xthr=0.f; } //expander
- else { xthr=(float)pow(10.f,3.f * fParam7 - 3.f); mode=1; }
+ else { xthr=(float)pow(10.f,3.f * fParam7 - 3.f); mode=1; }
xrat = 1.f - (float)pow(10.f, -2.f - 3.3f * fParam9);
irel = (float)pow(10.0,-2.0/getSampleRate());
gatt = (float)pow(10.f, -0.002f - 3.f * fParam8);
@@ -135,18 +135,18 @@ void mdaDynamics::getParameterDisplay(LvzInt32 index, char *text)
switch(index)
{
case 0: long2string((long)(40.0*fParam1 - 40.0),text); break;
- case 1: if(fParam2>0.58)
- { if(fParam2<0.62) strcpy(text, "Limit");
+ case 1: if(fParam2>0.58)
+ { if(fParam2<0.62) strcpy(text, "Limit");
else float2strng(-rat,text); }
- else
- { if(fParam2<0.2) float2strng(0.5f+2.5f*fParam2,text);
+ else
+ { if(fParam2<0.2) float2strng(0.5f+2.5f*fParam2,text);
else float2strng(1.f/(1.f-rat),text); } break;
case 2: long2string((long)(40.0*fParam3 - 0.0),text); break; ///was -20.0
case 3: long2string((long)(-301030.1 / (getSampleRate() * log10(1.0 - att))),text); break;
case 4: long2string((long)(-301.0301 / (getSampleRate() * log10(1.0 - rel))),text); break;
- case 5: if(lthr==0.f) strcpy(text, "OFF");
+ case 5: if(lthr==0.f) strcpy(text, "OFF");
else long2string((long)(30.0*fParam6 - 20.0),text); break;
- case 6: if(xthr==0.f) strcpy(text, "OFF");
+ case 6: if(xthr==0.f) strcpy(text, "OFF");
else long2string((long)(60.0*fParam7 - 60.0),text); break;
case 7: long2string((long)(-301030.1 / (getSampleRate() * log10(1.0 - gatt))),text); break;
case 8: long2string((long)(-1806.0 / (getSampleRate() * log10(xrat))),text); break;
@@ -161,14 +161,14 @@ void mdaDynamics::getParameterLabel(LvzInt32 index, char *label)
{
case 0: strcpy(label, "dB"); break;
case 1: strcpy(label, ":1"); break;
- case 2: strcpy(label, "dB"); break;
- case 3: strcpy(label, "µs"); break;
- case 4: strcpy(label, "ms"); break;
- case 5: strcpy(label, "dB"); break;
- case 6: strcpy(label, "dB"); break;
- case 7: strcpy(label, "µs"); break;
- case 8: strcpy(label, "ms"); break;
- case 9: strcpy(label, "%"); break;
+ case 2: strcpy(label, "dB"); break;
+ case 3: strcpy(label, "µs"); break;
+ case 4: strcpy(label, "ms"); break;
+ case 5: strcpy(label, "dB"); break;
+ case 6: strcpy(label, "dB"); break;
+ case 7: strcpy(label, "µs"); break;
+ case 8: strcpy(label, "ms"); break;
+ case 9: strcpy(label, "%"); break;
}
}
@@ -183,9 +183,9 @@ void mdaDynamics::process(float **inputs, float **outputs, LvzInt32 sampleFrames
float *out2 = outputs[1];
float a, b, c, d, i, j, g, e=env, e2=env2, ra=rat, re=(1.f-rel), at=att, ga=gatt;
float tr=trim, th=thr, lth=lthr, xth=xthr, ge=genv, y=dry;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
@@ -198,24 +198,24 @@ void mdaDynamics::process(float **inputs, float **outputs, LvzInt32 sampleFrames
b = *++in2;
c = out1[1];
d = out2[1];
-
+
i = (a<0.f)? -a : a;
j = (b<0.f)? -b : b;
i = (j>i)? j : i;
-
+
e = (i>e)? e + at * (i - e) : e * re;
e2 = (i>e)? i : e2 * re; //ir;
g = (e>th)? tr / (1.f + ra * ((e/th) - 1.f)) : tr;
if(g<0.f) g=0.f;
- if(g*e2>lth) g = lth/e2; //limit
+ if(g*e2>lth) g = lth/e2; //limit
ge = (e>xth)? ge + ga - ga * ge : ge * xrat; //gate
c += a * (g * ge + y);
d += b * (g * ge + y);
- *++out1 = c;
+ *++out1 = c;
*++out2 = d;
}
}
@@ -227,18 +227,18 @@ void mdaDynamics::process(float **inputs, float **outputs, LvzInt32 sampleFrames
b = *++in2;
c = out1[1];
d = out2[1];
-
+
i = (a<0.f)? -a : a;
j = (b<0.f)? -b : b;
i = (j>i)? j : i;
-
+
e = (i>e)? e + at * (i - e) : e * re;
g = (e>th)? tr / (1.f + ra * ((e/th) - 1.f)) : tr;
c += a * (g + y);
d += b * (g + y);
- *++out1 = c;
+ *++out1 = c;
*++out2 = d;
}
}
@@ -254,9 +254,9 @@ void mdaDynamics::processReplacing(float **inputs, float **outputs, LvzInt32 sam
float *out1 = outputs[0];
float *out2 = outputs[1];
float a, b, i, j, g, e=env, e2=env2, ra=rat, re=(1.f-rel), at=att, ga=gatt;
- float tr=trim, th=thr, lth=lthr, xth=xthr, ge=genv, y=dry;
- --in1;
- --in2;
+ float tr=trim, th=thr, lth=lthr, xth=xthr, ge=genv, y=dry;
+ --in1;
+ --in2;
--out1;
--out2;
@@ -267,23 +267,23 @@ void mdaDynamics::processReplacing(float **inputs, float **outputs, LvzInt32 sam
{
a = *++in1;
b = *++in2;
-
+
i = (a<0.f)? -a : a;
j = (b<0.f)? -b : b;
i = (j>i)? j : i;
-
+
e = (i>e)? e + at * (i - e) : e * re;
e2 = (i>e)? i : e2 * re; //ir;
-
+
g = (e>th)? tr / (1.f + ra * ((e/th) - 1.f)) : tr;
- if(g<0.f) g=0.f;
- if(g*e2>lth) g = lth/e2; //limit
+ if(g<0.f) g=0.f;
+ if(g*e2>lth) g = lth/e2; //limit
ge = (e>xth)? ge + ga - ga * ge : ge * xrat; //gate
- *++out1 = a * (g * ge + y);
- *++out2 = b * (g * ge + y);
+ *++out1 = a * (g * ge + y);
+ *++out2 = b * (g * ge + y);
}
}
else //compressor only
@@ -292,16 +292,16 @@ void mdaDynamics::processReplacing(float **inputs, float **outputs, LvzInt32 sam
{
a = *++in1;
b = *++in2;
-
+
i = (a<0.f)? -a : a;
j = (b<0.f)? -b : b;
i = (j>i)? j : i; //get peak level
-
+
e = (i>e)? e + at * (i - e) : e * re; //envelope
g = (e>th)? tr / (1.f + ra * ((e/th) - 1.f)) : tr; //gain
*++out1 = a * (g + y); //vca
- *++out2 = b * (g + y);
+ *++out2 = b * (g + y);
}
}
if(e <1.0e-10) env =0.f; else env =e;
diff --git a/src/mdaEPiano.cpp b/src/mdaEPiano.cpp
index 55586f0..61ffcb5 100644
--- a/src/mdaEPiano.cpp
+++ b/src/mdaEPiano.cpp
@@ -30,12 +30,12 @@ mdaEPiano::mdaEPiano(audioMasterCallback audioMaster) : AudioEffectX(audioMaster
fillpatch(i++, " ", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.146f, 0.000f);
setProgram(0);
}
-
+
setUniqueID("mdaEPiano");
if(audioMaster)
{
- setNumInputs(0);
+ setNumInputs(0);
setNumOutputs(NOUTS);
canProcessReplacing();
isSynth();
@@ -56,39 +56,39 @@ mdaEPiano::mdaEPiano(audioMasterCallback audioMaster) : AudioEffectX(audioMaster
kgrp[27].root = 91; kgrp[27].high = 93; //G5
kgrp[30].root = 96; kgrp[30].high =999; //C6
- kgrp[0].pos = 0; kgrp[0].end = 8476; kgrp[0].loop = 4400;
- kgrp[1].pos = 8477; kgrp[1].end = 16248; kgrp[1].loop = 4903;
- kgrp[2].pos = 16249; kgrp[2].end = 34565; kgrp[2].loop = 6398;
- kgrp[3].pos = 34566; kgrp[3].end = 41384; kgrp[3].loop = 3938;
- kgrp[4].pos = 41385; kgrp[4].end = 45760; kgrp[4].loop = 1633; //was 1636;
- kgrp[5].pos = 45761; kgrp[5].end = 65211; kgrp[5].loop = 5245;
- kgrp[6].pos = 65212; kgrp[6].end = 72897; kgrp[6].loop = 2937;
- kgrp[7].pos = 72898; kgrp[7].end = 78626; kgrp[7].loop = 2203; //was 2204;
- kgrp[8].pos = 78627; kgrp[8].end = 100387; kgrp[8].loop = 6368;
- kgrp[9].pos = 100388; kgrp[9].end = 116297; kgrp[9].loop = 10452;
- kgrp[10].pos = 116298; kgrp[10].end = 127661; kgrp[10].loop = 5217; //was 5220;
- kgrp[11].pos = 127662; kgrp[11].end = 144113; kgrp[11].loop = 3099;
- kgrp[12].pos = 144114; kgrp[12].end = 152863; kgrp[12].loop = 4284;
- kgrp[13].pos = 152864; kgrp[13].end = 173107; kgrp[13].loop = 3916;
- kgrp[14].pos = 173108; kgrp[14].end = 192734; kgrp[14].loop = 2937;
- kgrp[15].pos = 192735; kgrp[15].end = 204598; kgrp[15].loop = 4732;
- kgrp[16].pos = 204599; kgrp[16].end = 218995; kgrp[16].loop = 4733;
- kgrp[17].pos = 218996; kgrp[17].end = 233801; kgrp[17].loop = 2285;
- kgrp[18].pos = 233802; kgrp[18].end = 248011; kgrp[18].loop = 4098;
- kgrp[19].pos = 248012; kgrp[19].end = 265287; kgrp[19].loop = 4099;
- kgrp[20].pos = 265288; kgrp[20].end = 282255; kgrp[20].loop = 3609;
- kgrp[21].pos = 282256; kgrp[21].end = 293776; kgrp[21].loop = 2446;
- kgrp[22].pos = 293777; kgrp[22].end = 312566; kgrp[22].loop = 6278;
- kgrp[23].pos = 312567; kgrp[23].end = 330200; kgrp[23].loop = 2283;
- kgrp[24].pos = 330201; kgrp[24].end = 348889; kgrp[24].loop = 2689;
- kgrp[25].pos = 348890; kgrp[25].end = 365675; kgrp[25].loop = 4370;
- kgrp[26].pos = 365676; kgrp[26].end = 383661; kgrp[26].loop = 5225;
- kgrp[27].pos = 383662; kgrp[27].end = 393372; kgrp[27].loop = 2811;
+ kgrp[0].pos = 0; kgrp[0].end = 8476; kgrp[0].loop = 4400;
+ kgrp[1].pos = 8477; kgrp[1].end = 16248; kgrp[1].loop = 4903;
+ kgrp[2].pos = 16249; kgrp[2].end = 34565; kgrp[2].loop = 6398;
+ kgrp[3].pos = 34566; kgrp[3].end = 41384; kgrp[3].loop = 3938;
+ kgrp[4].pos = 41385; kgrp[4].end = 45760; kgrp[4].loop = 1633; //was 1636;
+ kgrp[5].pos = 45761; kgrp[5].end = 65211; kgrp[5].loop = 5245;
+ kgrp[6].pos = 65212; kgrp[6].end = 72897; kgrp[6].loop = 2937;
+ kgrp[7].pos = 72898; kgrp[7].end = 78626; kgrp[7].loop = 2203; //was 2204;
+ kgrp[8].pos = 78627; kgrp[8].end = 100387; kgrp[8].loop = 6368;
+ kgrp[9].pos = 100388; kgrp[9].end = 116297; kgrp[9].loop = 10452;
+ kgrp[10].pos = 116298; kgrp[10].end = 127661; kgrp[10].loop = 5217; //was 5220;
+ kgrp[11].pos = 127662; kgrp[11].end = 144113; kgrp[11].loop = 3099;
+ kgrp[12].pos = 144114; kgrp[12].end = 152863; kgrp[12].loop = 4284;
+ kgrp[13].pos = 152864; kgrp[13].end = 173107; kgrp[13].loop = 3916;
+ kgrp[14].pos = 173108; kgrp[14].end = 192734; kgrp[14].loop = 2937;
+ kgrp[15].pos = 192735; kgrp[15].end = 204598; kgrp[15].loop = 4732;
+ kgrp[16].pos = 204599; kgrp[16].end = 218995; kgrp[16].loop = 4733;
+ kgrp[17].pos = 218996; kgrp[17].end = 233801; kgrp[17].loop = 2285;
+ kgrp[18].pos = 233802; kgrp[18].end = 248011; kgrp[18].loop = 4098;
+ kgrp[19].pos = 248012; kgrp[19].end = 265287; kgrp[19].loop = 4099;
+ kgrp[20].pos = 265288; kgrp[20].end = 282255; kgrp[20].loop = 3609;
+ kgrp[21].pos = 282256; kgrp[21].end = 293776; kgrp[21].loop = 2446;
+ kgrp[22].pos = 293777; kgrp[22].end = 312566; kgrp[22].loop = 6278;
+ kgrp[23].pos = 312567; kgrp[23].end = 330200; kgrp[23].loop = 2283;
+ kgrp[24].pos = 330201; kgrp[24].end = 348889; kgrp[24].loop = 2689;
+ kgrp[25].pos = 348890; kgrp[25].end = 365675; kgrp[25].loop = 4370;
+ kgrp[26].pos = 365676; kgrp[26].end = 383661; kgrp[26].loop = 5225;
+ kgrp[27].pos = 383662; kgrp[27].end = 393372; kgrp[27].loop = 2811;
kgrp[28].pos = 383662; kgrp[28].end = 393372; kgrp[28].loop = 2811; //ghost
- kgrp[29].pos = 393373; kgrp[29].end = 406045; kgrp[29].loop = 4522;
- kgrp[30].pos = 406046; kgrp[30].end = 414486; kgrp[30].loop = 2306;
+ kgrp[29].pos = 393373; kgrp[29].end = 406045; kgrp[29].loop = 4522;
+ kgrp[30].pos = 406046; kgrp[30].end = 414486; kgrp[30].loop = 2306;
kgrp[31].pos = 406046; kgrp[31].end = 414486; kgrp[31].loop = 2306; //ghost
- kgrp[32].pos = 414487; kgrp[32].end = 422408; kgrp[32].loop = 2169;
+ kgrp[32].pos = 414487; kgrp[32].end = 422408; kgrp[32].loop = 2169;
//extra xfade looping...
for(long k=0; k<28; k++)
@@ -109,7 +109,7 @@ mdaEPiano::mdaEPiano(audioMasterCallback audioMaster) : AudioEffectX(audioMaster
}
//initialise...
- for(long v=0; v<NVOICES; v++)
+ for(long v=0; v<NVOICES; v++)
{
voice[v].env = 0.0f;
voice[v].dec = 0.99f; //all notes off
@@ -130,7 +130,7 @@ mdaEPiano::mdaEPiano(audioMasterCallback audioMaster) : AudioEffectX(audioMaster
void mdaEPiano::update() //parameter change
{
size = (long)(12.0f * param[2] - 6.0f);
-
+
treb = 4.0f * param[3] * param[3] - 1.0f; //treble gain
if(param[3] > 0.5f) tfrq = 14000.0f; else tfrq = 5000.0f; //treble freq
tfrq = 1.0f - (float)exp(-iFs * tfrq);
@@ -142,7 +142,7 @@ void mdaEPiano::update() //parameter change
velsens = 1.0f + param[6] + param[6];
if(param[6] < 0.25f) velsens -= 0.75f - 3.0f * param[6];
-
+
width = 0.03f * param[7];
poly = 1 + (long)(31.9f * param[8]);
fine = param[9] - 0.5f;
@@ -153,7 +153,7 @@ void mdaEPiano::update() //parameter change
void mdaEPiano::resume()
-{
+{
Fs = getSampleRate();
iFs = 1.0f / Fs;
dlfo = 6.283f * iFs * (float)exp(6.22f * param[5] - 2.61f); //lfo rate
@@ -264,11 +264,11 @@ void mdaEPiano::getParameterName(LvzInt32 index, char *label)
case 0: strcpy(label, "Envelope Decay"); break;
case 1: strcpy(label, "Envelope Release"); break;
case 2: strcpy(label, "Hardness"); break;
-
+
case 3: strcpy(label, "Treble Boost"); break;
case 4: strcpy(label, "Modulation"); break;
case 5: strcpy(label, "LFO Rate"); break;
-
+
case 6: strcpy(label, "Velocity Sense"); break;
case 7: strcpy(label, "Stereo Width"); break;
case 8: strcpy(label, "Polyphony"); break;
@@ -283,19 +283,19 @@ void mdaEPiano::getParameterName(LvzInt32 index, char *label)
void mdaEPiano::getParameterDisplay(LvzInt32 index, char *text)
{
char string[16];
-
+
switch(index)
{
case 2:
- case 3:
+ case 3:
case 9: sprintf(string, "%.0f", 100.0f * param[index] - 50.0f); break;
-
- case 4: if(param[index] > 0.5f)
+
+ case 4: if(param[index] > 0.5f)
sprintf(string, "Trem %.0f", 200.0f * param[index] - 100.0f);
else
sprintf(string, "Pan %.0f", 100.0f - 200.0f * param[index]); break;
- case 5: sprintf(string, "%.2f", (float)exp(6.22f * param[5] - 2.61f)); break; //LFO Hz
+ case 5: sprintf(string, "%.2f", (float)exp(6.22f * param[5] - 2.61f)); break; //LFO Hz
case 7: sprintf(string, "%.0f", 200.0f * param[index]); break;
case 8: sprintf(string, "%ld", poly); break;
case 10: sprintf(string, "%.1f", 50.0f * param[index] * param[index]); break;
@@ -313,7 +313,7 @@ void mdaEPiano::getParameterLabel(LvzInt32 index, char *label)
{
case 5: strcpy(label, "Hz"); break;
case 8: strcpy(label, "voices"); break;
- case 9:
+ case 9:
case 10: strcpy(label, "cents"); break;
default: strcpy(label, "%");
}
@@ -364,14 +364,14 @@ void mdaEPiano::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
l += V->outl * x;
r += V->outr * x;
-
+
V++;
}
tl += tfrq * (l - tl); //treble boost
tr += tfrq * (r - tr);
r += treb * (r - tr);
l += treb * (l - tl);
-
+
lfo0 += dlfo * lfo1; //LFO for tremolo and autopan
lfo1 -= dlfo * lfo0;
l += l * lmod * lfo1;
@@ -383,7 +383,7 @@ void mdaEPiano::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
if(frame<sampleFrames)
{
- if(activevoices == 0 && param[4] > 0.5f)
+ if(activevoices == 0 && param[4] > 0.5f)
{ lfo0 = -0.7071f; lfo1 = 0.7071f; } //reset LFO phase - good idea?
long note = notes[event++];
long vel = notes[event++];
@@ -392,7 +392,7 @@ void mdaEPiano::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
}
if(fabs(tl)<1.0e-10) tl = 0.0f; //anti-denormal
if(fabs(tr)<1.0e-10) tr = 0.0f;
-
+
for(v=0; v<activevoices; v++) if(voice[v].env < SILENCE) voice[v] = voice[--activevoices];
notes[0] = EVENTS_DONE; //mark events buffer as done
}
@@ -427,7 +427,7 @@ void mdaEPiano::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
//i = waves[V->pos];
//i = (i << 7) + (V->frac >> 9) * (waves[V->pos + 1] - i) + 0x40400000; //not working on intel mac !?!
//x = V->env * (*(float *)&i - 3.0f); //fast int->float
- //x = V->env * (float)i / 32768.0f;
+ //x = V->env * (float)i / 32768.0f;
i = waves[V->pos] + ((V->frac * (waves[V->pos + 1] - waves[V->pos])) >> 16);
x = V->env * (float)i / 32768.0f;
@@ -437,14 +437,14 @@ void mdaEPiano::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
l += V->outl * x;
r += V->outr * x;
-
+
V++;
}
tl += tfrq * (l - tl); //treble boost
tr += tfrq * (r - tr);
r += treb * (r - tr);
l += treb * (l - tl);
-
+
lfo0 += dlfo * lfo1; //LFO for tremolo and autopan
lfo1 -= dlfo * lfo0;
l += l * lmod * lfo1;
@@ -456,7 +456,7 @@ void mdaEPiano::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
if(frame<sampleFrames)
{
- if(activevoices == 0 && param[4] > 0.5f)
+ if(activevoices == 0 && param[4] > 0.5f)
{ lfo0 = -0.7071f; lfo1 = 0.7071f; } //reset LFO phase - good idea?
long note = notes[event++];
long vel = notes[event++];
@@ -465,7 +465,7 @@ void mdaEPiano::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
}
if(fabs(tl)<1.0e-10) tl = 0.0f; //anti-denormal
if(fabs(tr)<1.0e-10) tr = 0.0f;
-
+
for(v=0; v<activevoices; v++) if(voice[v].env < SILENCE) voice[v] = voice[--activevoices];
notes[0] = EVENTS_DONE; //mark events buffer as done
}
@@ -475,8 +475,8 @@ void mdaEPiano::noteOn(long note, long velocity)
{
float l=99.0f;
long v, vl=0, k, s;
-
- if(velocity > 0)
+
+ if(velocity > 0)
{
if(activevoices < poly) //add a note
{
@@ -497,7 +497,7 @@ void mdaEPiano::noteOn(long note, long velocity)
if(note > 60) l += stretch * (float)k; //stretch
s = size;
- if(velocity > 40) s += (long)(sizevel * (float)(velocity - 40));
+ if(velocity > 40) s += (long)(sizevel * (float)(velocity - 40));
k = 0;
while(note > (kgrp[k].high + s)) k += 3; //find keygroup
@@ -513,7 +513,7 @@ void mdaEPiano::noteOn(long note, long velocity)
voice[vl].loop = kgrp[k].loop;
voice[vl].env = (3.0f + 2.0f * velsens) * (float)pow(0.0078f * velocity, velsens); //velocity
-
+
if(note > 60) voice[vl].env *= (float)exp(0.01f * (float)(60 - note)); //new! high notes quieter
l = 50.0f + param[4] * param[4] * muff + muffvel * (float)(velocity - 64); //muffle
@@ -548,13 +548,13 @@ void mdaEPiano::noteOn(long note, long velocity)
LvzInt32 mdaEPiano::processEvents(LvzEvents* ev)
{
long npos=0;
-
+
for (long i=0; i<ev->numEvents; i++)
{
if((ev->events[i])->type != kLvzMidiType) continue;
LvzMidiEvent* event = (LvzMidiEvent*)ev->events[i];
char* midiData = event->midiData;
-
+
switch(midiData[0] & 0xf0) //status byte (all channels)
{
case 0x80: //note off
@@ -581,11 +581,11 @@ LvzInt32 mdaEPiano::processEvents(LvzEvents* ev)
}
break;
-
+
case 0x07: //volume
volume = 0.00002f * (float)(midiData[2] * midiData[2]);
break;
-
+
case 0x40: //sustain pedal
case 0x42: //sustenuto pedal
sustain = midiData[2] & 0x40;
@@ -598,8 +598,8 @@ LvzInt32 mdaEPiano::processEvents(LvzEvents* ev)
break;
default: //all notes off
- if(midiData[1]>0x7A)
- {
+ if(midiData[1]>0x7A)
+ {
for(long v=0; v<NVOICES; v++) voice[v].dec=0.99f;
sustain = 0;
muff = 160.0f;
@@ -611,7 +611,7 @@ LvzInt32 mdaEPiano::processEvents(LvzEvents* ev)
case 0xC0: //program change
if(midiData[1]<NPROGS) setProgram(midiData[1]);
break;
-
+
default: break;
}
diff --git a/src/mdaEPiano.h b/src/mdaEPiano.h
index feb13e3..5e85e5f 100644
--- a/src/mdaEPiano.h
+++ b/src/mdaEPiano.h
@@ -35,7 +35,7 @@ struct VOICE //voice state
long pos;
long end;
long loop;
-
+
float env; //envelope
float dec;
diff --git a/src/mdaImage.cpp b/src/mdaImage.cpp
index 8dad7fe..a59b1ed 100644
--- a/src/mdaImage.cpp
+++ b/src/mdaImage.cpp
@@ -17,13 +17,13 @@ mdaImage::mdaImage(audioMasterCallback audioMaster) : AudioEffectX(audioMaster,
fParam5 = 0.5f; //balance
fParam6 = 0.5f; //output
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaImage"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Stereo Image / MS Matrix");
-
+
setParameter(0, 0.6f); //go and set initial values!
}
@@ -72,9 +72,9 @@ void mdaImage::setParameter(LvzInt32 index, float value)
case 2: //LR->LR
g *= 0.5f;
- l2l = g * (c * (2.f - b) + w * (2.f - k));
- r2l = g * (c * (2.f - b) - w * (2.f - k));
- l2r = g * (c * b - w * k);
+ l2l = g * (c * (2.f - b) + w * (2.f - k));
+ r2l = g * (c * (2.f - b) - w * (2.f - k));
+ l2r = g * (c * b - w * k);
r2r = g * (c * b + w * k);
break;
@@ -82,7 +82,7 @@ void mdaImage::setParameter(LvzInt32 index, float value)
g *= 0.5f;
l2l = g * (2.f - b) * (2.f - k);
r2l = g * (2.f - b) * k;
- l2r = -g * b * (2.f - k);
+ l2r = -g * b * (2.f - k);
r2r = g * b * k;
break;
}
@@ -143,7 +143,7 @@ void mdaImage::getParameterDisplay(LvzInt32 index, char *text)
switch(index)
{
case 0: switch(int(fParam1*3.9))
- {
+ {
case 0: strcpy(text, "SM->LR"); break;
case 1: strcpy(text, "MS->LR"); break;
case 2: strcpy(text, "LR->LR"); break;
@@ -180,24 +180,24 @@ void mdaImage::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d, ll=l2l, lr=l2r, rl=r2l, rr=r2r;
+ float a, b, c, d, ll=l2l, lr=l2r, rl=r2l, rr=r2r;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
-
+
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
c = out1[1];
d = out2[1]; //process from here...
d += rr*b + lr*a;
- c += ll*a + rl*b;
+ c += ll*a + rl*b;
- *++out1 = c;
+ *++out1 = c;
*++out2 = d;
}
}
@@ -208,22 +208,22 @@ void mdaImage::processReplacing(float **inputs, float **outputs, LvzInt32 sample
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d, ll=l2l, lr=l2r, rl=r2l, rr=r2r;
+ float a, b, c, d, ll=l2l, lr=l2r, rl=r2l, rr=r2r;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
- d = rr*b + lr*a;
+ d = rr*b + lr*a;
c = ll*a + rl*b;
- *++out1 = c;
+ *++out1 = c;
*++out2 = d;
}
}
diff --git a/src/mdaLeslie.cpp b/src/mdaLeslie.cpp
index 5893cc3..c45e703 100644
--- a/src/mdaLeslie.cpp
+++ b/src/mdaLeslie.cpp
@@ -25,7 +25,7 @@ mdaLeslieProgram::mdaLeslieProgram()
strcpy(name, "Leslie Simulator");
}
-mdaLeslie::mdaLeslie(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 3, 9) // programs, parameters
+mdaLeslie::mdaLeslie(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 3, 9) // programs, parameters
{
fParam1 = 0.66f;
fParam7 = 0.50f;
@@ -41,16 +41,16 @@ mdaLeslie::mdaLeslie(audioMasterCallback audioMaster) : AudioEffectX(audioMaster
hbuf = new float[size];
fbuf1 = fbuf2 = 0.0f;
twopi = 6.2831853f;
-
- setNumInputs(2);
- setNumOutputs(2);
+
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaLeslie"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
- suspend();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
+ suspend();
- programs = new mdaLeslieProgram[numPrograms];
- if(programs)
+ programs = new mdaLeslieProgram[numPrograms];
+ if(programs)
{
programs[1].fParam1 = 0.33f;
programs[1].fParam5 = 0.75f;
@@ -66,7 +66,7 @@ mdaLeslie::mdaLeslie(audioMasterCallback audioMaster) : AudioEffectX(audioMaster
chp = dchp = clp = dclp = shp = dshp = slp = dslp = 0.0f;
lspd = 0.0f; hspd = 0.0f;
- lphi = 0.0f; hphi = 1.6f;
+ lphi = 0.0f; hphi = 1.6f;
setParameter(0, 0.66f);
}
@@ -76,7 +76,7 @@ bool mdaLeslie::getEffectName(char* name) { strcpy(name, "Leslie"); return t
void mdaLeslie::setParameter(LvzInt32 index, float value)
{
-
+
float ifs = 1.0f / getSampleRate();
float spd = twopi * ifs * 2.0f * fParam8;
@@ -96,25 +96,25 @@ void mdaLeslie::setParameter(LvzInt32 index, float value)
filo = 1.f - (float)pow(10.0f, fParam3 * (2.27f - 0.54f * fParam3) - 1.92f);
if(fParam1<0.50f)
- {
+ {
if(fParam1<0.1f) //stop
- {
+ {
lset = 0.00f; hset = 0.00f;
- lmom = 0.12f; hmom = 0.10f;
+ lmom = 0.12f; hmom = 0.10f;
}
else //low speed
- {
+ {
lset = 0.49f; hset = 0.66f;
lmom = 0.27f; hmom = 0.18f;
}
}
else //high speed
- {
+ {
lset = 5.31f; hset = 6.40f;
lmom = 0.14f; hmom = 0.09f;
}
hmom = (float)pow(10.0f, -ifs / hmom);
- lmom = (float)pow(10.0f, -ifs / lmom);
+ lmom = (float)pow(10.0f, -ifs / lmom);
hset *= spd;
lset *= spd;
@@ -129,23 +129,23 @@ void mdaLeslie::setParameter(LvzInt32 index, float value)
mdaLeslie::~mdaLeslie()
{
if(hbuf) delete [] hbuf;
- if(programs) delete [] programs;
+ if(programs) delete [] programs;
}
-void mdaLeslie::setProgram(LvzInt32 program)
+void mdaLeslie::setProgram(LvzInt32 program)
{
mdaLeslieProgram *p = &programs[program];
curProgram = program;
- setParameter(0, p->fParam1);
- setParameter(1, p->fParam7);
- setParameter(2, p->fParam9);
- setParameter(3, p->fParam4);
- setParameter(4, p->fParam5);
+ setParameter(0, p->fParam1);
+ setParameter(1, p->fParam7);
+ setParameter(2, p->fParam9);
+ setParameter(3, p->fParam4);
+ setParameter(4, p->fParam5);
setParameter(5, p->fParam6);
- setParameter(6, p->fParam3);
+ setParameter(6, p->fParam3);
setParameter(7, p->fParam2);
- setParameter(8, p->fParam8);
+ setParameter(8, p->fParam8);
setProgramName(p->name);
}
@@ -206,18 +206,18 @@ void mdaLeslie::getParameterDisplay(LvzInt32 index, char *text)
{
switch(index)
{
- case 0:
- if(fParam1<0.5f)
- {
- if(fParam1 < 0.1f) strcpy(text, "STOP");
+ case 0:
+ if(fParam1<0.5f)
+ {
+ if(fParam1 < 0.1f) strcpy(text, "STOP");
else strcpy(text, "SLOW");
- } else strcpy(text, "FAST"); break;
+ } else strcpy(text, "FAST"); break;
case 1: long2string((long)(100 * fParam7), text); break;
case 2: long2string((long)(100 * fParam9), text); break;
case 3: long2string((long)(100 * fParam4), text); break;
case 4: long2string((long)(100 * fParam5), text); break;
case 5: long2string((long)(100 * fParam6), text); break;
- case 6: long2string((long)(10*int((float)pow(10.0f,1.179f + fParam3))), text); break;
+ case 6: long2string((long)(10*int((float)pow(10.0f,1.179f + fParam3))), text); break;
case 7: long2string((long)(40 * fParam2 - 20), text); break;
case 8: long2string((long)(200 * fParam8), text); break;
}
@@ -242,7 +242,7 @@ void mdaLeslie::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, c, d, g=gain, h, l;
+ float a, c, d, g=gain, h, l;
float fo=filo, fb1=fbuf1, fb2=fbuf2;
float hl=hlev, hs=hspd, ht, hm=hmom, hp=hphi, hw=hwid, hd=hdep;
float ll=llev, ls=lspd, lt, lm=lmom, lp=lphi, lw=lwid;
@@ -257,40 +257,40 @@ void mdaLeslie::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
shp = (float)sin(hp);
slp = (float)sin(lp);
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1 + *++in2;
+ a = *++in1 + *++in2;
c = out1[1];
d = out2[1]; //see processReplacing() for comments
- if(k) k--; else
+ if(k) k--; else
{
- ls = (lm * ls) + lt;
+ ls = (lm * ls) + lt;
hs = (hm * hs) + ht;
lp += k1 * ls;
hp += k1 * hs;
-
+
dchp = (float)cos(hp + k1*hs);
- dchp = k0 * (dchp * dchp * dchp - chp);
+ dchp = k0 * (dchp * dchp * dchp - chp);
dclp = k0 * ((float)cos(lp + k1*ls) - clp);
dshp = k0 * ((float)sin(hp + k1*hs) - shp);
dslp = k0 * ((float)sin(lp + k1*ls) - slp);
-
+
k=(long)k1;
}
fb1 = fo * (fb1 - a) + a;
- fb2 = fo * (fb2 - fb1) + fb1;
+ fb2 = fo * (fb2 - fb1) + fb1;
h = (g - hl * chp) * (a - fb2);
l = (g - ll * clp) * fb2;
- if(hps>0) hps--; else hps=200;
+ if(hps>0) hps--; else hps=200;
hint = hps + hd * (1.0f + chp);
- hdd = (int)hint;
+ hdd = (int)hint;
hint = hint - hdd;
hdd2 = hdd + 1;
if(hdd>199) { if(hdd>200) hdd -= 201; hdd2 -= 201; }
@@ -319,8 +319,8 @@ void mdaLeslie::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
hpos = hps;
lphi = (float)fmod(lp+(k1-k)*ls,twopi);
hphi = (float)fmod(hp+(k1-k)*hs,twopi);
- if(fabs(fb1)>1.0e-10) fbuf1=fb1; else fbuf1=0.f;
- if(fabs(fb2)>1.0e-10) fbuf2=fb2; else fbuf2=0.f;
+ if(fabs(fb1)>1.0e-10) fbuf1=fb1; else fbuf1=0.f;
+ if(fabs(fb2)>1.0e-10) fbuf2=fb2; else fbuf2=0.f;
}
void mdaLeslie::processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames)
@@ -329,7 +329,7 @@ void mdaLeslie::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, c, d, g=gain, h, l;
+ float a, c, d, g=gain, h, l;
float fo=filo, fb1=fbuf1, fb2=fbuf2;
float hl=hlev, hs=hspd, ht, hm=hmom, hp=hphi, hw=hwid, hd=hdep;
float ll=llev, ls=lspd, lt, lm=lmom, lp=lphi, lw=lwid;
@@ -344,8 +344,8 @@ void mdaLeslie::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
shp = (float)sin(hp);
slp = (float)sin(lp);
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
@@ -358,24 +358,24 @@ void mdaLeslie::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
hs = (hm * hs) + ht;
lp += k1 * ls;
hp += k1 * hs;
-
+
dchp = (float)cos(hp + k1*hs);
dchp = k0 * (dchp * dchp * dchp - chp); //sin^3 level mod
dclp = k0 * ((float)cos(lp + k1*ls) - clp);
dshp = k0 * ((float)sin(hp + k1*hs) - shp);
dslp = k0 * ((float)sin(lp + k1*ls) - slp);
-
+
k=(long)k1;
}
fb1 = fo * (fb1 - a) + a; //crossover
- fb2 = fo * (fb2 - fb1) + fb1;
+ fb2 = fo * (fb2 - fb1) + fb1;
h = (g - hl * chp) * (a - fb2); //volume
l = (g - ll * clp) * fb2;
if(hps>0) hps--; else hps=200; //delay input pos
- hint = hps + hd * (1.0f + chp); //delay output pos
- hdd = (int)hint;
+ hint = hps + hd * (1.0f + chp); //delay output pos
+ hdd = (int)hint;
hint = hint - hdd; //linear intrpolation
hdd2 = hdd + 1;
if(hdd>199) { if(hdd>200) hdd -= 201; hdd2 -= 201; }
@@ -384,7 +384,7 @@ void mdaLeslie::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
a = *(hbuf + hdd);
h += a + hint * ( *(hbuf + hdd2) - a); //delay output
- c = l + h;
+ c = l + h;
d = l + h;
h *= hw * shp;
l *= lw * slp;
@@ -405,5 +405,5 @@ void mdaLeslie::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
lphi = (float)fmod(lp+(k1-k)*ls,twopi);
hphi = (float)fmod(hp+(k1-k)*hs,twopi);
if(fabs(fb1)>1.0e-10) fbuf1=fb1; else fbuf1=0.0f; //catch denormals
- if(fabs(fb2)>1.0e-10) fbuf2=fb2; else fbuf2=0.0f;
+ if(fabs(fb2)>1.0e-10) fbuf2=fb2; else fbuf2=0.0f;
}
diff --git a/src/mdaLeslie.h b/src/mdaLeslie.h
index e84f50b..c6d3675 100644
--- a/src/mdaLeslie.h
+++ b/src/mdaLeslie.h
@@ -9,9 +9,9 @@ public:
mdaLeslieProgram();
~mdaLeslieProgram() {}
-private:
+private:
friend class mdaLeslie;
- float fParam1, fParam3, fParam4, fParam5, fParam6;
+ float fParam1, fParam3, fParam4, fParam5, fParam6;
float fParam7, fParam9, fParam2, fParam8;
char name[24];
};
@@ -55,13 +55,13 @@ protected:
float filo; //crossover filter coeff
float fbuf1, fbuf2; //filter buffers
float twopi; //speed, target, momentum, phase, width, ampmod, freqmod...
- float hspd, hset, hmom, hphi, hwid, hlev, hdep;
+ float hspd, hset, hmom, hphi, hwid, hlev, hdep;
float lspd, lset, lmom, lphi, lwid, llev, gain;
float *hbuf; //HF delay buffer
long size, hpos; //buffer length & pointer
-
+
float chp, dchp, clp, dclp, shp, dshp, slp, dslp;
-
+
char programName[32];
};
diff --git a/src/mdaLimiter.cpp b/src/mdaLimiter.cpp
index 554f808..2d0399a 100644
--- a/src/mdaLimiter.cpp
+++ b/src/mdaLimiter.cpp
@@ -9,7 +9,7 @@ AudioEffect *createEffectInstance(audioMasterCallback audioMaster)
mdaLimiter::mdaLimiter(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 1, 5) // 1 program, 4 parameters
{
- fParam1 = (float)0.60; //thresh
+ fParam1 = (float)0.60; //thresh
fParam2 = (float)0.60; //trim
fParam3 = (float)0.15; //attack
fParam4 = (float)0.50; //release
@@ -18,7 +18,7 @@ mdaLimiter::mdaLimiter(audioMasterCallback audioMaster) : AudioEffectX(audioMast
setNumInputs(2); // stereo in
setNumOutputs(2); // stereo out
setUniqueID("mdaLimiter"); // identify
- DECLARE_LVZ_DEPRECATED(canMono) ();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
canProcessReplacing(); // supports both accumulating and replacing output
strcpy(programName, "Limiter"); // default program name
@@ -120,7 +120,7 @@ void mdaLimiter::getParameterDisplay(LvzInt32 index, char *text)
case 4: if(fParam5<0.5) strcpy(text, "HARD");
else strcpy(text, "SOFT"); break;
}
-
+
}
void mdaLimiter::getParameterLabel(LvzInt32 index, char *label)
@@ -129,9 +129,9 @@ void mdaLimiter::getParameterLabel(LvzInt32 index, char *label)
{
case 0: strcpy(label, "dB"); break;
case 1: strcpy(label, "dB"); break;
- case 3: strcpy(label, "µs"); break;
- case 2: strcpy(label, "ms"); break;
- case 4: strcpy(label, ""); break;
+ case 3: strcpy(label, "µs"); break;
+ case 2: strcpy(label, "ms"); break;
+ case 4: strcpy(label, ""); break;
}
}
@@ -145,15 +145,15 @@ void mdaLimiter::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float *out1 = outputs[0];
float *out2 = outputs[1];
float g, c, d, at, re, tr, th, lev, ol, or_;
-
+
th = thresh;
g = gain;
at = att;
re = rel;
tr = trim;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
@@ -172,7 +172,7 @@ void mdaLimiter::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
c += (ol * tr * g);
d += (or_ * tr * g);
- *++out1 = c;
+ *++out1 = c;
*++out2 = d;
}
}
@@ -184,14 +184,14 @@ void mdaLimiter::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
or_ = *++in2;
c = out1[1];
d = out2[1];
-
+
lev = (float)(0.5 * g * fabs(ol + or_));
-
+
if (lev > th)
{
g = g - (at * (lev - th));
}
- else
+ else
{
g = g + (float)(re * (1.0 - g));
}
@@ -199,7 +199,7 @@ void mdaLimiter::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
c += (ol * tr * g);
d += (or_ * tr * g);
- *++out1 = c;
+ *++out1 = c;
*++out2 = d;
}
}
@@ -213,15 +213,15 @@ void mdaLimiter::processReplacing(float **inputs, float **outputs, LvzInt32 samp
float *out1 = outputs[0];
float *out2 = outputs[1];
float g, at, re, tr, th, lev, ol, or_;
-
+
th = thresh;
g = gain;
at = att;
re = rel;
tr = trim;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
if(fParam5>0.5) //soft knee
@@ -234,8 +234,8 @@ void mdaLimiter::processReplacing(float **inputs, float **outputs, LvzInt32 samp
lev = (float)(1.0 / (1.0 + th * fabs(ol + or_)));
if(g>lev) { g=g-at*(g-lev); } else { g=g+re*(lev-g); }
- *++out1 = (ol * tr * g);
- *++out2 = (or_ * tr * g);
+ *++out1 = (ol * tr * g);
+ *++out2 = (or_ * tr * g);
}
}
else
@@ -244,9 +244,9 @@ void mdaLimiter::processReplacing(float **inputs, float **outputs, LvzInt32 samp
{
ol = *++in1;
or_ = *++in2;
-
+
lev = (float)(0.5 * g * fabs(ol + or_));
-
+
if (lev > th)
{
g = g - (at * (lev - th));
@@ -256,8 +256,8 @@ void mdaLimiter::processReplacing(float **inputs, float **outputs, LvzInt32 samp
g = g + (float)(re * (1.0 - g));
}
- *++out1 = (ol * tr * g);
- *++out2 = (or_ * tr * g);
+ *++out1 = (ol * tr * g);
+ *++out2 = (or_ * tr * g);
}
}
gain = g;
diff --git a/src/mdaLooplex.cpp b/src/mdaLooplex.cpp
index dd81471..8ae249f 100644
--- a/src/mdaLooplex.cpp
+++ b/src/mdaLooplex.cpp
@@ -76,7 +76,7 @@ public:
IdleList::IdleList(mdaLooplex *effect, IdleList *next) : effect(effect), next(next), remove(false)
-{
+{
if(effect && !timer) //start timer
{
#if WIN32
@@ -125,12 +125,12 @@ mdaLooplex::mdaLooplex(audioMasterCallback audioMaster) : AudioEffectX(audioMast
programs = new mdaLooplexProgram[NPROGS];
if(programs) setProgram(0);
-
+
setUniqueID("mdaLoopLex");
if(audioMaster)
{
- setNumInputs(NOUTS);
+ setNumInputs(NOUTS);
setNumOutputs(NOUTS);
canProcessReplacing();
//needIdle(); idle is broken in VST2.4
@@ -138,16 +138,16 @@ mdaLooplex::mdaLooplex(audioMasterCallback audioMaster) : AudioEffectX(audioMast
update();
suspend();
-
+
idleList.next = new IdleList(this, idleList.next); //add to idle list, start timer if not running...
}
void mdaLooplex::update() //parameter change
{
- if(fabs(param[1] - oldParam1) > 0.1f)
+ if(fabs(param[1] - oldParam1) > 0.1f)
{
- oldParam1 = param[1];
+ oldParam1 = param[1];
if(fabs(oldParam0 - param[0]) > 0.01f)
{
oldParam0 = param[0];
@@ -156,22 +156,22 @@ void mdaLooplex::update() //parameter change
}
if(param[2] > 0.5f && oldParam2 < 0.5f)
- {
+ {
if(recreq == 0) recreq = 1;
oldParam2 = param[2];
}
if(param[2] < 0.5f && oldParam2 > 0.5f)
- {
+ {
if(recreq == 1) recreq = 0;
- oldParam2 = param[2];
+ oldParam2 = param[2];
}
in_mix = 2.0f * param[3] * param[3];
-
+
in_pan = param[4];
-
+
feedback = param[5];
-
+
out_mix = 0.000030517578f * param[6] * param[6];
}
@@ -184,7 +184,7 @@ void mdaLooplex::setSampleRate(float sampleRate)
void mdaLooplex::resume()
-{
+{
//should reset position here...
bufpos = 0;
@@ -198,7 +198,7 @@ void mdaLooplex::idle()
if(bypassed)
{
if(busy) return; //only do once per bypass
- busy = 1;
+ busy = 1;
bufmax = 2 * (long)Fs * (long)(10.5f + 190.0f * param[0]);
if(buffer) delete [] buffer;
@@ -214,20 +214,20 @@ mdaLooplex::~mdaLooplex () //destroy any buffers...
{
for(IdleList *item=idleList.next; item; item=item->next) //remove from idle list, stop timer if last item
{
- if(item->effect == this)
- {
+ if(item->effect == this)
+ {
item->remove = true;
#if _WIN32 //and stop timer in case our last instance is about to unload
TimerCallback(0, 0, 0, 0);
#else
TimerCallback(0, 0);
#endif
- break;
+ break;
}
}
if(programs) delete [] programs;
-
+
if(buffer)
{
FILE *fp; //dump loop to file
@@ -236,7 +236,7 @@ mdaLooplex::~mdaLooplex () //destroy any buffers...
{
char wh[44];
memcpy(wh, "RIFF____WAVEfmt \20\0\0\0\1\0\2\0________\4\0\20\0data____", 44);
-
+
long l = 36 + buflen * 2;
wh[4] = (char)(l & 0xFF); l >>= 8;
wh[5] = (char)(l & 0xFF); l >>= 8;
@@ -260,7 +260,7 @@ mdaLooplex::~mdaLooplex () //destroy any buffers...
wh[41] = (char)(l & 0xFF); l >>= 8;
wh[42] = (char)(l & 0xFF); l >>= 8;
wh[43] = (char)(l & 0xFF);
-
+
fwrite(wh, 1, 44, fp);
#if __BIG_ENDIAN__
@@ -276,7 +276,7 @@ mdaLooplex::~mdaLooplex () //destroy any buffers...
c++;
}
#endif
-
+
fwrite(buffer, sizeof(short), buflen, fp);
fclose(fp);
}
@@ -365,13 +365,13 @@ void mdaLooplex::getParameterName(LvzInt32 index, char *label)
void mdaLooplex::getParameterDisplay(LvzInt32 index, char *text)
{
char string[16];
-
+
switch(index)
{
case 0: sprintf(string, "%4d s", (int)(10.5f + 190.0f * param[index])); break; //10 to 200 sec
case 1: sprintf(string, "%5.1f MB", (float)bufmax / 524288.0f); break;
-
+
case 2: if(recreq) strcpy(string, "RECORD"); else strcpy(string, "MONITOR"); break;
case 3:
@@ -381,9 +381,9 @@ void mdaLooplex::getParameterDisplay(LvzInt32 index, char *text)
case 5: if(param[index] < 0.01f) strcpy(string, "OFF");
else sprintf(string, "%.1f dB", 20.0f * log10(param[index])); break;
- case 4: if(param[index] < 0.505f)
+ case 4: if(param[index] < 0.505f)
{
- if(param[index] > 0.495f) strcpy(string, "C"); else
+ if(param[index] > 0.495f) strcpy(string, "C"); else
sprintf(string, "L%.0f", 100.0f - 200.0f * param[index]);
}
else sprintf(string, "R%.0f", 200.0f * param[index] - 100.0f); break;
@@ -423,7 +423,7 @@ void mdaLooplex::processReplacing(float **inputs, float **outputs, LvzInt32 samp
float l, r, dl, dr, d0 = 0.0f, d1;
float imix = in_mix, ipan = in_pan, omix = out_mix, fb = feedback * modwhl;
long x;
-
+
if((bypassed = bypass)) return;
while(frame<sampleFrames)
@@ -454,7 +454,7 @@ void mdaLooplex::processReplacing(float **inputs, float **outputs, LvzInt32 samp
#else
d0 = 0.000061f * (float)((rand() & 32767) - 16384);
#endif
-
+
//left delay
dl = fb * (float)buffer[bufpos];
if(recreq)
@@ -467,20 +467,20 @@ void mdaLooplex::processReplacing(float **inputs, float **outputs, LvzInt32 samp
//right delay
dr = fb * (float)buffer[bufpos];
- if(recreq)
+ if(recreq)
{
x = (long)(32768.0f * r + dr - d0 + d1 + 100000.5f) - 100000;
if(x > 32767) x = 32767; else if(x < -32768) x = -32768;
buffer[bufpos] = (short)x;
}
bufpos++;
-
+
//looping
if(bufpos >= bufmax)
- {
+ {
buflen = bufmax;
bufpos -= buflen;
- status = 2;
+ status = 2;
}
else
{
@@ -518,13 +518,13 @@ void mdaLooplex::processReplacing(float **inputs, float **outputs, LvzInt32 samp
LvzInt32 mdaLooplex::processEvents(LvzEvents* ev)
{
long npos=0;
-
+
for (long i=0; i<ev->numEvents; i++)
{
if((ev->events[i])->type != kLvzMidiType) continue;
LvzMidiEvent* event = (LvzMidiEvent*)ev->events[i];
char* midiData = event->midiData;
-
+
switch(midiData[0] & 0xf0) //status byte (all channels)
{
case 0x80: //note off
@@ -566,14 +566,14 @@ LvzInt32 mdaLooplex::processEvents(LvzEvents* ev)
break;
default: //all notes off
- if(midiData[1]>0x7A)
+ if(midiData[1]>0x7A)
{
}
break;
}
break;
-
+
default: break;
}
diff --git a/src/mdaLooplex.h b/src/mdaLooplex.h
index e70541a..e838c7f 100644
--- a/src/mdaLooplex.h
+++ b/src/mdaLooplex.h
@@ -57,9 +57,9 @@ public:
virtual LvzInt32 canDo (char* text);
virtual LvzInt32 getNumMidiInputChannels () { return 1; }
-
+
void idle();
-
+
private:
void update(); //my parameter update
diff --git a/src/mdaLoudness.cpp b/src/mdaLoudness.cpp
index 2f9b9ea..1b490fe 100644
--- a/src/mdaLoudness.cpp
+++ b/src/mdaLoudness.cpp
@@ -51,7 +51,7 @@ mdaLoudness::mdaLoudness(audioMasterCallback audioMaster): AudioEffectX(audioMas
setNumInputs(2);
setNumOutputs(2);
setUniqueID("mdaLoudness");
- DECLARE_LVZ_DEPRECATED(canMono) ();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
canProcessReplacing();
programs = new mdaLoudnessProgram[numPrograms];
@@ -65,7 +65,7 @@ void mdaLoudness::resume() ///update internal parameters...
{
float f, tmp;
long i;
-
+
tmp = param[0] + param[0] - 1.0f;
igain = 60.0f * tmp * tmp;
if(tmp<0.0f) igain *= -1.0f;
@@ -84,12 +84,12 @@ void mdaLoudness::resume() ///update internal parameters...
A0 = 1.0f - (float)exp(-6.283153f * A0 / getSampleRate());
- if(igain>0)
+ if(igain>0)
{
//if(mode==0) suspend(); //don't click when switching mode
- mode=1;
+ mode=1;
}
- else
+ else
{
//if(mode==1) suspend();
mode=0;
@@ -126,10 +126,10 @@ void mdaLoudness::setProgram(LvzInt32 program)
resume();
}
-void mdaLoudness::setParameter(LvzInt32 index, float value)
-{
+void mdaLoudness::setParameter(LvzInt32 index, float value)
+{
programs[curProgram].param[index] = param[index] = value; //bug was here!
- resume();
+ resume();
}
float mdaLoudness::getParameter(LvzInt32 index) { return param[index]; }
@@ -206,7 +206,7 @@ void mdaLoudness::process(float **inputs, float **outputs, LvzInt32 sampleFrames
b -= z2 * a1;
c += a * g;
d += b * g;
-
+
*++out1 = c;
*++out2 = d;
}
@@ -268,7 +268,7 @@ void mdaLoudness::processReplacing(float **inputs, float **outputs, LvzInt32 sam
b -= z2 * a1;
c = a * g;
d = b * g;
-
+
*++out1 = c;
*++out2 = d;
}
diff --git a/src/mdaMultiBand.cpp b/src/mdaMultiBand.cpp
index 8cb8f3d..003452c 100644
--- a/src/mdaMultiBand.cpp
+++ b/src/mdaMultiBand.cpp
@@ -20,7 +20,7 @@ mdaMultiBand::mdaMultiBand(audioMasterCallback audioMaster) : AudioEffectX(audio
fParam7 = (float)0.45; //L trim (2)
fParam8 = (float)0.50; //M trim
fParam9 = (float)0.50; //H trim
- fParam10 = (float)0.22; //attack (3)
+ fParam10 = (float)0.22; //attack (3)
fParam11 = (float)0.602; //release (4)
fParam12 = (float)0.55; //width
fParam13 = (float)0.40; //MS swap
@@ -33,36 +33,36 @@ mdaMultiBand::mdaMultiBand(audioMasterCallback audioMaster) : AudioEffectX(audio
fParam7 = (float)0.50; //L trim (2)
fParam8 = (float)0.50; //M trim
fParam9 = (float)0.50; //H trim
- fParam10 = (float)0.22; //attack (3)
+ fParam10 = (float)0.22; //attack (3)
fParam11 = (float)0.60; //release (4)
fParam12 = (float)0.50; //width
fParam13 = (float)0.40; //MS swap*/
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaMultiBand"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Multi-Band Compressor");
//calcs here!
gain1 = 1.0;
driv1 = (float)pow(10.0,(2.5 * fParam4) - 1.0);
- trim1 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam4 * fParam4 * fParam4));
+ trim1 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam4 * fParam4 * fParam4));
trim1 = (float)(trim1 * pow(10.0, 2.0 * fParam7 - 1.0));
att1 = (float)pow(10.0, -0.05 -(2.5 * fParam10));
rel1 = (float)pow(10.0, -2.0 - (3.5 * fParam11));
gain2 = 1.0;
driv2 = (float)pow(10.0,(2.5 * fParam5) - 1.0);
- trim2 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam5 * fParam5 * fParam5));
+ trim2 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam5 * fParam5 * fParam5));
trim2 = (float)(trim2 * pow(10.0, 2.0 * fParam8 - 1.0));
att2 = (float)pow(10.0, -0.05 -(2.0 * fParam10));
rel2 = (float)pow(10.0, -2.0 - (3.0 * fParam11));
-
+
gain3 = 1.0;
driv3 = (float)pow(10.0,(2.5 * fParam6) - 1.0);
- trim3 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam6 * fParam6 * fParam6));
+ trim3 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam6 * fParam6 * fParam6));
trim3 = (float)(trim3 * pow(10.0, 2.0 * fParam9 - 1.0));
att3 = (float)pow(10.0, -0.05 -(1.5 * fParam10));
rel3 = (float)pow(10.0, -2.0 - (2.5 * fParam11));
@@ -70,9 +70,9 @@ mdaMultiBand::mdaMultiBand(audioMasterCallback audioMaster) : AudioEffectX(audio
switch(int(fParam1*10.0))
{
case 0: trim2=0.0; trim3=0.0; slev=0.0; break;
- case 1:
+ case 1:
case 2: trim1=0.0; trim3=0.0; slev=0.0; break;
- case 3:
+ case 3:
case 4: trim1=0.0; trim2=0.0; slev=0.0; break;
default: slev=fParam12; break;
}
@@ -120,19 +120,19 @@ void mdaMultiBand::setParameter(LvzInt32 index, float value)
}
//calcs here
driv1 = (float)pow(10.0,(2.5 * fParam4) - 1.0);
- trim1 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam4 * fParam4 * fParam4));
+ trim1 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam4 * fParam4 * fParam4));
trim1 = (float)(trim1 * pow(10.0, 2.0 * fParam7 - 1.0));
att1 = (float)pow(10.0, -0.05 -(2.5 * fParam10));
rel1 = (float)pow(10.0, -2.0 - (3.5 * fParam11));
driv2 = (float)pow(10.0,(2.5 * fParam5) - 1.0);
- trim2 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam5 * fParam5 * fParam5));
+ trim2 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam5 * fParam5 * fParam5));
trim2 = (float)(trim2 * pow(10.0, 2.0 * fParam8 - 1.0));
att2 = (float)pow(10.0, -0.05 -(2.0 * fParam10));
rel2 = (float)pow(10.0, -2.0 - (3.0 * fParam11));
-
+
driv3 = (float)pow(10.0,(2.5 * fParam6) - 1.0);
- trim3 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam6 * fParam6 * fParam6));
+ trim3 = (float)(0.5 + (4.0 - 2.0 * fParam10) * (fParam6 * fParam6 * fParam6));
trim3 = (float)(trim3 * pow(10.0, 2.0 * fParam9 - 1.0));
att3 = (float)pow(10.0, -0.05 -(1.5 * fParam10));
rel3 = (float)pow(10.0, -2.0 - (2.5 * fParam11));
@@ -140,9 +140,9 @@ void mdaMultiBand::setParameter(LvzInt32 index, float value)
switch(int(fParam1*10.0))
{
case 0: trim2=0.0; trim3=0.0; slev=0.0; break;
- case 1:
+ case 1:
case 2: trim1=0.0; trim3=0.0; slev=0.0; break;
- case 3:
+ case 3:
case 4: trim1=0.0; trim2=0.0; slev=0.0; break;
default: slev=fParam12; break;
}
@@ -205,7 +205,7 @@ void mdaMultiBand::getParameterDisplay(LvzInt32 index, char *text)
case 0: switch(int(fParam1*10.0))
{ case 0: strcpy(text, "Low"); break;
case 1: case 2: strcpy(text, "Mid"); break;
- case 3: case 4: strcpy(text, "High"); break;
+ case 3: case 4: strcpy(text, "High"); break;
default: strcpy(text, "Output"); break; } break;
case 1: long2string((long)(getSampleRate() * fi1 * (0.098 + 0.09*fi1 + 0.5*(float)pow(fi1,8.2f))), text); break;
case 2: long2string((long)(getSampleRate() * fi2 * (0.015 + 0.15*fi2 + 0.9*(float)pow(fi2,8.2f))), text); break;
@@ -218,7 +218,7 @@ void mdaMultiBand::getParameterDisplay(LvzInt32 index, char *text)
case 9: long2string((long)(-301030.1 / (getSampleRate() * log10(1.0 - att2))),text); break;
case 10: long2string((long)(-301.0301 / (getSampleRate() * log10(1.0 - rel2))),text); break;
case 11: long2string((long)(200.0 * fParam12), text); break;
- case 12: if(mswap) strcpy(text, "S");
+ case 12: if(mswap) strcpy(text, "S");
else strcpy(text, "M"); break;
}
}
@@ -229,17 +229,17 @@ void mdaMultiBand::getParameterLabel(LvzInt32 index, char *label)
{
case 0: strcpy(label, ""); break;
case 1: strcpy(label, "Hz"); break;
- case 2: strcpy(label, "Hz"); break;
- case 3: strcpy(label, "dB"); break;
- case 4: strcpy(label, "dB"); break;
- case 5: strcpy(label, "dB"); break;
- case 6: strcpy(label, "dB"); break;
- case 7: strcpy(label, "dB"); break;
- case 8: strcpy(label, "dB"); break;
- case 9: strcpy(label, "µs"); break;
- case 10: strcpy(label, "ms"); break;
- case 11: strcpy(label, "% Width"); break;
- case 12: strcpy(label, ""); break;
+ case 2: strcpy(label, "Hz"); break;
+ case 3: strcpy(label, "dB"); break;
+ case 4: strcpy(label, "dB"); break;
+ case 5: strcpy(label, "dB"); break;
+ case 6: strcpy(label, "dB"); break;
+ case 7: strcpy(label, "dB"); break;
+ case 8: strcpy(label, "dB"); break;
+ case 9: strcpy(label, "µs"); break;
+ case 10: strcpy(label, "ms"); break;
+ case 11: strcpy(label, "% Width"); break;
+ case 12: strcpy(label, ""); break;
}
}
@@ -252,20 +252,20 @@ void mdaMultiBand::process(float **inputs, float **outputs, LvzInt32 sampleFrame
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d, l=fb3, m, h, s, sl=slev, tmp1, tmp2, tmp3;
+ float a, b, c, d, l=fb3, m, h, s, sl=slev, tmp1, tmp2, tmp3;
float f1i=fi1, f1o=fo1, f2i=fi2, f2o=fo2, b1=fb1, b2=fb2;
float g1=gain1, d1=driv1, t1=trim1, a1=att1, r1=1.f - rel1;
float g2=gain2, d2=driv2, t2=trim2, a2=att2, r2=1.f - rel2;
float g3=gain3, d3=driv3, t3=trim3, a3=att3, r3=1.f - rel3;
int ms=mswap;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
c = out1[1];
d = out2[1]; //process from here...
@@ -273,34 +273,34 @@ void mdaMultiBand::process(float **inputs, float **outputs, LvzInt32 sampleFrame
b = (ms)? -b : b;
s = (a - b) * sl; //keep stereo component for later
- a += b;
+ a += b;
b2 = (f2i * a) + (f2o * b2); //crossovers
- b1 = (f1i * b2) + (f1o * b1);
+ b1 = (f1i * b2) + (f1o * b1);
l = (f1i * b1) + (f1o * l);
m=b2-l; h=a-b2;
tmp1 = (l>0)? l : -l; //l
g1 = (tmp1>g1)? g1+a1*(tmp1-g1) : g1*r1;
- tmp1 = 1.f / (1.f + d1 * g1);
+ tmp1 = 1.f / (1.f + d1 * g1);
tmp2 = (m>0)? m : -m;
g2 = (tmp2>g2)? g2+a2*(tmp2-g2) : g2*r2;
- tmp2 = 1.f / (1.f + d2 * g2);
+ tmp2 = 1.f / (1.f + d2 * g2);
tmp3 = (h>0)? h : -h;
g3 = (tmp3>g3)? g3+a3*(tmp3-g3) : g3*r3;
- tmp3 = 1.f / (1.f + d3 * g3);
+ tmp3 = 1.f / (1.f + d3 * g3);
a = (l*tmp3*t1) + (m*tmp2*t2) + (h*tmp3*t3);
c += a + s; // output
d += (ms)? s - a : a - s;
-
- *++out1 = c;
+
+ *++out1 = c;
*++out2 = d;
}
gain1=(g1<1.0e-10)? 0.f : g1;
gain2=(g2<1.0e-10)? 0.f : g2;
- gain3=(g3<1.0e-10)? 0.f : g3; // gain1=g1; gain2=g2; gain3=g3;
+ gain3=(g3<1.0e-10)? 0.f : g3; // gain1=g1; gain2=g2; gain3=g3;
if(fabs(b1)<1.0e-10) { fb1=0.f; fb2=0.f; fb3=0.f; }
else { fb1=b1; fb2=b2; fb3=l; }
}
@@ -311,53 +311,53 @@ void mdaMultiBand::processReplacing(float **inputs, float **outputs, LvzInt32 sa
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d, l=fb3, m, h, s, sl=slev, tmp1, tmp2, tmp3;
+ float a, b, c, d, l=fb3, m, h, s, sl=slev, tmp1, tmp2, tmp3;
float f1i=fi1, f1o=fo1, f2i=fi2, f2o=fo2, b1=fb1, b2=fb2;
float g1=gain1, d1=driv1, t1=trim1, a1=att1, r1=1.f - rel1;
float g2=gain2, d2=driv2, t2=trim2, a2=att2, r2=1.f - rel2;
float g3=gain3, d3=driv3, t3=trim3, a3=att3, r3=1.f - rel3;
int ms=mswap;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2; //process from here...
-
+
b = (ms)? -b : b;
s = (a - b) * sl; //keep stereo component for later
a += b;
b2 = (f2i * a) + (f2o * b2); //crossovers
- b1 = (f1i * b2) + (f1o * b1);
+ b1 = (f1i * b2) + (f1o * b1);
l = (f1i * b1) + (f1o * l);
m=b2-l; h=a-b2;
tmp1 = (l>0)? l : -l; //l
g1 = (tmp1>g1)? g1+a1*(tmp1-g1) : g1*r1;
- tmp1 = 1.f / (1.f + d1 * g1);
+ tmp1 = 1.f / (1.f + d1 * g1);
tmp2 = (m>0)? m : -m;
g2 = (tmp2>g2)? g2+a2*(tmp2-g2) : g2*r2;
- tmp2 = 1.f / (1.f + d2 * g2);
+ tmp2 = 1.f / (1.f + d2 * g2);
tmp3 = (h>0)? h : -h;
g3 = (tmp3>g3)? g3+a3*(tmp3-g3) : g3*r3;
- tmp3 = 1.f / (1.f + d3 * g3);
-
+ tmp3 = 1.f / (1.f + d3 * g3);
+
a = (l*tmp3*t1) + (m*tmp2*t2) + (h*tmp3*t3);
c = a + s; // output
d = (ms)? s - a : a - s;
-
+
*++out1 = c;
*++out2 = d;
}
gain1=(g1<1.0e-10)? 0.f : g1;
gain2=(g2<1.0e-10)? 0.f : g2;
- gain3=(g3<1.0e-10)? 0.f : g3; // gain1=g1; gain2=g2; gain3=g3;
+ gain3=(g3<1.0e-10)? 0.f : g3; // gain1=g1; gain2=g2; gain3=g3;
if(fabs(b1)<1.0e-10) { fb1=0.f; fb2=0.f; fb3=0.f; }
else { fb1=b1; fb2=b2; fb3=l; }
}
diff --git a/src/mdaOverdrive.cpp b/src/mdaOverdrive.cpp
index 280e88c..2abe56d 100644
--- a/src/mdaOverdrive.cpp
+++ b/src/mdaOverdrive.cpp
@@ -1,5 +1,5 @@
#include "mdaOverdrive.h"
-
+
#include <math.h>
@@ -10,16 +10,16 @@ AudioEffect *createEffectInstance(audioMasterCallback audioMaster)
mdaOverdrive::mdaOverdrive(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 1, 3) // 1 program, 3 parameters
{
- fParam1 = 0.0f;
+ fParam1 = 0.0f;
fParam2 = 0.0f;
fParam3 = 0.5f;
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaOverdrive"); // identify
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
- strcpy(programName, "Soft Overdrive");
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
+ strcpy(programName, "Soft Overdrive");
filt1 = filt2 = 0.0f;
setParameter(0, 0.0f);
@@ -90,7 +90,7 @@ void mdaOverdrive::getParameterDisplay(LvzInt32 index, char *text)
case 1: long2string((long)(100 * fParam2 ), text); break;
case 2: long2string((long)( 40 * fParam3 - 20), text); break;
}
-
+
}
void mdaOverdrive::getParameterLabel(LvzInt32 index, char *label)
@@ -99,7 +99,7 @@ void mdaOverdrive::getParameterLabel(LvzInt32 index, char *label)
{
case 0: strcpy(label, "%"); break;
case 1: strcpy(label, "%"); break;
- case 2: strcpy(label, "dB"); break;
+ case 2: strcpy(label, "dB"); break;
}
}
@@ -116,7 +116,7 @@ void mdaOverdrive::process(float **inputs, float **outputs, LvzInt32 sampleFrame
float i=fParam1, g=gain, aa, bb;
float f=filt, fa=filt1, fb=filt2;
- --in1;
+ --in1;
--in2;
--out1;
--out2;
@@ -124,19 +124,19 @@ void mdaOverdrive::process(float **inputs, float **outputs, LvzInt32 sampleFrame
{
a = *++in1;
b = *++in2;
-
+
c = out1[1];
d = out2[1];
aa = (a>0.0f)? (float)sqrt(a) : (float)-sqrt(-a); //overdrive
- bb = (b>0.0f)? (float)sqrt(b) : (float)-sqrt(-b);
+ bb = (b>0.0f)? (float)sqrt(b) : (float)-sqrt(-b);
- fa = fa + f * (i*(aa-a) + a - fa); //filter
- fb = fb + f * (i*(bb-b) + b - fb);
+ fa = fa + f * (i*(aa-a) + a - fa); //filter
+ fb = fb + f * (i*(bb-b) + b - fb);
- c += fa * g;
+ c += fa * g;
d += fb * g;
-
+
*++out1 = c;
*++out2 = d;
}
@@ -153,26 +153,26 @@ void mdaOverdrive::processReplacing(float **inputs, float **outputs, LvzInt32 sa
float a, b, c, d;
float i=fParam1, g=gain, aa, bb;
float f=filt, fa=filt1, fb=filt2;
-
- --in1;
+
+ --in1;
--in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
-
+
aa = (a>0.0f)? (float)sqrt(a) : (float)-sqrt(-a); //overdrive
- bb = (b>0.0f)? (float)sqrt(b) : (float)-sqrt(-b);
+ bb = (b>0.0f)? (float)sqrt(b) : (float)-sqrt(-b);
- fa = fa + f * (i*(aa-a) + a - fa); //filter
- fb = fb + f * (i*(bb-b) + b - fb);
+ fa = fa + f * (i*(aa-a) + a - fa); //filter
+ fb = fb + f * (i*(bb-b) + b - fb);
- c = fa * g;
+ c = fa * g;
d = fb * g;
- *++out1 = c;
+ *++out1 = c;
*++out2 = d;
}
if(fabs(fa)>1.0e-10) filt1 = fa; else filt1 = 0.0f; //catch denormals
diff --git a/src/mdaPiano.cpp b/src/mdaPiano.cpp
index 3e4260b..2fafaf5 100644
--- a/src/mdaPiano.cpp
+++ b/src/mdaPiano.cpp
@@ -31,7 +31,7 @@ mdaPianoProgram::mdaPianoProgram()
param[6] = 0.33f; //Vel Curve
param[7] = 0.50f; //Stereo
param[8] = 0.33f; //Max Poly
-
+
param[9] = 0.50f; //Tune
param[10] = 0.00f; //Random
param[11] = 0.50f; //Stretch
@@ -43,7 +43,7 @@ mdaPianoProgram::mdaPianoProgram()
mdaPiano::mdaPiano(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, NPROGS, NPARAMS)
{
Fs = 44100.0f; iFs = 1.0f/Fs; cmax = 0x7F; //just in case...
-
+
programs = new mdaPianoProgram[NPROGS];
if(programs)
{
@@ -57,15 +57,15 @@ mdaPiano::mdaPiano(audioMasterCallback audioMaster) : AudioEffectX(audioMaster,
fillpatch(i++, "Dark Piano", 0.500f, 0.602f, 0.000f, 0.5f, 0.304f, 0.200f, 0.336f, 0.651f, 0.330f, 0.500f, 0.317f, 0.500f);
fillpatch(i++, "School Piano", 0.450f, 0.598f, 0.626f, 0.5f, 0.603f, 0.500f, 0.174f, 0.331f, 0.330f, 0.500f, 0.421f, 0.801f);
fillpatch(i++, "Broken Piano", 0.050f, 0.957f, 0.500f, 0.5f, 0.299f, 1.000f, 0.000f, 0.500f, 0.330f, 0.450f, 0.718f, 0.000f);
-
+
setProgram(0);
}
-
+
setUniqueID("mdaPiano");
if(audioMaster)
{
- setNumInputs(0);
+ setNumInputs(0);
setNumOutputs(NOUTS);
canProcessReplacing();
isSynth();
@@ -90,9 +90,9 @@ mdaPiano::mdaPiano(audioMasterCallback audioMaster) : AudioEffectX(audioMaster,
kgrp[12].root = 84; kgrp[12].high = 85; kgrp[12].pos = 532295; kgrp[12].end = 560192; kgrp[12].loop = 6011;
kgrp[13].root = 88; kgrp[13].high = 89; kgrp[13].pos = 560194; kgrp[13].end = 574121; kgrp[13].loop = 3414;
kgrp[14].root = 93; kgrp[14].high = 999; kgrp[14].pos = 574123; kgrp[14].end = 586343; kgrp[14].loop = 2399;
-
+
//initialise...
- for(long v=0; v<NVOICES; v++)
+ for(long v=0; v<NVOICES; v++)
{
voice[v].env = 0.0f;
voice[v].dec = 0.99f; //all notes off
@@ -115,24 +115,24 @@ void mdaPiano::update() //parameter change
size = (long)(12.0f * param[2] - 6.0f);
sizevel = 0.12f * param[3];
muffvel = param[5] * param[5] * 5.0f;
-
+
velsens = 1.0f + param[6] + param[6];
if(param[6] < 0.25f) velsens -= 0.75f - 3.0f * param[6];
-
+
fine = param[9] - 0.5f;
random = 0.077f * param[10] * param[10];
stretch = 0.000434f * (param[11] - 0.5f);
-
+
cdep = param[7] * param[7];
trim = 1.50f - 0.79f * cdep;
width = 0.04f * param[7]; if(width > 0.03f) width = 0.03f;
-
+
poly = 8 + (long)(24.9f * param[8]);
}
void mdaPiano::resume()
-{
+{
Fs = getSampleRate();
iFs = 1.0f / Fs;
if(Fs > 64000.0f) cmax = 0xFF; else cmax = 0x7F;
@@ -245,11 +245,11 @@ void mdaPiano::getParameterName(LvzInt32 index, char *label)
case 0: strcpy(label, "Envelope Decay"); break;
case 1: strcpy(label, "Envelope Release"); break;
case 2: strcpy(label, "Hardness Offset"); break;
-
+
case 3: strcpy(label, "Velocity to Hardness"); break;
case 4: strcpy(label, "Muffling Filter"); break;
case 5: strcpy(label, "Velocity to Muffling"); break;
-
+
case 6: strcpy(label, "Velocity Sensitivity"); break;
case 7: strcpy(label, "Stereo Width"); break;
case 8: strcpy(label, "Polyphony"); break;
@@ -264,7 +264,7 @@ void mdaPiano::getParameterName(LvzInt32 index, char *label)
void mdaPiano::getParameterDisplay(LvzInt32 index, char *text)
{
char string[16];
-
+
switch(index)
{
case 4: sprintf(string, "%.0f", 100.0f - 100.0f * param[index]); break;
@@ -286,7 +286,7 @@ void mdaPiano::getParameterLabel(LvzInt32 index, char *label)
switch(index)
{
case 8: strcpy(label, "voices"); break;
- case 9:
+ case 9:
case 10:
case 11: strcpy(label, "cents"); break;
default: strcpy(label, "%");
@@ -333,14 +333,14 @@ void mdaPiano::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
i = waves[V->pos];
i = (i << 7) + (V->frac >> 9) * (waves[V->pos + 1] - i) + 0x40400000;
x = V->env * (*(float *)&i - 3.0f); //fast int->float
-
+
V->env = V->env * V->dec; //envelope
V->f0 += V->ff * (x + V->f1 - V->f0); //muffle filter
V->f1 = x;
l += V->outl * V->f0;
r += V->outr * V->f0;
-
+
V++;
}
comb[cpos] = l + r;
@@ -393,24 +393,24 @@ void mdaPiano::processReplacing(float **inputs, float **outputs, LvzInt32 sample
i = waves[V->pos] + ((V->frac * (waves[V->pos + 1] - waves[V->pos])) >> 16);
x = V->env * (float)i / 32768.0f;
//x = V->env * (*(float *)&i - 3.0f); //fast int->float
-
+
V->env = V->env * V->dec; //envelope
V->f0 += V->ff * (x + V->f1 - V->f0); //muffle filter
V->f1 = x;
l += V->outl * V->f0;
r += V->outr * V->f0;
-
+
if(!(l > -2.0f) || !(l < 2.0f))
{
printf("what is this shit? %ld, %f, %f\n", i, x, V->f0);
l = 0.0f;
- }
+ }
if(!(r > -2.0f) || !(r < 2.0f))
{
r = 0.0f;
- }
-
+ }
+
V++;
}
comb[cpos] = l + r;
@@ -437,8 +437,8 @@ void mdaPiano::noteOn(long note, long velocity)
{
float l=99.0f;
long v, vl=0, k, s;
-
- if(velocity>0)
+
+ if(velocity>0)
{
if(activevoices < poly) //add a note
{
@@ -458,11 +458,11 @@ void mdaPiano::noteOn(long note, long velocity)
if(note > 60) l += stretch * (float)k; //stretch
s = size;
- if(velocity > 40) s += (long)(sizevel * (float)(velocity - 40));
+ if(velocity > 40) s += (long)(sizevel * (float)(velocity - 40));
k = 0;
while(note > (kgrp[k].high + s)) k++; //find keygroup
-
+
l += (float)(note - kgrp[k].root); //pitch
l = 22050.0f * iFs * (float)exp(0.05776226505 * l);
voice[vl].delta = (long)(65536.0f * l);
@@ -472,7 +472,7 @@ void mdaPiano::noteOn(long note, long velocity)
voice[vl].loop = kgrp[k].loop;
voice[vl].env = (0.5f + velsens) * (float)pow(0.0078f * velocity, velsens); //velocity
-
+
l = 50.0f + param[4] * param[4] * muff + muffvel * (float)(velocity - 64); //muffle
if(l < (55.0f + 0.25f * (float)note)) l = 55.0f + 0.25f * (float)note;
if(l > 210.0f) l = 210.0f;
@@ -509,13 +509,13 @@ void mdaPiano::noteOn(long note, long velocity)
LvzInt32 mdaPiano::processEvents(LvzEvents* ev)
{
long npos=0;
-
+
for (long i=0; i<ev->numEvents; i++)
{
if((ev->events[i])->type != kLvzMidiType) continue;
LvzMidiEvent* event = (LvzMidiEvent*)ev->events[i];
char* midiData = event->midiData;
-
+
switch(midiData[0] & 0xf0) //status byte (all channels)
{
case 0x80: //note off
@@ -535,13 +535,13 @@ LvzInt32 mdaPiano::processEvents(LvzEvents* ev)
{
case 0x01: //mod wheel
case 0x43: //soft pedal
- muff = 0.01f * (float)((127 - midiData[2]) * (127 - midiData[2]));
+ muff = 0.01f * (float)((127 - midiData[2]) * (127 - midiData[2]));
break;
-
+
case 0x07: //volume
volume = 0.00002f * (float)(midiData[2] * midiData[2]);
break;
-
+
case 0x40: //sustain pedal
case 0x42: //sustenuto pedal
sustain = midiData[2] & 0x40;
@@ -554,8 +554,8 @@ LvzInt32 mdaPiano::processEvents(LvzEvents* ev)
break;
default: //all notes off
- if(midiData[1]>0x7A)
- {
+ if(midiData[1]>0x7A)
+ {
for(long v=0; v<NVOICES; v++) voice[v].dec=0.99f;
sustain = 0;
muff = 160.0f;
@@ -567,7 +567,7 @@ LvzInt32 mdaPiano::processEvents(LvzEvents* ev)
case 0xC0: //program change
if(midiData[1]<NPROGS) setProgram(midiData[1]);
break;
-
+
default: break;
}
diff --git a/src/mdaPiano.h b/src/mdaPiano.h
index 2fd1be5..5232f84 100644
--- a/src/mdaPiano.h
+++ b/src/mdaPiano.h
@@ -35,7 +35,7 @@ struct VOICE //voice state
long pos;
long end;
long loop;
-
+
float env; //envelope
float dec;
@@ -87,7 +87,7 @@ public:
virtual bool getProductString (char* text);
virtual LvzInt32 getVendorVersion () {return 1;}
virtual LvzInt32 canDo (char* text);
-
+
virtual LvzInt32 getNumMidiInputChannels () { return 1; }
long guiUpdate;
diff --git a/src/mdaRePsycho.cpp b/src/mdaRePsycho.cpp
index 3f0c714..bfc7e19 100644
--- a/src/mdaRePsycho.cpp
+++ b/src/mdaRePsycho.cpp
@@ -22,11 +22,11 @@ mdaRePsycho::mdaRePsycho(audioMasterCallback audioMaster) : AudioEffectX(audioMa
buffer = new float[size];
buffer2 = new float[size];
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaRePsycho"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Re-PsYcHo!");
suspend(); // flush buffer
@@ -36,12 +36,12 @@ mdaRePsycho::mdaRePsycho(audioMasterCallback audioMaster) : AudioEffectX(audioMa
dtim = 441 + int(0.5 * size * fParam5);
fil = 0.0;
thr = (float)pow(10.0,(1.5 * fParam1) - 1.5);
-
- if(fParam2>0.5)
+
+ if(fParam2>0.5)
{ env = (float)(1.0 + 0.003 * pow(fParam2 - 0.5,5.0)); }
else
{ env = (float)(1.0 + 0.025 * pow(fParam2 - 0.5,5.0)); }
-
+
tun = (float)(((int(fParam3 * 24.0) - 24.0) + (fParam6 - 1.0)) / 24.0);
tun = (float)pow(10.0, 0.60206 * tun);
wet = (float)(0.5 * sqrt(fParam4));
@@ -67,17 +67,17 @@ void mdaRePsycho::setParameter(LvzInt32 index, float value)
//calcs here
dtim = 441 + int(0.5 * size * fParam5);
thr = (float)pow(10.0,(1.5 * fParam1) - 1.5);
-
- if(fParam2>0.5)
+
+ if(fParam2>0.5)
{ env = (float)(1.0 + 0.003 * pow(fParam2 - 0.5,5.0)); }
else
{ env = (float)(1.0 + 0.025 * pow(fParam2 - 0.5,5.0)); }
-
- //if(fParam2>0.5)
+
+ //if(fParam2>0.5)
//{ env = (float)(1.0 + 0.01 * (fParam2 - 0.5)); }
//else
//{ env = (float)(1.0 + 0.01 * (fParam2 - 0.5)); }
-
+
tun = (float)(((int(fParam3 * 24.0) - 24.0) + (fParam6 - 1.0)) / 24.0);
tun = (float)pow(10.0, 0.60206 * tun);
wet = (float)(0.5 * sqrt(fParam4));
@@ -161,11 +161,11 @@ void mdaRePsycho::getParameterLabel(LvzInt32 index, char *label)
{
case 0: strcpy(label, "semi"); break;
case 1: strcpy(label, "cent"); break;
- case 2: strcpy(label, "%"); break;
- case 3: strcpy(label, "dB"); break;
- case 4: strcpy(label, "ms"); break;
- case 5: strcpy(label, "%"); break;
- case 6: strcpy(label, ""); break;
+ case 2: strcpy(label, "%"); break;
+ case 3: strcpy(label, "dB"); break;
+ case 4: strcpy(label, "ms"); break;
+ case 5: strcpy(label, "%"); break;
+ case 6: strcpy(label, ""); break;
}
}
@@ -178,14 +178,14 @@ void mdaRePsycho::process(float **inputs, float **outputs, LvzInt32 sampleFrames
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d;
+ float a, b, c, d;
float we=wet, dr=dry, tu=tun, en=env;
float ga=gai, x=0.0f, x2=0.0f, xx=buf, xx2=buf2;
float it1, it2;
long ti=tim, dti=dtim, of1, of2;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
@@ -194,12 +194,12 @@ void mdaRePsycho::process(float **inputs, float **outputs, LvzInt32 sampleFrames
we=(float)(we*2.0);
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
-
+
c = out1[1];
d = out2[1]; //process from here...
-
+
if ((a+b > thr) && (ti > dti)) //trigger
{
ga = 1.0;
@@ -207,7 +207,7 @@ void mdaRePsycho::process(float **inputs, float **outputs, LvzInt32 sampleFrames
}
if (ti<22050) //play out
- {
+ {
if(ti<80) //fade in
{
if(ti==0) { xx=x; xx2=x2; }
@@ -216,9 +216,9 @@ void mdaRePsycho::process(float **inputs, float **outputs, LvzInt32 sampleFrames
*(buffer2 + ti) = b;
x = *(buffer + int(ti * tu));
x2 = *(buffer2 + int(ti * tu));
-
- x = (float)(xx * (1.0 - (0.0125 * ti)) + (x * 0.0125 * ti));
- x2 = (float)(xx2 * (1.0 - (0.0125 * ti)) + (x2 * 0.0125 * ti));
+
+ x = (float)(xx * (1.0 - (0.0125 * ti)) + (x * 0.0125 * ti));
+ x2 = (float)(xx2 * (1.0 - (0.0125 * ti)) + (x2 * 0.0125 * ti));
}
else
{
@@ -240,11 +240,11 @@ void mdaRePsycho::process(float **inputs, float **outputs, LvzInt32 sampleFrames
{
ga = 0;
}
-
+
c += (a * dr) + (x * ga * we); // output
d += (b * dr) + (x2 * ga * we);
-
- *++out1 = c;
+
+ *++out1 = c;
*++out2 = d;
}
}
@@ -252,12 +252,12 @@ void mdaRePsycho::process(float **inputs, float **outputs, LvzInt32 sampleFrames
{
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
-
+
c = out1[1];
d = out2[1]; //process from here...
-
+
if ((a+b > thr) && (ti > dti)) //trigger
{
ga = 1.0;
@@ -265,14 +265,14 @@ void mdaRePsycho::process(float **inputs, float **outputs, LvzInt32 sampleFrames
}
if (ti<22050) //play out
- {
+ {
if(ti<80) //fade in
{
if(ti==0) xx = x;
*(buffer + ti) = (a + b);
x = *(buffer + int(ti * tu));
-
+
x = (float)(xx * (1.0 - (0.0125 * ti)) + (x * 0.0125 * ti));
}
else
@@ -289,11 +289,11 @@ void mdaRePsycho::process(float **inputs, float **outputs, LvzInt32 sampleFrames
{
ga = 0;
}
-
+
c += (a * dr) + (x * ga * we); // output
d += (b * dr) + (x * ga * we);
-
- *++out1 = c;
+
+ *++out1 = c;
*++out2 = d;
}
}
@@ -309,14 +309,14 @@ void mdaRePsycho::processReplacing(float **inputs, float **outputs, LvzInt32 sam
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d;
+ float a, b, c, d;
float we=wet, dr=dry, tu=tun, en=env;
float ga=gai, x=0.0f, x2=0.0f, xx=buf, xx2=buf2;
float it1, it2;
long ti=tim, dti=dtim, of1, of2;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
@@ -325,9 +325,9 @@ void mdaRePsycho::processReplacing(float **inputs, float **outputs, LvzInt32 sam
we=(float)(we*2.0);
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2; //process from here...
-
+
if ((a+b > thr) && (ti > dti)) //trigger
{
ga = 1.0;
@@ -335,7 +335,7 @@ void mdaRePsycho::processReplacing(float **inputs, float **outputs, LvzInt32 sam
}
if (ti<22050) //play out
- {
+ {
if(ti<80) //fade in
{
if(ti==0) { xx=x; xx2=x2; }
@@ -344,9 +344,9 @@ void mdaRePsycho::processReplacing(float **inputs, float **outputs, LvzInt32 sam
*(buffer2 + ti) = b;
x = *(buffer + int(ti * tu));
x2 = *(buffer2 + int(ti * tu));
-
- x = (float)(xx * (1.0 - (0.0125 * ti)) + (x * 0.0125 * ti));
- x2 = (float)(xx2 * (1.0 - (0.0125 * ti)) + (x2 * 0.0125 * ti));
+
+ x = (float)(xx * (1.0 - (0.0125 * ti)) + (x * 0.0125 * ti));
+ x2 = (float)(xx2 * (1.0 - (0.0125 * ti)) + (x2 * 0.0125 * ti));
}
else
{
@@ -368,10 +368,10 @@ void mdaRePsycho::processReplacing(float **inputs, float **outputs, LvzInt32 sam
{
ga = 0;
}
-
+
c = (a * dr) + (x * ga * we); // output
d = (b * dr) + (x2 * ga * we);
-
+
*++out1 = c;
*++out2 = d;
}
@@ -380,9 +380,9 @@ void mdaRePsycho::processReplacing(float **inputs, float **outputs, LvzInt32 sam
{
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2; //process from here...
-
+
if ((a+b > thr) && (ti > dti)) //trigger
{
ga = 1.0;
@@ -390,14 +390,14 @@ void mdaRePsycho::processReplacing(float **inputs, float **outputs, LvzInt32 sam
}
if (ti<22050) //play out
- {
+ {
if(ti<80) //fade in
{
if(ti==0) xx = x;
*(buffer + ti) = (a + b);
x = *(buffer + int(ti * tu));
-
+
x = (float)(xx * (1.0 - (0.0125 * ti)) + (x * 0.0125 * ti));
}
else
@@ -414,10 +414,10 @@ void mdaRePsycho::processReplacing(float **inputs, float **outputs, LvzInt32 sam
{
ga = 0;
}
-
+
c = (a * dr) + (x * ga * we); // output
d = (b * dr) + (x * ga * we);
-
+
*++out1 = c;
*++out2 = d;
}
diff --git a/src/mdaRezFilter.cpp b/src/mdaRezFilter.cpp
index b65240e..7e00db7 100644
--- a/src/mdaRezFilter.cpp
+++ b/src/mdaRezFilter.cpp
@@ -23,13 +23,13 @@ mdaRezFilter::mdaRezFilter(audioMasterCallback audioMaster) : AudioEffectX(audio
fParam8 = 0.00f; //trigger
fParam9 = 0.75f; //max freq
- setNumInputs(2);
- setNumOutputs(2);
- setUniqueID("mdaRezFilter");
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ setNumInputs(2);
+ setNumOutputs(2);
+ setUniqueID("mdaRezFilter");
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Resonant Filter");
-
+
suspend(); // flush buffer
setParameter(2, 0.5f); //go and set initial values!
}
@@ -51,21 +51,21 @@ void mdaRezFilter::setParameter(LvzInt32 index, float value)
}
//calcs here
fff = 1.5f * fParam0 * fParam0 - 0.15f;
- fq = 0.99f * (float)pow(fParam1,0.3f); //was 0.99f *
+ fq = 0.99f * (float)pow(fParam1,0.3f); //was 0.99f *
fg = 0.5f * (float)pow(10.0f, 2.f * fParam2 - 1.f);
-
+
fmax = 0.99f + 0.3f * fParam1;
- if(fmax>(1.3f * fParam9)) fmax=1.3f*fParam9;
+ if(fmax>(1.3f * fParam9)) fmax=1.3f*fParam9;
//fmax = 1.0f;
//fq *= 1.0f + 0.2f * fParam9;
-
- fenv = 2.f*(0.5f - fParam3)*(0.5f - fParam3);
+
+ fenv = 2.f*(0.5f - fParam3)*(0.5f - fParam3);
fenv = (fParam3>0.5f)? fenv : -fenv;
att = (float)pow(10.0, -0.01 - 4.0 * fParam4);
rel = 1.f - (float)pow(10.0, -2.00 - 4.0 * fParam5);
lfomode=0;
- flfo = 2.f * (fParam6 - 0.5f)*(fParam6 - 0.5f);
+ flfo = 2.f * (fParam6 - 0.5f)*(fParam6 - 0.5f);
dphi = (float)(6.2832f * (float)pow(10.0f, 3.f * fParam7 - 1.5f) / getSampleRate());
if(fParam6<0.5) { lfomode=1; dphi *= 0.15915f; flfo *= 0.001f; } //S&H
@@ -83,8 +83,8 @@ bool mdaRezFilter::getEffectName(char* name) { strcpy(name, "RezFilter"); re
void mdaRezFilter::suspend()
{
- buf0=0.f;
- buf1=0.f;
+ buf0=0.f;
+ buf1=0.f;
buf2=0.f;
}
@@ -151,7 +151,7 @@ void mdaRezFilter::getParameterDisplay(LvzInt32 index, char *text)
case 5: float2strng((float)(-301.0301 / (getSampleRate() * log10(rel))),text); break;
case 6: long2string((long)(200 * fParam6 - 100), text); break;
case 7: float2strng((float)pow(10.0f, 4.f*fParam7 - 2.f), text); break;
- case 8: if(tthr==0.f) strcpy(text, "FREE RUN");
+ case 8: if(tthr==0.f) strcpy(text, "FREE RUN");
else long2string((long)(20*log10(0.5*tthr)), text); break;
case 9: long2string((long)(100 * fParam9), text); break;
}
@@ -183,17 +183,17 @@ void mdaRezFilter::process(float **inputs, float **outputs, LvzInt32 sampleFrame
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, c, d;
+ float a, c, d;
float f, i, o, ff=fff, fe=fenv, q=fq, g=fg, e=env;
float b0=buf0, b1=buf1, b2=buf2, at=att, re=rel, fm=fmax;
float fl=flfo, dph=dphi, ph=phi, bl=bufl, th=tthr, e2=env2;
int lm=lfomode, ta=tatt, tt=ttrig;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
-
+
if(th==0.f)
{
while(--sampleFrames >= 0)
@@ -201,21 +201,21 @@ void mdaRezFilter::process(float **inputs, float **outputs, LvzInt32 sampleFrame
a = *++in1 + *++in2;
c = out1[1];
d = out2[1]; //process from here...
-
+
i = (a>0)? a : -a; //envelope
- e = (i>e)? e + at * (i - e) : e * re;
-
+ e = (i>e)? e + at * (i - e) : e * re;
+
if(lm==0) bl = fl * (float)sin(ph); //lfo
else if(ph>1.f) { bl = fl*(rand() % 2000 - 1000); ph=0.f; }
ph += dph;
f = ff + fe * e + bl; //freq
if(f<0.f) i=0.f; else i=(f>fm)? fm : f;
- o = 1.f - i;
+ o = 1.f - i;
- b0 = o * b0 + i * (g*a + q*(1.f + (1.f/o)) * (b0-b1) );
+ b0 = o * b0 + i * (g*a + q*(1.f + (1.f/o)) * (b0-b1) );
b1 = o * b1 + i * b0; //filter
- b2 = o * b2 + i * b1;
+ b2 = o * b2 + i * b1;
*++out1 = c + b2;
*++out2 = d + b2;
@@ -228,10 +228,10 @@ void mdaRezFilter::process(float **inputs, float **outputs, LvzInt32 sampleFrame
a = *++in1 + *++in2;
c = out1[1];
d = out2[1]; //process from here...
-
+
i = (a>0)? a : -a; //envelope
- e = (i>e)? i : e * re;
- if(e>th) { if(tt==0) {ta=1; if(lm==1)ph=2.f; } tt=1; } else tt=0;
+ e = (i>e)? i : e * re;
+ if(e>th) { if(tt==0) {ta=1; if(lm==1)ph=2.f; } tt=1; } else tt=0;
if(ta==1) { e2 += at*(1.f-e2); if(e2>0.999f)ta=0; } else e2*=re;
if(lm==0) bl = fl * (float)sin(ph); //lfo
@@ -240,18 +240,18 @@ void mdaRezFilter::process(float **inputs, float **outputs, LvzInt32 sampleFrame
f = ff + fe * e + bl; //freq
if(f<0.f) i=0.f; else i=(f>fm)? fm : f;
- o = 1.f - i;
+ o = 1.f - i;
- b0 = o * b0 + i * (g*a + q*(1.f + (1.f/o)) * (b0-b1) );
+ b0 = o * b0 + i * (g*a + q*(1.f + (1.f/o)) * (b0-b1) );
b1 = o * b1 + i * b0; //filter
- b2 = o * b2 + i * b1;
+ b2 = o * b2 + i * b1;
*++out1 = c + b2;
*++out2 = d + b2;
}
}
if(fabs(b0)<1.0e-10) { buf0=0.f; buf1=0.f; buf2=0.f; }
- else { buf0=b0; buf1=b1; buf2=b2; }
+ else { buf0=b0; buf1=b1; buf2=b2; }
env=e; env2=e2; bufl=bl; tatt=ta; ttrig=tt;
phi=(float)fmod(ph,6.2831853f);
}
@@ -262,14 +262,14 @@ void mdaRezFilter::processReplacing(float **inputs, float **outputs, LvzInt32 sa
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a;
+ float a;
float f, i, ff=fff, fe=fenv, q=fq, g=fg, e=env, tmp;
float b0=buf0, b1=buf1, b2=buf2, at=att, re=rel, fm=fmax;
float fl=flfo, dph=dphi, ph=phi, bl=bufl, th=tthr, e2=env2;
int lm=lfomode, ta=tatt, tt=ttrig;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
@@ -278,29 +278,29 @@ void mdaRezFilter::processReplacing(float **inputs, float **outputs, LvzInt32 sa
while(--sampleFrames >= 0)
{
a = *++in1 + *++in2;
-
+
i = (a>0)? a : -a; //envelope
- e = (i>e)? e + at * (i - e) : e * re;
-
+ e = (i>e)? e + at * (i - e) : e * re;
+
if(lm==0) bl = fl * (float)sin(ph); //lfo
else if(ph>1.f) { bl = fl*(rand() % 2000 - 1000); ph=0.f; }
ph += dph;
f = ff + fe * e + bl; //freq
if(f<0.f) i=0.f; else i=(f>fm)? fm : f;
- // o = 1.f - i;
+ // o = 1.f - i;
// tmp = g*a + q*(1.f + (1.f/o)) * (b0-b1);
- // b0 = o * (b0 - tmp) + tmp;
+ // b0 = o * (b0 - tmp) + tmp;
// b1 = o * (b1 - b0) + b0;
-
+
tmp = q + q * (1.0f + i * (1.0f + 1.1f * i));
//tmp = q + q/(1.0008 - i);
b0 += i * (g * a - b0 + tmp * (b0 - b1));
b1 += i * (b0 - b1);
-
- // b2 = o * (b2 - b1) + b1;
+
+ // b2 = o * (b2 - b1) + b1;
*++out1 = b1;
*++out2 = b1;
@@ -311,11 +311,11 @@ void mdaRezFilter::processReplacing(float **inputs, float **outputs, LvzInt32 sa
while(--sampleFrames >= 0)
{
a = *++in1 + *++in2;
-
+
i = (a>0)? a : -a; //envelope
- e = (i>e)? i : e * re;
- if(e>th) { if(tt==0) {ta=1; if(lm==1)ph=2.f; } tt=1; } else tt=0;
+ e = (i>e)? i : e * re;
+ if(e>th) { if(tt==0) {ta=1; if(lm==1)ph=2.f; } tt=1; } else tt=0;
if(ta==1) { e2 += at*(1.f-e2); if(e2>0.999f)ta=0; } else e2*=re;
if(lm==0) bl = fl * (float)sin(ph); //lfo
@@ -324,8 +324,8 @@ void mdaRezFilter::processReplacing(float **inputs, float **outputs, LvzInt32 sa
f = ff + fe * e + bl; //freq
if(f<0.f) i=0.f; else i=(f>fm)? fm : f;
-
- // o = 1.f - i;
+
+ // o = 1.f - i;
tmp = q + q * (1.0f + i * (1.0f + 1.1f * i));
//tmp = q + q/(1.0008 - i);
@@ -336,7 +336,7 @@ void mdaRezFilter::processReplacing(float **inputs, float **outputs, LvzInt32 sa
// tmp = g*a + q*(1.f + (1.f/o)) * (b0-b1); //what about (q + q/f)*
// b0 = o * (b0 - tmp) + tmp; // ^ what about div0 ?
// b1 = o * (b1 - b0) + b0;
- // b2 = o * (b2 - b1) + b1;
+ // b2 = o * (b2 - b1) + b1;
*++out1 = b1;
@@ -344,7 +344,7 @@ void mdaRezFilter::processReplacing(float **inputs, float **outputs, LvzInt32 sa
}
}
if(fabs(b0)<1.0e-10) { buf0=0.f; buf1=0.f; buf2=0.f; }
- else { buf0=b0; buf1=b1; buf2=b2; }
+ else { buf0=b0; buf1=b1; buf2=b2; }
env=e; env2=e2; bufl=bl; tatt=ta; ttrig=tt;
phi=(float)fmod(ph,6.2831853f);
}
diff --git a/src/mdaRingMod.cpp b/src/mdaRingMod.cpp
index 017c0bb..20a689f 100644
--- a/src/mdaRingMod.cpp
+++ b/src/mdaRingMod.cpp
@@ -9,19 +9,19 @@ AudioEffect *createEffectInstance(audioMasterCallback audioMaster)
mdaRingMod::mdaRingMod(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 1, 3) // 1 program, 3 parameter only
{
- fParam1 = (float)0.0625; //1kHz
+ fParam1 = (float)0.0625; //1kHz
fParam2 = (float)0.0;
fParam3 = (float)0.0;
- fPhi = 0.0;
+ fPhi = 0.0;
twoPi = (float)6.2831853;
- fdPhi = (float)(twoPi * 100.0 * (fParam2 + (160.0 * fParam1))/ getSampleRate());
+ fdPhi = (float)(twoPi * 100.0 * (fParam2 + (160.0 * fParam1))/ getSampleRate());
ffb = 0.f;
fprev = 0.f;
setNumInputs(2); // stereo in
setNumOutputs(2); // stereo out
setUniqueID("mdaRingMod"); // identify
- DECLARE_LVZ_DEPRECATED(canMono) ();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
canProcessReplacing(); // supports both accumulating and replacing output
strcpy(programName, "Ring Modulator"); // default program name
}
@@ -91,7 +91,7 @@ void mdaRingMod::getParameterDisplay(LvzInt32 index, char *text)
case 1: long2string((long)(100. * fParam2), text); break;
case 2: long2string((long)(100. * fParam3), text); break;
}
-
+
}
void mdaRingMod::getParameterLabel(LvzInt32 index, char *label)
@@ -120,7 +120,7 @@ void mdaRingMod::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
dp = fdPhi;
fb = ffb;
fp = fprev;
-
+
--in1; // pre-decrement so we can use pre-increment in the loop
--in2; // this is because pre-increment is fast on power pc
--out1;
@@ -129,19 +129,19 @@ void mdaRingMod::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
{
a = *++in1; // try to do load operations first...
b = *++in2;
-
+
g = (float)sin(p); //instantaneous gain
p = (float)fmod( p + dp, tp ); //oscillator phase
-
+
c = out1[1]; // get output, as we need to accumulate
d = out2[1];
-
+
fp = (fb * fp + a) * g;
fp2 = (fb * fp + b) * g;
-
+
c += fp; // accumulate to output buss
d += fp2;
-
+
*++out1 = c; // ...and store operations at the end,
*++out2 = d; // as this uses the cache efficiently.
}
@@ -155,7 +155,7 @@ void mdaRingMod::processReplacing(float **inputs, float **outputs, LvzInt32 samp
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d, g;
+ float a, b, c, d, g;
float p, dp, tp = twoPi, fb, fp, fp2;
p = fPhi;
@@ -164,25 +164,25 @@ void mdaRingMod::processReplacing(float **inputs, float **outputs, LvzInt32 samp
fp = fprev;
--in1;
- --in2;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
-
+
g = (float)sin(p);
p = (float)fmod( p + dp, tp );
fp = (fb * fp + a) * g;
fp2 = (fb * fp + b) * g;
- c = fp;
+ c = fp;
d = fp2;
- *++out1 = c;
- *++out2 = d;
+ *++out1 = c;
+ *++out2 = d;
}
fPhi = p;
fprev = fp;
diff --git a/src/mdaRoundPan.cpp b/src/mdaRoundPan.cpp
index b57f8fe..f012e18 100644
--- a/src/mdaRoundPan.cpp
+++ b/src/mdaRoundPan.cpp
@@ -13,17 +13,17 @@ mdaRoundPan::mdaRoundPan(audioMasterCallback audioMaster) : AudioEffectX(audioMa
//inits here!
fParam1 = (float)0.5; //pan
fParam2 = (float)0.8; //auto
-
+
//size = 1500;
//bufpos = 0;
//buffer = new float[size];
//buffer2 = new float[size];
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaRoundPan"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Round Panner");
suspend(); // flush buffer
@@ -134,29 +134,29 @@ void mdaRoundPan::process(float **inputs, float **outputs, LvzInt32 sampleFrames
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, c, d, x=0.5, y=(float)0.7854;
+ float a, c, d, x=0.5, y=(float)0.7854;
float ph, dph, fourpi=(float)12.566371;
-
+
ph = phi;
dph = dphi;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
a = x * (*++in1 + *++in2);
-
+
c = out1[1];
d = out2[1]; //process from here...
-
+
c += (float)(a * -sin((x * ph) - y)); // output
d += (float)(a * sin((x * ph) + y));
ph = ph + dph;
- *++out1 = c;
+ *++out1 = c;
*++out2 = d;
}
if(ph<0.0) ph = ph + fourpi; else if(ph>fourpi) ph = ph - fourpi;
@@ -169,23 +169,23 @@ void mdaRoundPan::processReplacing(float **inputs, float **outputs, LvzInt32 sam
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, c, d, x=0.5, y=(float)0.7854;
+ float a, c, d, x=0.5, y=(float)0.7854;
float ph, dph, fourpi=(float)12.566371;
-
+
ph = phi;
dph = dphi;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
a = x * (*++in1 + *++in2); //process from here...
-
+
c = (float)(a * -sin((x * ph) - y)); // output
d = (float)(a * sin((x * ph) + y));
-
+
ph = ph + dph;
*++out1 = c;
diff --git a/src/mdaShepard.cpp b/src/mdaShepard.cpp
index 6ee9734..c9b8ec1 100644
--- a/src/mdaShepard.cpp
+++ b/src/mdaShepard.cpp
@@ -13,24 +13,24 @@ mdaShepard::mdaShepard(audioMasterCallback audioMaster) : AudioEffectX(audioMast
{
double x, a, twopi=6.2831853;
int i;
-
+
//inits here!
fParam0 = 0.20f; //mode
fParam1 = 0.70f; //rate
fParam2 = 0.50f; //level
max = 512;
- buf1 = new float[max];
- buf2 = new float[max];
-
- setNumInputs(2);
- setNumOutputs(2);
- setUniqueID("mdaShepard"); //
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ buf1 = new float[max];
+ buf2 = new float[max];
+
+ setNumInputs(2);
+ setNumOutputs(2);
+ setUniqueID("mdaShepard"); //
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Shepard Tone Generator");
- for(max=0; max<511; max++)
+ for(max=0; max<511; max++)
{
pos = (float)(twopi * max / 511.f); //generate wavetables
x=0.0;
@@ -46,8 +46,8 @@ mdaShepard::mdaShepard(audioMasterCallback audioMaster) : AudioEffectX(audioMast
}
*(buf1 + 511) = 0.f;
*(buf2 + 511) = 0.f; //wrap end for interpolation
- pos=0.f;
- rate=1.f;
+ pos=0.f;
+ rate=1.f;
setParameter(0, 0.2f); //go and set initial values!
}
@@ -122,7 +122,7 @@ void mdaShepard::getParameterDisplay(LvzInt32 index, char *text)
switch(index)
{
case 0: switch(mode)
- {
+ {
case 0: strcpy(text, "TONES"); break;
case 1: strcpy(text, "RING MOD"); break;
case 2: strcpy(text, "TONES+IN"); break;
@@ -155,8 +155,8 @@ void mdaShepard::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float r=rate, dr=drate, o=out, p=pos, di;
long x=max, m=mode, i1, i2;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
@@ -164,23 +164,23 @@ void mdaShepard::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
{
a = *++in1 + *++in2;
c = out1[1];
- d = out2[1];
+ d = out2[1];
- r *= dr;
- if(r>2.f)
- {
- r *= 0.5f;
+ r *= dr;
+ if(r>2.f)
+ {
+ r *= 0.5f;
p *= 0.5f;
}
- else if(r<1.f)
+ else if(r<1.f)
{
r *= 2.f;
p *= 2.f; if(p>x)p-=x;
}
-
- p += r;
+
+ p += r;
if(p>x) p -= x;
-
+
i1 = int(p); //interpolate position
i2 = i1 + 1;
di = (float)i2 - p;
@@ -190,7 +190,7 @@ void mdaShepard::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
b *= o / r;
if(m>0) { if(m==2) b += 0.5f*a; else b *= a; } //ring mod or add
-
+
*++out1 = c + b;
*++out2 = c + b;
}
@@ -207,8 +207,8 @@ void mdaShepard::processReplacing(float **inputs, float **outputs, LvzInt32 samp
float r=rate, dr=drate, o=out, p=pos, di;
long x=max, m=mode, i1, i2;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
@@ -216,21 +216,21 @@ void mdaShepard::processReplacing(float **inputs, float **outputs, LvzInt32 samp
{
a = *++in1 + *++in2;
- r *= dr;
- if(r>2.f)
- {
- r *= 0.5f;
+ r *= dr;
+ if(r>2.f)
+ {
+ r *= 0.5f;
p *= 0.5f;
}
- else if(r<1.f)
+ else if(r<1.f)
{
r *= 2.f;
p *= 2.f; if(p>x)p-=x;
}
-
- p += r;
+
+ p += r;
if(p>x) p -= x;
-
+
i1 = int(p); //interpolate position
i2 = i1 + 1;
di = (float)i2 - p;
@@ -240,7 +240,7 @@ void mdaShepard::processReplacing(float **inputs, float **outputs, LvzInt32 samp
b *= o / r;
if(m>0) { if(m==2) b += 0.5f*a; else b *= a; } //ring mod or add
-
+
*++out1 = b;
*++out2 = b;
}
diff --git a/src/mdaSpecMeterGUI.cpp b/src/mdaSpecMeterGUI.cpp
index 92c3642..7788ec1 100644
--- a/src/mdaSpecMeterGUI.cpp
+++ b/src/mdaSpecMeterGUI.cpp
@@ -105,7 +105,7 @@ CDraw::draw(CDrawContext * pContext)
/*
pContext->setFillColor(kGreenCColor);
-
+
p = x2pix(Lmin);
block(p - 3, 10, p - 1, 18);
pContext->fillRect(block);
@@ -124,10 +124,10 @@ CDraw::draw(CDrawContext * pContext)
p = x2pix(Lpeak);
if (p > 454)
p = 454;
-
+
block = CRect(r - 1, 10, p - 1, 18);
pContext->fillRect(block);
-
+
block = CRect(p - 1, 10, 478, 18);
if (p < 454)
pContext->fillRect(block);
@@ -135,14 +135,14 @@ CDraw::draw(CDrawContext * pContext)
r = x22pix(Rrms);
if (r > 454)
r = 454;
-
+
p = x2pix(Rpeak);
if (p > 454)
p = 454;
-
+
block = CRect(r - 1, 18, p - 1, 26);
pContext->fillRect(block);
-
+
block = CRect(p - 1, 18, 478, 26);
if (p < 454)
pContext->fillRect(block);
diff --git a/src/mdaSplitter.cpp b/src/mdaSplitter.cpp
index 982e920..018f0c9 100644
--- a/src/mdaSplitter.cpp
+++ b/src/mdaSplitter.cpp
@@ -34,19 +34,19 @@ mdaSplitter::mdaSplitter(audioMasterCallback audioMaster): AudioEffectX(audioMas
setNumInputs(2);
setNumOutputs(2);
setUniqueID("mdaSplitter"); ///identify plug-in here
- DECLARE_LVZ_DEPRECATED(canMono) ();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
canProcessReplacing();
programs = new mdaSplitterProgram[numPrograms];
setProgram(0);
-
+
///differences from default program...
programs[1].param[2] = 0.50f;
programs[1].param[4] = 0.25f;
strcpy(programs[1].name,"Pass Peaks Only");
programs[2].param[0] = 0.60f;
strcpy(programs[2].name,"Stereo Crossover");
-
+
suspend();
}
@@ -75,7 +75,7 @@ void mdaSplitter::resume() ///update internal parameters...
tmp = (long)(2.9f * param[4]); //level switching
if(tmp==0) ll = -1.0f; //below
if(tmp==1) level = 0.0f; //all
-
+
pp = -1.0f; //phase correction
if(ff==ll) pp = 1.0f;
if(ff==0.0f && ll==-1.0f) { ll *= -1.0f; }
@@ -122,10 +122,10 @@ void mdaSplitter::setProgram(LvzInt32 program)
}
-void mdaSplitter::setParameter(LvzInt32 index, float value)
-{
+void mdaSplitter::setParameter(LvzInt32 index, float value)
+{
programs[curProgram].param[index] = param[index] = value; //bug was here!
- resume();
+ resume();
}
@@ -138,7 +138,7 @@ void mdaSplitter::getParameterName(LvzInt32 index, char *label)
{
switch(index)
{
- case 0: strcpy(label, "Mode"); break;
+ case 0: strcpy(label, "Mode"); break;
case 1: strcpy(label, "Freq"); break;
case 2: strcpy(label, "Freq Mode"); break;
case 3: strcpy(label, "Level"); break;
@@ -183,7 +183,7 @@ void mdaSplitter::getParameterLabel(LvzInt32 index, char *label)
switch(index)
{
case 1: strcpy(label, "Hz"); break;
- case 3:
+ case 3:
case 6: strcpy(label, "dB"); break;
case 5: strcpy(label, "ms"); break;
default: strcpy(label, "");
@@ -257,7 +257,7 @@ void mdaSplitter::processReplacing(float **inputs, float **outputs, LvzInt32 sam
{
a = *++in1;
b = *++in2;
-
+
a0 += f * (a - a0 - a1); //frequency split
a1 += f * a0;
aa = a1 + fx * a;
diff --git a/src/mdaStereo.cpp b/src/mdaStereo.cpp
index e483e8b..59fc105 100644
--- a/src/mdaStereo.cpp
+++ b/src/mdaStereo.cpp
@@ -21,17 +21,17 @@ mdaStereo::mdaStereo(audioMasterCallback audioMaster) : AudioEffectX(audioMaster
bufpos = 0;
buffer = new float[size];
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaStereo"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Stereo Simulator");
suspend(); // flush buffer
//calcs here!
phi=0;
- dphi=(float)(3.141 * pow(10.0,-2.0 + 3.0 * fParam5) / getSampleRate());
+ dphi=(float)(3.141 * pow(10.0,-2.0 + 3.0 * fParam5) / getSampleRate());
mod=(float)(2100.0 * pow(fParam4, 2));
if(fParam1<0.5)
@@ -82,7 +82,7 @@ void mdaStereo::setParameter(LvzInt32 index, float value)
case 4: fParam5 = value; break;
}
//calcs here
- dphi=(float)(3.141 * pow(10.0,-2.0 + 3.0 * fParam5) / getSampleRate());
+ dphi=(float)(3.141 * pow(10.0,-2.0 + 3.0 * fParam5) / getSampleRate());
mod=(float)(2100.0 * pow(fParam4, 2));
if(fParam1<0.5)
@@ -187,9 +187,9 @@ void mdaStereo::getParameterLabel(LvzInt32 index, char *label)
case 0: if(fParam1<0.5) { strcpy(label, "Haas"); }
else { strcpy(label, "Comb"); } break;
case 1: strcpy(label, "ms"); break;
- case 2: strcpy(label, ""); break;
- case 3: strcpy(label, "ms"); break;
- case 4: strcpy(label, "sec"); break;
+ case 2: strcpy(label, ""); break;
+ case 3: strcpy(label, "ms"); break;
+ case 4: strcpy(label, "sec"); break;
}
}
@@ -202,32 +202,32 @@ void mdaStereo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d;
+ float a, b, c, d;
float li, ld, ri, rd, del, ph=phi, dph=dphi, mo=mod;
long tmp, bp = bufpos;
-
+
li = fli;
ld = fld;
ri = fri;
rd = frd;
del = fdel;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
-
+
if(mo>0.f) //modulated delay
{
while(--sampleFrames >= 0)
{
a = *++in1 + *++in2; //sum to mono
-
+
c = out1[1];
d = out2[1]; //process from here...
-
+
*(buffer + bp) = a; //write
-
+
tmp = (bp + (int)(del + fabs(mo * sin(ph)) ) ) % 4410;
b = *(buffer + tmp);
c += (a * li) - (b * ld); // output
@@ -237,21 +237,21 @@ void mdaStereo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
ph = ph + dph;
- *++out1 = c;
+ *++out1 = c;
*++out2 = d;
}
}
else
- {
+ {
while(--sampleFrames >= 0)
{
a = *++in1 + *++in2; //sum to mono
-
+
c = out1[1];
d = out2[1]; //process from here...
-
+
*(buffer + bp) = a; //write
-
+
tmp = (bp + (int)(del) ) % 4410;
b = *(buffer + tmp);
c += (a * li) - (b * ld); // output
@@ -259,7 +259,7 @@ void mdaStereo::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
bp = (bp - 1); if(bp < 0) bp = 4410; //buffer position
- *++out1 = c;
+ *++out1 = c;
*++out2 = d;
}
}
@@ -273,18 +273,18 @@ void mdaStereo::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, c, d;
+ float a, b, c, d;
float li, ld, ri, rd, del, ph=phi, dph=dphi, mo=mod;
long tmp, bp = bufpos;
-
+
li = fli;
ld = fld;
ri = fri;
rd = frd;
del = fdel;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
if(mo>0.f) //modulated delay
@@ -292,16 +292,16 @@ void mdaStereo::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
while(--sampleFrames >= 0)
{
a = *++in1 + *++in2; //sum to mono
-
+
*(buffer + bp) = a; //write
tmp = (bp + (int)(del + fabs(mo * sin(ph)) ) ) % 4410;
b = *(buffer + tmp);
c = (a * li) - (b * ld); // output
d = (a * ri) - (b * rd);
-
+
bp = (bp - 1); if(bp < 0) bp = 4410; //buffer position
-
+
ph = ph + dph;
*++out1 = c;
@@ -313,14 +313,14 @@ void mdaStereo::processReplacing(float **inputs, float **outputs, LvzInt32 sampl
while(--sampleFrames >= 0)
{
a = *++in1 + *++in2; //sum to mono
-
+
*(buffer + bp) = a; //write
tmp = (bp + (int)(del) ) % 4410;
b = *(buffer + tmp);
c = (a * li) - (b * ld); // output
d = (a * ri) - (b * rd);
-
+
bp = (bp - 1); if(bp < 0) bp = 4410; //buffer position
*++out1 = c;
diff --git a/src/mdaTalkBox.cpp b/src/mdaTalkBox.cpp
index f97d52b..2d24d7b 100644
--- a/src/mdaTalkBox.cpp
+++ b/src/mdaTalkBox.cpp
@@ -53,7 +53,7 @@ mdaTalkBox::mdaTalkBox(audioMasterCallback audioMaster): AudioEffectX(audioMaste
setProgram(0);
}
-
+
suspend();
}
@@ -66,12 +66,12 @@ void mdaTalkBox::resume() ///update internal parameters...
float fs = getSampleRate();
if(fs < 8000.0f) fs = 8000.0f;
if(fs > 96000.0f) fs = 96000.0f;
-
+
swap = (param[2] > 0.5f)? 1 : 0;
long n = (long)(0.01633f * fs);
if(n > BUF_MAX) n = BUF_MAX;
-
+
//O = (long)(0.0005f * fs);
O = (long)((0.0001f + 0.0004f * param[3]) * fs);
@@ -129,10 +129,10 @@ void mdaTalkBox::setProgram(LvzInt32 program)
}
-void mdaTalkBox::setParameter(LvzInt32 index, float value)
-{
+void mdaTalkBox::setParameter(LvzInt32 index, float value)
+{
programs[curProgram].param[index] = param[index] = value; //bug was here!
- resume();
+ resume();
}
float mdaTalkBox::getParameter(LvzInt32 index) { return param[index]; }
@@ -160,7 +160,7 @@ void mdaTalkBox::getParameterDisplay(LvzInt32 index, char *text)
switch(index)
{
case 2: if(swap) strcpy(string, "LEFT"); else strcpy(string, "RIGHT"); break;
-
+
case 3: sprintf(string, "%4.0f", 5.0f + 95.0f * param[index] * param[index]); break;
default: sprintf(string, "%4.0f %%", 200.0f * param[index]);
@@ -211,7 +211,7 @@ void mdaTalkBox::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
dr = o;
p = d0 + h0 * x; d0 = d1; d1 = x - h0 * p;
- q = d2 + h1 * d4; d2 = d3; d3 = d4 - h1 * q;
+ q = d2 + h1 * d4; d2 = d3; d3 = d4 - h1 * q;
d4 = x;
x = p + q;
@@ -220,7 +220,7 @@ void mdaTalkBox::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
K = 0;
car0[p0] = car1[p1] = x; //carrier input
-
+
x = o - e; e = o; //6dB/oct pre-emphasis
w = window[p0]; fx = buf0[p0] * w; buf0[p0] = x * w; //50% overlapping hanning windows
@@ -231,7 +231,7 @@ void mdaTalkBox::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
}
p = u0 + h0 * fx; u0 = u1; u1 = fx - h0 * p;
- q = u2 + h1 * u4; u2 = u3; u3 = u4 - h1 * q;
+ q = u2 + h1 * u4; u2 = u3; u3 = u4 - h1 * q;
u4 = fx;
x = p + q;
@@ -281,7 +281,7 @@ void mdaTalkBox::processReplacing(float **inputs, float **outputs, LvzInt32 samp
dr = o;
p = d0 + h0 * x; d0 = d1; d1 = x - h0 * p;
- q = d2 + h1 * d4; d2 = d3; d3 = d4 - h1 * q;
+ q = d2 + h1 * d4; d2 = d3; d3 = d4 - h1 * q;
d4 = x;
x = p + q;
@@ -290,7 +290,7 @@ void mdaTalkBox::processReplacing(float **inputs, float **outputs, LvzInt32 samp
K = 0;
car0[p0] = car1[p1] = x; //carrier input
-
+
x = o - e; e = o; //6dB/oct pre-emphasis
w = window[p0]; fx = buf0[p0] * w; buf0[p0] = x * w; //50% overlapping hanning windows
@@ -301,7 +301,7 @@ void mdaTalkBox::processReplacing(float **inputs, float **outputs, LvzInt32 samp
}
p = u0 + h0 * fx; u0 = u1; u1 = fx - h0 * p;
- q = u2 + h1 * u4; u2 = u3; u3 = u4 - h1 * q;
+ q = u2 + h1 * u4; u2 = u3; u3 = u4 - h1 * q;
u4 = fx;
x = p + q;
@@ -338,20 +338,20 @@ void mdaTalkBox::lpc(float *buf, float *car, long n, long o)
r[0] *= 1.001f; //stability fix
float min = 0.00001f;
- if(r[0] < min) { for(i=0; i<n; i++) buf[i] = 0.0f; return; }
+ if(r[0] < min) { for(i=0; i<n; i++) buf[i] = 0.0f; return; }
lpc_durbin(r, o, k, &G); //calc reflection coeffs
- for(i=0; i<=o; i++)
+ for(i=0; i<=o; i++)
{
if(k[i] > 0.995f) k[i] = 0.995f; else if(k[i] < -0.995f) k[i] = -.995f;
}
-
+
for(i=0; i<n; i++)
{
x = G * car[i];
for(j=o; j>0; j--) //lattice filter
- {
+ {
x -= k[j] * z[j-1];
z[j] = z[j-1] + k[j] * x;
}
@@ -364,24 +364,24 @@ void mdaTalkBox::lpc_durbin(float *r, int p, float *k, float *g)
{
int i, j;
float a[ORD_MAX], at[ORD_MAX], e=r[0];
-
+
for(i=0; i<=p; i++) a[i] = at[i] = 0.0f; //probably don't need to clear at[] or k[]
- for(i=1; i<=p; i++)
+ for(i=1; i<=p; i++)
{
k[i] = -r[i];
- for(j=1; j<i; j++)
- {
+ for(j=1; j<i; j++)
+ {
at[j] = a[j];
- k[i] -= a[j] * r[i-j];
+ k[i] -= a[j] * r[i-j];
}
if(fabs(e) < 1.0e-20f) { e = 0.0f; break; }
k[i] /= e;
-
+
a[i] = k[i];
for(j=1; j<i; j++) a[j] = at[j] + k[i] * at[i-j];
-
+
e *= 1.0f - k[i] * k[i];
}
diff --git a/src/mdaTestTone.cpp b/src/mdaTestTone.cpp
index 3f521a3..5c6650e 100644
--- a/src/mdaTestTone.cpp
+++ b/src/mdaTestTone.cpp
@@ -8,9 +8,9 @@ AudioEffect *createEffectInstance(audioMasterCallback audioMaster)
return new mdaTestTone(audioMaster);
}
-mdaTestTone::mdaTestTone(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 1, 8)
+mdaTestTone::mdaTestTone(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 1, 8)
{
- fParam0 = 0.47f; //mode
+ fParam0 = 0.47f; //mode
fParam1 = 0.71f; //level dB
fParam2 = 0.50f; //pan dB
fParam3 = 0.57f; //freq1 B
@@ -19,15 +19,15 @@ mdaTestTone::mdaTestTone(audioMasterCallback audioMaster) : AudioEffectX(audioMa
fParam6 = 0.30f; //sweep ms
fParam7 = 1.00f; //cal dBFS
- setNumInputs(2);
- setNumOutputs(2);
- setUniqueID("mdaTestTone");
- DECLARE_LVZ_DEPRECATED(canMono) ();
+ setNumInputs(2);
+ setNumOutputs(2);
+ setUniqueID("mdaTestTone");
+ DECLARE_LVZ_DEPRECATED(canMono) ();
canProcessReplacing();
strcpy(programName, "Signal Generator");
-
+
updateTx = updateRx;
-
+
suspend();
setParameter(6, 0.f);
}
@@ -65,12 +65,12 @@ void mdaTestTone::setParameter(LvzInt32 index, float value)
{
case 0: fParam0 = value; break;
case 1: fParam1 = value; break;
- case 2: fParam2 = value; break;
+ case 2: fParam2 = value; break;
case 3: fParam3 = value; break;
case 4: fParam4 = value; break;
- case 6: fParam5 = value; break;
- case 5: fParam6 = value; break;
- case 7: fParam7 = value; break;
+ case 6: fParam5 = value; break;
+ case 5: fParam6 = value; break;
+ case 7: fParam7 = value; break;
}
@@ -122,10 +122,10 @@ void mdaTestTone::setParameter(LvzInt32 index, float value)
void mdaTestTone::update()
{
updateRx = updateTx;
-
+
float f, df, twopi=6.2831853f;
- //calcs here!
+ //calcs here!
mode = int(8.9 * fParam0);
left = 0.05f * (float)int(60.f*fParam1);
left = (float)pow(10.0f, left - 3.f);
@@ -143,9 +143,9 @@ void mdaTestTone::update()
else if(fParam7>0.88) cal = -0.02000001f;
else if(fParam7>0.84) cal = -0.1f;
else cal = -0.2f;
-
- calx = (float)pow(10.0f, 0.05f*cal);
- left*=calx; right*=calx;
+
+ calx = (float)pow(10.0f, 0.05f*cal);
+ left*=calx; right*=calx;
calx = 0.f;
}
else //output level calibrate
@@ -153,7 +153,7 @@ void mdaTestTone::update()
cal = (float)int(25.f*fParam7 - 21.1f);
calx = cal;
}
-
+
df=0.f;
if(fParam4>0.6) df = 1.25f*fParam4 - 0.75f;
if(fParam4<0.4) df = 1.25f*fParam4 - 0.50f;
@@ -169,11 +169,11 @@ void mdaTestTone::update()
break;
case 1: //no frequency display
- case 2:
- case 3:
+ case 2:
+ case 3:
case 4: strcpy(disp1, "--");
strcpy(disp2, "--"); break;
-
+
case 5: //sine
f = 13.f + (float)floor(30.f*fParam3);
iso2string(f, disp1); //iso band freq
@@ -181,8 +181,8 @@ void mdaTestTone::update()
float2strng(f, disp2); //Hz
dphi=twopi*f/getSampleRate();
break;
-
- case 6: //log sweep & step
+
+ case 6: //log sweep & step
case 7: sw = 13.f + (float)floor(30.f*fParam3);
swx = 13.f + (float)floor(30.f*fParam4);
iso2string(sw, disp1); //start freq
@@ -191,8 +191,8 @@ void mdaTestTone::update()
if(mode==7) swx += 1.f;
swd = (swx-sw) / (len*getSampleRate());
swt= 2 * (long)getSampleRate();
- break;
-
+ break;
+
case 8: //lin sweep
sw = 200.f * (float)floor(100.f*fParam3);
swx = 200.f * (float)floor(100.f*fParam4);
@@ -203,7 +203,7 @@ void mdaTestTone::update()
swx = twopi*swx/getSampleRate();
swd = (swx-sw) / (len*getSampleRate());
swt= 2 * (long)getSampleRate();
- break;
+ break;
}
thru = (float)pow(10.0f, (0.05f * (float)int(40.f*fParam5)) - 2.f);
if(fParam5==0.0f) thru=0.0f;
@@ -236,13 +236,13 @@ void mdaTestTone::midi2string(float n, char *text)
case 8: t[p++]='G'; t[p++]='#'; break;
case 9: t[p++]='A'; break;
case 10: t[p++]='A'; t[p++]='#'; break;
- default: t[p++]='B';
- }
-
+ default: t[p++]='B';
+ }
+
if(o<0) { t[p++]='-'; o = -o; }
t[p++]= 48 + (o%10);
-
- t[p]=0;
+
+ t[p]=0;
strcpy(text, t);
}
@@ -254,7 +254,7 @@ void mdaTestTone::iso2string(float b, char *text)
case 14: strcpy(text, "25 Hz"); break;
case 15: strcpy(text, "31 Hz"); break;
case 16: strcpy(text, "40 Hz"); break;
- case 17: strcpy(text, "50 Hz"); break;
+ case 17: strcpy(text, "50 Hz"); break;
case 18: strcpy(text, "63 Hz"); break;
case 19: strcpy(text, "80 Hz"); break;
case 20: strcpy(text, "100 Hz"); break;
@@ -322,7 +322,7 @@ void mdaTestTone::getParameterDisplay(LvzInt32 index, char *text)
{
switch(index)
{
- case 0:
+ case 0:
switch(mode)
{
case 0: strcpy(text, "MIDI #"); break;
@@ -332,8 +332,8 @@ void mdaTestTone::getParameterDisplay(LvzInt32 index, char *text)
case 4: strcpy(text, "---"); break;
case 5: strcpy(text, "SINE"); break;
case 6: strcpy(text, "LOG SWP."); break;
- case 7: strcpy(text, "LOG STEP"); break;
- case 8: strcpy(text, "LIN SWP."); break;
+ case 7: strcpy(text, "LOG STEP"); break;
+ case 8: strcpy(text, "LIN SWP."); break;
} break;
case 1: long2string((long)(int(60.f * fParam1) - 60.0 - calx), text); break;
case 2: if(fParam2>0.3f)
@@ -370,7 +370,7 @@ void mdaTestTone::getParameterLabel(LvzInt32 index, char *label)
void mdaTestTone::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
{
if(updateRx != updateTx) update();
-
+
float *in1 = inputs[0];
float *in2 = inputs[1];
float *out1 = outputs[0];
@@ -382,28 +382,28 @@ void mdaTestTone::process(float **inputs, float **outputs, LvzInt32 sampleFrames
long st=swt;
int m=mode;
- --in1;
+ --in1;
--in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
- c = out1[1];
+ c = out1[1];
d = out2[1];
-
+
switch(m)
{
case 1: if(st>0) { st--; x=0.f; } else //impulse
- {
- x=1.f;
+ {
+ x=1.f;
st=(long)(len*getSampleRate());
}
break;
-
+
case 2: //noise
- #if WIN32
+ #if WIN32
case 3: x = (float)(rand() - 16384); //for RAND_MAX = 32767
#else //mac/gcc
case 3: x = (float)((rand() & 0x7FFF) - 16384);
@@ -417,17 +417,17 @@ void mdaTestTone::process(float **inputs, float **outputs, LvzInt32 sampleFrames
z4 = 0.620f * z4 + 0.108990f * x;
z5 = 0.250f * z5 + 0.255784f * x;
x = z0 + z1 + z2 + z3 + z4 + z5;
- }
+ }
break;
case 4: x=0.f; break; //mute
-
+
case 0: //tones
case 5:
- case 9: ph = (float)fmod(ph+dph,twopi);
- x = (float)sin(ph);
+ case 9: ph = (float)fmod(ph+dph,twopi);
+ x = (float)sin(ph);
break;
-
+
case 6: //log sweep & step
case 7: if(st>0) { st--; ph=0.f; } else
{
@@ -436,9 +436,9 @@ void mdaTestTone::process(float **inputs, float **outputs, LvzInt32 sampleFrames
else dph = fsc * (float)pow(10.0f, 0.1f * s);
x = (float)sin(ph);
ph = (float)fmod(ph+dph,twopi);
- if(s>sx) { l=0.f; r=0.f; }
+ if(s>sx) { l=0.f; r=0.f; }
}
- break;
+ break;
case 8: //lin sweep
if(st>0) { st--; ph=0.f; } else
@@ -446,14 +446,14 @@ void mdaTestTone::process(float **inputs, float **outputs, LvzInt32 sampleFrames
s += ds;
x = (float)sin(ph);
ph = (float)fmod(ph+s,twopi);
- if(s>sx) { l=0.f; r=0.f; }
- }
- break;
+ if(s>sx) { l=0.f; r=0.f; }
+ }
+ break;
}
*++out1 = c + t*a + l*x;
*++out2 = d + t*b + r*x;
}
- zz0=z0; zz1=z1; zz2=z2; zz3=z3, zz4=z4; zz5=z5;
+ zz0=z0; zz1=z1; zz2=z2; zz3=z3, zz4=z4; zz5=z5;
phi=ph; sw=s; swt=st;
if(s>sx) setParameter(0, fParam0); //retrigger sweep
}
@@ -473,26 +473,26 @@ void mdaTestTone::processReplacing(float **inputs, float **outputs, LvzInt32 sam
long st=swt;
int m=mode;
- --in1;
+ --in1;
--in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
-
+
switch(m)
{
case 1: if(st>0) { st--; x=0.f; } else //impulse
- {
- x=1.f;
+ {
+ x=1.f;
st=(long)(len*getSampleRate());
}
break;
-
+
case 2: //noise
- #if WIN32
+ #if WIN32
case 3: x = (float)(rand() - 16384); //for RAND_MAX = 32767
#else //mac/gcc
case 3: x = (float)((rand() & 0x7FFF) - 16384);
@@ -506,17 +506,17 @@ void mdaTestTone::processReplacing(float **inputs, float **outputs, LvzInt32 sam
z4 = 0.620f * z4 + 0.108990f * x;
z5 = 0.250f * z5 + 0.255784f * x;
x = z0 + z1 + z2 + z3 + z4 + z5;
- }
+ }
break;
case 4: x=0.f; break; //mute
-
+
case 0: //tones
case 5:
- case 9: ph = (float)fmod(ph+dph,twopi);
- x = (float)sin(ph);
+ case 9: ph = (float)fmod(ph+dph,twopi);
+ x = (float)sin(ph);
break;
-
+
case 6: //log sweep & step
case 7: if(st>0) { st--; ph=0.f; } else
{
@@ -525,9 +525,9 @@ void mdaTestTone::processReplacing(float **inputs, float **outputs, LvzInt32 sam
else dph = fsc * (float)pow(10.0f, 0.1f * s);
x = (float)sin(ph);
ph = (float)fmod(ph+dph,twopi);
- if(s>sx) { l=0.f; r=0.f; }
+ if(s>sx) { l=0.f; r=0.f; }
}
- break;
+ break;
case 8: //lin sweep
if(st>0) { st--; ph=0.f; } else
@@ -535,15 +535,15 @@ void mdaTestTone::processReplacing(float **inputs, float **outputs, LvzInt32 sam
s += ds;
x = (float)sin(ph);
ph = (float)fmod(ph+s,twopi);
- if(s>sx) { l=0.f; r=0.f; }
- }
- break;
+ if(s>sx) { l=0.f; r=0.f; }
+ }
+ break;
}
*++out1 = t*a + l*x;
*++out2 = t*b + r*x;
}
- zz0=z0; zz1=z1; zz2=z2; zz3=z3, zz4=z4; zz5=z5;
+ zz0=z0; zz1=z1; zz2=z2; zz3=z3, zz4=z4; zz5=z5;
phi=ph; sw=s; swt=st;
if(s>sx) setParameter(0, fParam0); //retrigger sweep
}
diff --git a/src/mdaTestTone.h b/src/mdaTestTone.h
index 9364ed8..f613678 100644
--- a/src/mdaTestTone.h
+++ b/src/mdaTestTone.h
@@ -34,7 +34,7 @@ protected:
float fParam0, fParam1, fParam2;
float fParam3, fParam4, fParam5;
float fParam6, fParam7;
-
+
float thru, left, right, len;
float zz0, zz1, zz2, zz3, zz4, zz5, phi, dphi;
float sw, swd, swx, fscale, cal, calx;
diff --git a/src/mdaThruZero.cpp b/src/mdaThruZero.cpp
index 4ea4076..23b8afb 100644
--- a/src/mdaThruZero.cpp
+++ b/src/mdaThruZero.cpp
@@ -32,12 +32,12 @@ mdaThruZero::mdaThruZero(audioMasterCallback audioMaster): AudioEffectX(audioMas
setNumInputs(2);
setNumOutputs(2);
setUniqueID("mdaThruZero"); ///identify plug-in here
- DECLARE_LVZ_DEPRECATED(canMono) ();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
canProcessReplacing();
programs = new mdaThruZeroProgram[numPrograms]; ///////////////TODO: programs
setProgram(0);
-
+
///differences from default program...
programs[1].param[0] = 0.50f;
programs[1].param[1] = 0.20f;
@@ -56,7 +56,7 @@ mdaThruZero::mdaThruZero(audioMasterCallback audioMaster): AudioEffectX(audioMas
strcpy(programs[3].name,"Mad Modulator");
-
+
///initialise...
bufpos = 0;
buffer = new float[BUFMAX];
@@ -76,7 +76,7 @@ void mdaThruZero::resume() ///update internal parameters...
dep = 2000.0f * param[1] * param[1];
dem = dep - dep * param[4];
dep -= dem;
-
+
wet = param[2];
dry = 1.f - wet;
if(param[0]<0.01f) { rat=0.0f; phi=(float)0.0f; }
@@ -111,10 +111,10 @@ void mdaThruZero::setProgram(LvzInt32 program)
}
-void mdaThruZero::setParameter(LvzInt32 index, float value)
-{
+void mdaThruZero::setParameter(LvzInt32 index, float value)
+{
if(index==3) phi=0.0f; //reset cycle
- param[index] = value; resume();
+ param[index] = value; resume();
}
@@ -142,7 +142,7 @@ void mdaThruZero::getParameterDisplay(LvzInt32 index, char *text)
switch(index)
{
- case 0: if(param[0]<0.01f) strcpy (string, "-");
+ case 0: if(param[0]<0.01f) strcpy (string, "-");
else sprintf(string, "%.2f", (float)pow(10.0f ,2.0f - 3.0f * param[index])); break;
case 1: sprintf(string, "%.2f", 1000.f * dep / getSampleRate()); break;
case 3: sprintf(string, "%.0f", 200.0f * param[index] - 100.0f); break;
@@ -198,25 +198,25 @@ void mdaThruZero::processReplacing(float **inputs, float **outputs, LvzInt32 sam
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
- float a, b, f=fb, f1=fb1, f2=fb2, ph=phi;
+ float a, b, f=fb, f1=fb1, f2=fb2, ph=phi;
float ra=rat, de=dep, we=wet, dr=dry, ds=deps, dm=dem;
long tmp, tmpi, bp=bufpos;
float tmpf, dpt;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
- b = *++in2;
-
- ph += ra;
+ a = *++in1;
+ b = *++in2;
+
+ ph += ra;
if(ph>1.0f) ph -= 2.0f;
-
+
bp--; bp &= 0x7FF;
- *(buffer + bp) = a + f * f1;
+ *(buffer + bp) = a + f * f1;
*(buffer2 + bp) = b + f * f2;
//ds = 0.995f * (ds - de) + de; //smoothed depth change ...try inc not mult
@@ -224,14 +224,14 @@ void mdaThruZero::processReplacing(float **inputs, float **outputs, LvzInt32 sam
tmp = int(tmpf);
tmpf -= tmp;
tmp = (tmp + bp) & 0x7FF;
- tmpi = (tmp + 1) & 0x7FF;
-
+ tmpi = (tmp + 1) & 0x7FF;
+
f1 = *(buffer + tmp); //try adding a constant to reduce denormalling
f2 = *(buffer2 + tmp);
f1 = tmpf * (*(buffer + tmpi) - f1) + f1; //linear interpolation
f2 = tmpf * (*(buffer2 + tmpi) - f2) + f2;
- a = a * dr - f1 * we;
+ a = a * dr - f1 * we;
b = b * dr - f2 * we;
*++out1 = a;
diff --git a/src/mdaTracker.cpp b/src/mdaTracker.cpp
index 160bf2f..0a8d028 100644
--- a/src/mdaTracker.cpp
+++ b/src/mdaTracker.cpp
@@ -20,11 +20,11 @@ mdaTracker::mdaTracker(audioMasterCallback audioMaster) : AudioEffectX(audioMast
fParam7 = (float)0.50; //Trigger dB
fParam8 = (float)0.50; //Output
- setNumInputs(2);
- setNumOutputs(2);
+ setNumInputs(2);
+ setNumOutputs(2);
setUniqueID("mdaTracker"); // identify here
- DECLARE_LVZ_DEPRECATED(canMono) ();
- canProcessReplacing();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
+ canProcessReplacing();
strcpy(programName, "Pitch Tracker");
dphi = 100.f/getSampleRate(); //initial pitch
@@ -43,13 +43,13 @@ void mdaTracker::setParameter(LvzInt32 index, float value)
case 1: fParam2 = value; break;
case 2: fParam3 = value; break;
case 3: fParam4 = value; break;
- case 4: fParam5 = value; break;
+ case 4: fParam5 = value; break;
case 5: fParam6 = value; break;
case 6: fParam7 = value; break;
case 7: fParam8 = value; break;
}
//calcs here
- mode = int(fParam1*4.9);
+ mode = int(fParam1*4.9);
fo = filterFreq(50.f); fi = (1.f - fo)*(1.f - fo);
ddphi = fParam4 * fParam4;
thr = (float)pow(10.0, 3.0*fParam7 - 3.8);
@@ -86,7 +86,7 @@ void mdaTracker::suspend()
float mdaTracker::filterFreq(float hz)
{
float j, k, r=0.999f;
-
+
j = r * r - 1;
k = (float)(2.f - 2.f * r * r * cos(0.647f * hz / getSampleRate() ));
return (float)((sqrt(k*k - 4.f*j*j) - k) / (2.f*j));
@@ -188,9 +188,9 @@ void mdaTracker::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float we=wet, dr=dry, bo=bold, r1=res1, r2=res2, b3=buf3, b4=buf4;
float sw=saw, dsw=dsaw, dy=dyn, e=env, re=rel;
long m=max, n=num, s=sig, mn=min, mo=mode;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
@@ -204,33 +204,33 @@ void mdaTracker::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
tmp = (x>0.f)? x : -x; //dynamics envelope
e = (tmp>e)? 0.5f*(tmp + e) : e * re;
- b1 = o*b1 + i*x;
+ b1 = o*b1 + i*x;
b2 = o*b2 + b1; //low-pass filter
-
+
if(b2>t) //if >thresh
- {
+ {
if(s<1) //and was <thresh
{
if(n<mn) //not long ago
{
tmp2 = b2 / (b2 - bo); //update period
- tmp = trans*twopi/(n + dn - tmp2);
- dp = dp + ddp * (tmp - dp);
+ tmp = trans*twopi/(n + dn - tmp2);
+ dp = dp + ddp * (tmp - dp);
dn = tmp2;
dsw = 0.3183098f * dp;
- if(mode==4)
+ if(mode==4)
{
r1 = (float)cos(4.f*dp); //resonator
r2 = (float)sin(4.f*dp);
- }
+ }
}
n=0; //restart period measurement
}
s=1;
}
- else
+ else
{
- if(n>m) s=0; //now <thresh
+ if(n>m) s=0; //now <thresh
}
n++;
bo=b2;
@@ -238,26 +238,26 @@ void mdaTracker::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
p = (float)fmod(p+dp,twopi);
switch(mo)
{ //sine
- case 0: x=(float)sin(p); break;
+ case 0: x=(float)sin(p); break;
//square
- case 1: x=(sin(p)>0.f)? 0.5f : -0.5f; break;
+ case 1: x=(sin(p)>0.f)? 0.5f : -0.5f; break;
//saw
- case 2: sw = (float)fmod(sw+dsw,2.0f); x = sw - 1.f; break;
+ case 2: sw = (float)fmod(sw+dsw,2.0f); x = sw - 1.f; break;
//ring
- case 3: x *= (float)sin(p); break;
+ case 3: x *= (float)sin(p); break;
//filt
- case 4: x += (b3 * r1) - (b4 * r2);
- b4 = 0.996f * ((b3 * r2) + (b4 * r1));
- b3 = 0.996f * x; break;
- }
- x *= (we + dy * e);
+ case 4: x += (b3 * r1) - (b4 * r2);
+ b4 = 0.996f * ((b3 * r2) + (b4 * r1));
+ b3 = 0.996f * x; break;
+ }
+ x *= (we + dy * e);
*++out1 = c + dr*a + x;
*++out2 = d + dr*b + x;
}
- if(fabs(b1)<1.0e-10) {buf1=0.f; buf2=0.f; buf3=0.f; buf4=0.f; }
+ if(fabs(b1)<1.0e-10) {buf1=0.f; buf2=0.f; buf3=0.f; buf4=0.f; }
else {buf1=b1; buf2=b2; buf3=b3; buf4=b4;}
phi=p; dphi=dp; sig=s; bold=bo;
- num=(n>100000)? 100000: n;
+ num=(n>100000)? 100000: n;
env=e; saw=sw; dsaw=dsw; res1=r1; res2=r2;
}
@@ -272,9 +272,9 @@ void mdaTracker::processReplacing(float **inputs, float **outputs, LvzInt32 samp
float we=wet, dr=dry, bo=bold, r1=res1, r2=res2, b3=buf3, b4=buf4;
float sw=saw, dsw=dsaw, dy=dyn, e=env, re=rel;
long m=max, n=num, s=sig, mn=min, mo=mode;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
@@ -286,33 +286,33 @@ void mdaTracker::processReplacing(float **inputs, float **outputs, LvzInt32 samp
tmp = (x>0.f)? x : -x; //dynamics envelope
e = (tmp>e)? 0.5f*(tmp + e) : e * re;
- b1 = o*b1 + i*x;
+ b1 = o*b1 + i*x;
b2 = o*b2 + b1; //low-pass filter
-
+
if(b2>t) //if >thresh
- {
+ {
if(s<1) //and was <thresh
{
if(n<mn) //not long ago
{
tmp2 = b2 / (b2 - bo); //update period
- tmp = trans*twopi/(n + dn - tmp2);
- dp = dp + ddp * (tmp - dp);
+ tmp = trans*twopi/(n + dn - tmp2);
+ dp = dp + ddp * (tmp - dp);
dn = tmp2;
dsw = 0.3183098f * dp;
- if(mode==4)
+ if(mode==4)
{
r1 = (float)cos(4.f*dp); //resonator
r2 = (float)sin(4.f*dp);
- }
+ }
}
n=0; //restart period measurement
}
s=1;
}
- else
+ else
{
- if(n>m) s=0; //now <thresh
+ if(n>m) s=0; //now <thresh
}
n++;
bo=b2;
@@ -320,25 +320,25 @@ void mdaTracker::processReplacing(float **inputs, float **outputs, LvzInt32 samp
p = (float)fmod(p+dp,twopi);
switch(mo)
{ //sine
- case 0: x=(float)sin(p); break;
+ case 0: x=(float)sin(p); break;
//square
- case 1: x=(sin(p)>0.f)? 0.5f : -0.5f; break;
+ case 1: x=(sin(p)>0.f)? 0.5f : -0.5f; break;
//saw
- case 2: sw = (float)fmod(sw+dsw,2.0f); x = sw - 1.f; break;
+ case 2: sw = (float)fmod(sw+dsw,2.0f); x = sw - 1.f; break;
//ring
- case 3: x *= (float)sin(p); break;
+ case 3: x *= (float)sin(p); break;
//filt
- case 4: x += (b3 * r1) - (b4 * r2);
- b4 = 0.996f * ((b3 * r2) + (b4 * r1));
- b3 = 0.996f * x; break;
- }
- x *= (we + dy * e);
+ case 4: x += (b3 * r1) - (b4 * r2);
+ b4 = 0.996f * ((b3 * r2) + (b4 * r1));
+ b3 = 0.996f * x; break;
+ }
+ x *= (we + dy * e);
*++out1 = a;//dr*a + x;
*++out2 = dr*b + x;
}
- if(fabs(b1)<1.0e-10) {buf1=0.f; buf2=0.f; buf3=0.f; buf4=0.f; }
+ if(fabs(b1)<1.0e-10) {buf1=0.f; buf2=0.f; buf3=0.f; buf4=0.f; }
else {buf1=b1; buf2=b2; buf3=b3; buf4=b4;}
phi=p; dphi=dp; sig=s; bold=bo;
- num=(n>100000)? 100000: n;
+ num=(n>100000)? 100000: n;
env=e; saw=sw; dsaw=dsw; res1=r1; res2=r2;
}
diff --git a/src/mdaTransient.cpp b/src/mdaTransient.cpp
index b22a7e3..d35c9f5 100644
--- a/src/mdaTransient.cpp
+++ b/src/mdaTransient.cpp
@@ -7,9 +7,9 @@ AudioEffect *createEffectInstance(audioMasterCallback audioMaster)
return new mdaTransient(audioMaster);
}
-mdaTransient::mdaTransient(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 1, 6)
+mdaTransient::mdaTransient(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 1, 6)
{
- fParam1 = (float)0.50; //attack
+ fParam1 = (float)0.50; //attack
fParam2 = (float)0.50; //release
fParam3 = (float)0.50; //output
fParam4 = (float)0.49; //filter
@@ -19,7 +19,7 @@ mdaTransient::mdaTransient(audioMasterCallback audioMaster) : AudioEffectX(audio
setNumInputs(2); // stereo in
setNumOutputs(2); // stereo out
setUniqueID("mdaTransient"); // identify
- DECLARE_LVZ_DEPRECATED(canMono) ();
+ DECLARE_LVZ_DEPRECATED(canMono) ();
canProcessReplacing(); // supports both accumulating and replacing output
strcpy(programName, "Transient Processor"); // default program name
@@ -71,8 +71,8 @@ void mdaTransient::setParameter(LvzInt32 index, float value)
filx = 0.f;
}
- if(fParam1>0.5)
- {
+ if(fParam1>0.5)
+ {
att1 = (float)pow(10.0, -1.5);
att2 = (float)pow(10.0, 1.0 - 5.0 * fParam1);
}
@@ -139,7 +139,7 @@ void mdaTransient::getParameterDisplay(LvzInt32 index, char *text)
case 4: long2string((long)(100*fParam5),text); break;
case 5: long2string((long)(100*fParam6),text); break;
}
-
+
}
void mdaTransient::getParameterLabel(LvzInt32 index, char *label)
@@ -147,11 +147,11 @@ void mdaTransient::getParameterLabel(LvzInt32 index, char *label)
switch(index)
{
case 0: strcpy(label, "%"); break;
- case 1: strcpy(label, "%"); break;
+ case 1: strcpy(label, "%"); break;
case 2: strcpy(label, "dB"); break;
- case 3: strcpy(label, "Lo <> Hi"); break;
- case 4: strcpy(label, "%"); break;
- case 5: strcpy(label, "%"); break;
+ case 3: strcpy(label, "Lo <> Hi"); break;
+ case 4: strcpy(label, "%"); break;
+ case 5: strcpy(label, "%"); break;
}
}
@@ -165,38 +165,38 @@ void mdaTransient::process(float **inputs, float **outputs, LvzInt32 sampleFrame
float *out1 = outputs[0];
float *out2 = outputs[1];
float a, b, c, d, e, f, g, i;
- float e1=env1, e2=env2, e3=env3, e4=env4, y=dry;
+ float e1=env1, e2=env2, e3=env3, e4=env4, y=dry;
float a1=att1, a2=att2, r12=rel12, a34=att34, r3=rel3, r4=rel4;
float fi=fili, fo=filo, fx=filx, fb1=fbuf1, fb2=fbuf2;
- --in1;
- --in2;
+ --in1;
+ --in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
c = out1[1];
d = out1[2];
-
- fb1 = fo*fb1 + fi*a;
- fb2 = fo*fb2 + fi*b;
+
+ fb1 = fo*fb1 + fi*a;
+ fb2 = fo*fb2 + fi*b;
e = fb1 + fx*a;
f = fb2 + fx*b;
- i = a + b; i = (i>0)? i : -i;
+ i = a + b; i = (i>0)? i : -i;
e1 = (i>e1)? e1 + a1 * (i-e1) : e1 * r12;
e2 = (i>e2)? e2 + a2 * (i-e2) : e2 * r12;
e3 = (i>e3)? e3 + a34 * (i-e3) : e3 * r3;
e4 = (i>e4)? e4 + a34 * (i-e4) : e4 * r4;
g = (e1 - e2 + e3 - e4);
- *++out1 = c + y * (a + e * g);
- *++out2 = d + y * (b + f * g);
+ *++out1 = c + y * (a + e * g);
+ *++out2 = d + y * (b + f * g);
}
- if(e1<1.0e-10) { env1=0.f; env2=0.f; env3=0.f; env4=0.f; fbuf1=0.f; fbuf2=0.f; }
+ if(e1<1.0e-10) { env1=0.f; env2=0.f; env3=0.f; env4=0.f; fbuf1=0.f; fbuf2=0.f; }
else { env1=e1; env2=e2; env3=e3; env4=e4; fbuf1=fb1; fbuf2=fb2; }
}
@@ -207,12 +207,12 @@ void mdaTransient::processReplacing(float **inputs, float **outputs, LvzInt32 sa
float *out1 = outputs[0];
float *out2 = outputs[1];
float a, b, e, f, g, i;
- float e1=env1, e2=env2, e3=env3, e4=env4, y=dry;
+ float e1=env1, e2=env2, e3=env3, e4=env4, y=dry;
float a1=att1, a2=att2, r12=rel12, a34=att34, r3=rel3, r4=rel4;
float fi=fili, fo=filo, fx=filx, fb1=fbuf1, fb2=fbuf2;
-
- --in1;
- --in2;
+
+ --in1;
+ --in2;
--out1;
--out2;
@@ -220,22 +220,22 @@ void mdaTransient::processReplacing(float **inputs, float **outputs, LvzInt32 sa
{
a = *++in1;
b = *++in2;
-
- fb1 = fo*fb1 + fi*a;
- fb2 = fo*fb2 + fi*b;
- e = fb1 + fx*a;
+
+ fb1 = fo*fb1 + fi*a;
+ fb2 = fo*fb2 + fi*b;
+ e = fb1 + fx*a;
f = fb2 + fx*b;
- i = a + b; i = (i>0)? i : -i;
+ i = a + b; i = (i>0)? i : -i;
e1 = (i>e1)? e1 + a1 * (i-e1) : e1 * r12;
e2 = (i>e2)? e2 + a2 * (i-e2) : e2 * r12;
e3 = (i>e3)? e3 + a34 * (i-e3) : e3 * r3;
e4 = (i>e4)? e4 + a34 * (i-e4) : e4 * r4;
g = (e1 - e2 + e3 - e4);
- *++out1 = y * (a + e * g);
- *++out2 = y * (b + f * g);
+ *++out1 = y * (a + e * g);
+ *++out2 = y * (b + f * g);
}
- if(e1<1.0e-10) { env1=0.f; env2=0.f; env3=0.f; env4=0.f; fbuf1=0.f; fbuf2=0.f; }
+ if(e1<1.0e-10) { env1=0.f; env2=0.f; env3=0.f; env4=0.f; fbuf1=0.f; fbuf2=0.f; }
else { env1=e1; env2=e2; env3=e3; env4=e4; fbuf1=fb1; fbuf2=fb2; }
}
diff --git a/src/mdaVocInput.cpp b/src/mdaVocInput.cpp
index 5bf60a8..ed9cf5c 100644
--- a/src/mdaVocInput.cpp
+++ b/src/mdaVocInput.cpp
@@ -31,8 +31,8 @@ mdaVocInput::mdaVocInput(audioMasterCallback audioMaster): AudioEffectX(audioMas
{
setNumInputs(2);
setNumOutputs(2);
- setUniqueID("mdaVocInput"); ///identify plug-in here
- DECLARE_LVZ_DEPRECATED(canMono) ();
+ setUniqueID("mdaVocInput"); ///identify plug-in here
+ DECLARE_LVZ_DEPRECATED(canMono) ();
canProcessReplacing();
programs = new mdaVocInputProgram[numPrograms];
@@ -118,7 +118,7 @@ void mdaVocInput::getParameterDisplay(LvzInt32 index, char *text)
case 1: strcpy(string, "FREE"); break;
case 2: strcpy(string, "QUANT"); } break;
- case 1: if(track) sprintf(string, "%ld", (long)(48.0f * param[1] - 24.0f));
+ case 1: if(track) sprintf(string, "%ld", (long)(48.0f * param[1] - 24.0f));
else midi2string((long)(48.0f * param[1] + 21.0f), string); break;
case 4: midi2string((long)(48.0f * param[4] + 45.0f), string); break;
@@ -166,14 +166,14 @@ void mdaVocInput::midi2string(long n, char *text) //show name of MIDI note numbe
case 8: t[p++]='G'; t[p++]='#'; break;
case 9: t[p++]='A'; break;
case 10: t[p++]='A'; t[p++]='#'; break;
- default: t[p++]='B';
- }
+ default: t[p++]='B';
+ }
t[p++] = ' ';
-
+
if(o < 0) { t[p++] = '-'; o = -o; }
- t[p++] = (char)(48 + (o % 10));
-
- t[p] = 0;
+ t[p++] = (char)(48 + (o % 10));
+
+ t[p] = 0;
strcpy(text, t);
}
@@ -186,7 +186,7 @@ void mdaVocInput::process(float **inputs, float **outputs, LvzInt32 sampleFrames
float *out2 = outputs[1];
float a, b, c, d;
float ds=pstep, s=sawbuf, n=noise;
- float l0=lbuf0, l1=lbuf1, l2=lbuf2, l3=lbuf3;
+ float l0=lbuf0, l1=lbuf1, l2=lbuf2, l3=lbuf3;
float le=lenv, he=henv, et=lfreq*0.1f, lf=lfreq, v=vuv, mn=minp, mx=maxp;
float rootm=39.863137f;
long tr=track;
@@ -197,7 +197,7 @@ void mdaVocInput::process(float **inputs, float **outputs, LvzInt32 sampleFrames
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
c = out1[1];
d = out2[1];
@@ -226,14 +226,14 @@ void mdaVocInput::process(float **inputs, float **outputs, LvzInt32 sampleFrames
if(tr==2) //quantize pitch
{
ds = rootm * (float)(log10(ds) - root);
- ds = (float)pow(1.0594631, floor(ds + 0.5) + rootm * root);
+ ds = (float)pow(1.0594631, floor(ds + 0.5) + rootm * root);
}
}
l3 = l2; //restart period measurement
}
l2=l1; //remember previous sample
}
-
+
b = 0.00001f * (float)((rand() & 32767) - 16384); //sibilance
if(le>he) b *= s * n; //...or modulated breath noise
b += s; s += ds; if(s>0.5f) s-=1.0f; //badly aliased sawtooth!
@@ -249,7 +249,7 @@ void mdaVocInput::process(float **inputs, float **outputs, LvzInt32 sampleFrames
if(fabs(he)>1.0e-10) henv = he; else henv=0.0f; //catch denormals
if(fabs(l1)>1.0e-10) { lbuf0=l0; lbuf1=l1; lenv=le; } else { lbuf0 = lbuf1= lenv = 0.0f; }
lbuf2=l2, lbuf3=l3;
- if(tr) pstep=ds;
+ if(tr) pstep=ds;
}
@@ -261,7 +261,7 @@ void mdaVocInput::processReplacing(float **inputs, float **outputs, LvzInt32 sam
float *out2 = outputs[1];
float a, b;
float ds=pstep, s=sawbuf, n=noise;
- float l0=lbuf0, l1=lbuf1, l2=lbuf2, l3=lbuf3;
+ float l0=lbuf0, l1=lbuf1, l2=lbuf2, l3=lbuf3;
float le=lenv, he=henv, et=lfreq*0.1f, lf=lfreq, v=vuv, mn=minp, mx=maxp;
float rootm=39.863137f;
long tr=track;
@@ -272,7 +272,7 @@ void mdaVocInput::processReplacing(float **inputs, float **outputs, LvzInt32 sam
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1;
+ a = *++in1;
b = *++in2;
l0 -= lf * (l1 + a); //fundamental filter (peaking 2nd-order 100Hz lpf)
@@ -299,14 +299,14 @@ void mdaVocInput::processReplacing(float **inputs, float **outputs, LvzInt32 sam
if(tr==2) //quantize pitch
{
ds = rootm * (float)(log10(ds) - root);
- ds = (float)pow(1.0594631, floor(ds + 0.5) + rootm * root);
+ ds = (float)pow(1.0594631, floor(ds + 0.5) + rootm * root);
}
}
l3 = l2; //restart period measurement
}
l2=l1; //remember previous sample
}
-
+
b = 0.00001f * (float)((rand() & 32767) - 16384); //sibilance
if(le>he) b *= s * n; //...or modulated breath noise
b += s; s += ds; if(s>0.5f) s-=1.0f; //badly aliased sawtooth!
@@ -319,5 +319,5 @@ void mdaVocInput::processReplacing(float **inputs, float **outputs, LvzInt32 sam
if(fabs(he)>1.0e-10) henv = he; else henv=0.0f; //catch denormals
if(fabs(l1)>1.0e-10) { lbuf0=l0; lbuf1=l1; lenv=le; } else { lbuf0 = lbuf1= lenv = 0.0f; }
lbuf2=l2, lbuf3=l3;
- if(tr) pstep=ds;
+ if(tr) pstep=ds;
}
diff --git a/src/mdaVocoder.cpp b/src/mdaVocoder.cpp
index 0ced6f4..bf426b2 100644
--- a/src/mdaVocoder.cpp
+++ b/src/mdaVocoder.cpp
@@ -24,8 +24,8 @@ mdaVocoderProgram::mdaVocoderProgram() ///default program settings
param[3] = 0.40f; //hi band
param[4] = 0.16f; //envelope
param[5] = 0.55f; //filter q
- param[6] = 0.6667f;//freq range
- param[7] = 0.33f; //num bands
+ param[6] = 0.6667f;//freq range
+ param[7] = 0.33f; //num bands
strcpy(name, "Vocoder");
}
@@ -34,13 +34,13 @@ mdaVocoder::mdaVocoder(audioMasterCallback audioMaster): AudioEffectX(audioMaste
{
setNumInputs(2);
setNumOutputs(2);
- setUniqueID("mdaVocoder"); ///identify plug-in here
+ setUniqueID("mdaVocoder"); ///identify plug-in here
//canMono();
canProcessReplacing();
programs = new mdaVocoderProgram[numPrograms];
setProgram(0);
-
+
///differences from default program...
programs[1].param[7] = 0.66f;
strcpy(programs[1].name,"16 Band Vocoder");
@@ -72,12 +72,12 @@ void mdaVocoder::resume() ///update internal parameters...
swap = 1; if(param[0]>0.5f) swap = 0;
gain = (float)pow(10.0f, 2.0f * param[1] - 3.0f * param[5] - 2.0f);
-
+
thru = (float)pow(10.0f, 0.5f + 2.0f * param[1]);
high = param[3] * param[3] * param[3] * thru;
thru *= param[2] * param[2] * param[2];
-
- if(param[7]<0.5f)
+
+ if(param[7]<0.5f)
{
nbnd=8;
re=0.003f;
@@ -89,7 +89,7 @@ void mdaVocoder::resume() ///update internal parameters...
f[6][2] = 390.0f;
f[7][2] = 190.0f;
}
- else
+ else
{
nbnd=16;
re=0.0015f;
@@ -117,10 +117,10 @@ void mdaVocoder::resume() ///update internal parameters...
else
{
f[0][12] = (float)pow(10.0, -1.7 - 2.7f * param[4]); //envelope speed
-
+
rr = 0.022f / (float)nbnd; //minimum proportional to frequency to stop distortion
- for(i=1;i<nbnd;i++)
- {
+ for(i=1;i<nbnd;i++)
+ {
f[i][12] = (float)(0.025 - rr * (double)i);
if(f[0][12] < f[i][12]) f[i][12] = f[0][12];
}
@@ -128,7 +128,7 @@ void mdaVocoder::resume() ///update internal parameters...
}
rr = 1.0 - pow(10.0f, -1.0f - 1.2f * param[5]);
- sh = (float)pow(2.0f, 3.0f * param[6] - 1.0f); //filter bank range shift
+ sh = (float)pow(2.0f, 3.0f * param[6] - 1.0f); //filter bank range shift
for(i=1;i<nbnd;i++)
{
@@ -147,7 +147,7 @@ void mdaVocoder::resume() ///update internal parameters...
void mdaVocoder::suspend() ///clear any buffers...
{
long i, j;
-
+
for(i=0; i<nbnd; i++) for(j=3; j<12; j++) f[i][j] = 0.0f; //zero band filters and envelopes
kout = 0.0f;
kval = 0;
@@ -236,27 +236,27 @@ void mdaVocoder::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float *out2 = outputs[1];
float a, b, c, d, o=0.0f, aa, bb, oo=kout, g=gain, ht=thru, hh=high, tmp;
long i, k=kval, sw=swap, nb=nbnd;
-
+
--in1;
--in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1; //speech
+ a = *++in1; //speech
b = *++in2; //synth
c = out1[1];
d = out2[1];
if(sw==0) { tmp=a; a=b; b=tmp; } //swap channels
-
+
tmp = a - f[0][7]; //integrate modulator for HF band and filter bank pre-emphasis
f[0][7] = a;
a = tmp;
-
+
if(tmp<0.0f) tmp = -tmp;
f[0][11] -= f[0][12] * (f[0][11] - tmp); //high band envelope
o = f[0][11] * (ht * a + hh * (b - f[0][3])); //high band + high thru
-
+
f[0][3] = b; //integrate carrier for HF band
if(++k & 0x1) //this block runs at half sample rate
@@ -264,8 +264,8 @@ void mdaVocoder::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
oo = 0.0f;
aa = a + f[0][9] - f[0][8] - f[0][8]; //apply zeros here instead of in each reson
f[0][9] = f[0][8]; f[0][8] = a;
- bb = b + f[0][5] - f[0][4] - f[0][4];
- f[0][5] = f[0][4]; f[0][4] = b;
+ bb = b + f[0][5] - f[0][4] - f[0][4];
+ f[0][5] = f[0][4]; f[0][4] = b;
for(i=1; i<nb; i++) //filter bank: 4th-order band pass
{
@@ -282,7 +282,7 @@ void mdaVocoder::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
tmp += f[i][2] * f[i][9] + f[i][1] * f[i][10];
f[i][10] = f[i][9];
f[i][9] = tmp;
-
+
if(tmp<0.0f) tmp = -tmp;
f[i][11] -= f[i][12] * (f[i][11] - tmp);
oo += f[i][5] * f[i][11];
@@ -294,14 +294,14 @@ void mdaVocoder::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
*++out2 = d + o;
}
- kout = oo;
+ kout = oo;
kval = k & 0x1;
if(fabs(f[0][11])<1.0e-10) f[0][11] = 0.0f; //catch HF envelope denormal
- for(i=1;i<nb;i++)
- if(fabs(f[i][3])<1.0e-10 || fabs(f[i][7])<1.0e-10)
+ for(i=1;i<nb;i++)
+ if(fabs(f[i][3])<1.0e-10 || fabs(f[i][7])<1.0e-10)
for(k=3; k<12; k++) f[i][k] = 0.0f; //catch reson & envelope denormals
-
+
if(fabs(o)>10.0f) suspend(); //catch instability
}
@@ -314,25 +314,25 @@ void mdaVocoder::processReplacing(float **inputs, float **outputs, LvzInt32 samp
float *out2 = outputs[1];
float a, b, o=0.0f, aa, bb, oo=kout, g=gain, ht=thru, hh=high, tmp;
long i, k=kval, sw=swap, nb=nbnd;
-
+
--in1;
--in2;
--out1;
--out2;
while(--sampleFrames >= 0)
{
- a = *++in1; //speech
+ a = *++in1; //speech
b = *++in2; //synth
if(sw==0) { tmp=a; a=b; b=tmp; } //swap channels
-
+
tmp = a - f[0][7]; //integrate modulator for HF band and filter bank pre-emphasis
f[0][7] = a;
a = tmp;
-
+
if(tmp<0.0f) tmp = -tmp;
f[0][11] -= f[0][12] * (f[0][11] - tmp); //high band envelope
o = f[0][11] * (ht * a + hh * (b - f[0][3])); //high band + high thru
-
+
f[0][3] = b; //integrate carrier for HF band
if(++k & 0x1) //this block runs at half sample rate
@@ -340,8 +340,8 @@ void mdaVocoder::processReplacing(float **inputs, float **outputs, LvzInt32 samp
oo = 0.0f;
aa = a + f[0][9] - f[0][8] - f[0][8]; //apply zeros here instead of in each reson
f[0][9] = f[0][8]; f[0][8] = a;
- bb = b + f[0][5] - f[0][4] - f[0][4];
- f[0][5] = f[0][4]; f[0][4] = b;
+ bb = b + f[0][5] - f[0][4] - f[0][4];
+ f[0][5] = f[0][4]; f[0][4] = b;
for(i=1; i<nb; i++) //filter bank: 4th-order band pass
{
@@ -358,7 +358,7 @@ void mdaVocoder::processReplacing(float **inputs, float **outputs, LvzInt32 samp
tmp += f[i][2] * f[i][9] + f[i][1] * f[i][10];
f[i][10] = f[i][9];
f[i][9] = tmp;
-
+
if(tmp<0.0f) tmp = -tmp;
f[i][11] -= f[i][12] * (f[i][11] - tmp);
oo += f[i][5] * f[i][11];
@@ -370,12 +370,12 @@ void mdaVocoder::processReplacing(float **inputs, float **outputs, LvzInt32 samp
*++out2 = o;
}
- kout = oo;
+ kout = oo;
kval = k & 0x1;
if(fabs(f[0][11])<1.0e-10) f[0][11] = 0.0f; //catch HF envelope denormal
- for(i=1;i<nb;i++)
- if(fabs(f[i][3])<1.0e-10 || fabs(f[i][7])<1.0e-10)
+ for(i=1;i<nb;i++)
+ if(fabs(f[i][3])<1.0e-10 || fabs(f[i][7])<1.0e-10)
for(k=3; k<12; k++) f[i][k] = 0.0f; //catch reson & envelope denormals
if(fabs(o)>10.0f) suspend(); //catch instability