aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mdaDetune.cpp75
-rw-r--r--src/mdaDetune.h11
-rw-r--r--src/mdaJX10.cpp2
-rw-r--r--src/mdaLimiter.cpp2
4 files changed, 39 insertions, 51 deletions
diff --git a/src/mdaDetune.cpp b/src/mdaDetune.cpp
index 5518d74..21274f5 100644
--- a/src/mdaDetune.cpp
+++ b/src/mdaDetune.cpp
@@ -16,21 +16,11 @@ AudioEffect *createEffectInstance(audioMasterCallback audioMaster)
return new mdaDetune(audioMaster);
}
-mdaDetuneProgram::mdaDetuneProgram() ///default program settings
-{
- param[0] = 0.40f; //fine
- param[1] = 0.40f; //mix
- param[2] = 0.50f; //output
- param[3] = 0.50f; //chunksize
- strcpy(name, "Stereo Detune");
-}
-
-bool mdaDetune::getProductString(char* text) { strcpy(text, "MDA Detune"); return true; }
+bool mdaDetune::getProductString(char* text) { strcpy(text, "mda Detune"); return true; }
bool mdaDetune::getVendorString(char* text) { strcpy(text, "mda"); return true; }
bool mdaDetune::getEffectName(char* name) { strcpy(name, "Detune"); return true; }
mdaDetune::mdaDetune(audioMasterCallback audioMaster): AudioEffectX(audioMaster, NPROGS, NPARAMS)
-, programs(0), buf(0), win(0)
{
setNumInputs(2);
setNumOutputs(2);
@@ -39,21 +29,25 @@ mdaDetune::mdaDetune(audioMasterCallback audioMaster): AudioEffectX(audioMaster,
canProcessReplacing();
///initialise...
- buf = new float[BUFMAX];
- win = new float[BUFMAX];
buflen=0;
- programs = new mdaDetuneProgram[NPROGS];
- setProgram(0);
-
- ///differences from default program...
+ programs[0].param[0] = 0.20f; //fine
+ programs[0].param[1] = 0.90f; //mix
+ programs[0].param[2] = 0.50f; //output
+ programs[0].param[3] = 0.50f; //chunksize
+ strcpy(programs[0].name, "Stereo Detune");
programs[1].param[0] = 0.20f;
- programs[3].param[0] = 0.90f;
+ programs[1].param[1] = 0.90f;
+ programs[1].param[2] = 0.50f;
+ programs[1].param[3] = 0.50f;
strcpy(programs[1].name,"Symphonic");
programs[2].param[0] = 0.8f;
programs[2].param[1] = 0.7f;
+ programs[2].param[2] = 0.50f;
+ programs[2].param[3] = 0.50f;
strcpy(programs[2].name,"Out Of Tune");
+ setProgram(0);
suspend();
}
@@ -75,6 +69,7 @@ void mdaDetune::resume() ///update internal parameters...
if(tmp!=buflen) //recalculate crossfade window
{
buflen = tmp;
+ if (buflen > BUFMAX) buflen = BUFMAX;
bufres = 1000.0f * (float)buflen / getSampleRate();
LvzInt32 i; //hanning half-overlap-and-add
@@ -87,49 +82,45 @@ void mdaDetune::resume() ///update internal parameters...
void mdaDetune::suspend() ///clear any buffers...
{
memset(buf, 0, BUFMAX * sizeof(float));
+ memset(win, 0, BUFMAX * sizeof(float));
pos0 = 0; pos1 = pos2 = 0.0f;
}
-mdaDetune::~mdaDetune() ///destroy any buffers...
-{
- if(buf) delete [] buf;
- if(win) delete [] win;
- if(programs) delete [] programs;
-}
-
-
void mdaDetune::setProgram(LvzInt32 program)
{
- curProgram = program;
- resume();
+ if ((unsigned int)program < NPROGS)
+ {
+ curProgram = program;
+ resume();
+ }
}
-void mdaDetune::setParameter(LvzInt32 index, float value)
+void mdaDetune::setParameter(LvzInt32 which, float value)
{
- programs[curProgram].param[index] = value;
+ programs[curProgram].param[which] = value;
resume();
}
-float mdaDetune::getParameter(LvzInt32 index) { return programs[curProgram].param[index]; }
+float mdaDetune::getParameter(LvzInt32 which) { return programs[curProgram].param[which]; }
void mdaDetune::setProgramName(char *name) { strcpy(programs[curProgram].name, name); }
void mdaDetune::getProgramName(char *name) { strcpy(name, programs[curProgram].name); }
-bool mdaDetune::getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name)
+bool mdaDetune::getProgramNameIndexed (LvzInt32 category, LvzInt32 which, char* name)
{
- if ((unsigned int)index < NPROGS)
+ if ((unsigned int)which < NPROGS)
{
- strcpy(name, programs[index].name);
+ strcpy(name, programs[which].name);
return true;
}
return false;
}
-void mdaDetune::getParameterName(LvzInt32 index, char *label)
+void mdaDetune::getParameterName(LvzInt32 which, char *label)
{
- switch(index)
+ switch(which)
{
case 0: strcpy(label, "Detune"); break;
case 1: strcpy(label, "Mix"); break;
@@ -139,14 +130,14 @@ void mdaDetune::getParameterName(LvzInt32 index, char *label)
}
-void mdaDetune::getParameterDisplay(LvzInt32 index, char *text)
+void mdaDetune::getParameterDisplay(LvzInt32 which, char *text)
{
char string[16];
- switch(index)
+ switch(which)
{
- case 1: sprintf(string, "%.0f", 99.0f * programs[curProgram].param[index]); break;
- case 2: sprintf(string, "%.1f", 40.0f * programs[curProgram].param[index] - 20.0f); break;
+ case 1: sprintf(string, "%.0f", 99.0f * programs[curProgram].param[which]); break;
+ case 2: sprintf(string, "%.1f", 40.0f * programs[curProgram].param[which] - 20.0f); break;
case 3: sprintf(string, "%.1f", bufres); break;
default: sprintf(string, "%.1f", 100.0f * semi);
}
@@ -155,9 +146,9 @@ void mdaDetune::getParameterDisplay(LvzInt32 index, char *text)
}
-void mdaDetune::getParameterLabel(LvzInt32 index, char *label)
+void mdaDetune::getParameterLabel(LvzInt32 which, char *label)
{
- switch(index)
+ switch(which)
{
case 0: strcpy(label, "cents"); break;
case 1: strcpy(label, "%"); break;
diff --git a/src/mdaDetune.h b/src/mdaDetune.h
index 10b019b..d7fad31 100644
--- a/src/mdaDetune.h
+++ b/src/mdaDetune.h
@@ -10,11 +10,8 @@
#include "audioeffectx.h"
-class mdaDetuneProgram
+struct mdaDetuneProgram
{
-public:
- mdaDetuneProgram();
-private:
friend class mdaDetune;
float param[NPARAMS];
char name[32];
@@ -25,7 +22,6 @@ class mdaDetune : public AudioEffectX
{
public:
mdaDetune(audioMasterCallback audioMaster);
- ~mdaDetune();
virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames);
virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames);
@@ -47,10 +43,11 @@ public:
virtual LvzInt32 getVendorVersion() { return 1000; }
protected:
- mdaDetuneProgram *programs;
+ mdaDetuneProgram programs[NPROGS];
+ float buf[BUFMAX];
+ float win[BUFMAX];
///global internal variables
- float *buf, *win; //buffer, window
LvzInt32 buflen; //buffer length
float bufres; //buffer resolution display
float semi; //detune display
diff --git a/src/mdaJX10.cpp b/src/mdaJX10.cpp
index 9b21c72..a5804a1 100644
--- a/src/mdaJX10.cpp
+++ b/src/mdaJX10.cpp
@@ -281,7 +281,7 @@ void mdaJX10::setProgramName(char *name) { strcpy(programs[curProgram].name,
void mdaJX10::getProgramName(char *name) { strcpy(name, programs[curProgram].name); }
void mdaJX10::setBlockSize(LvzInt32 blockSize) { AudioEffectX::setBlockSize(blockSize); }
bool mdaJX10::getEffectName(char* name) { strcpy(name, "MDA JX10 Synth"); return true; }
-bool mdaJX10::getVendorString(char* text) { strcpy(text, "maxim digital audio"); return true; }
+bool mdaJX10::getVendorString(char* text) { strcpy(text, "MDA"); return true; }
bool mdaJX10::getProductString(char* text) { strcpy(text, "MDA JX10 Synth"); return true; }
diff --git a/src/mdaLimiter.cpp b/src/mdaLimiter.cpp
index 98febd3..11358e7 100644
--- a/src/mdaLimiter.cpp
+++ b/src/mdaLimiter.cpp
@@ -139,7 +139,7 @@ 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 3: strcpy(label, "ms"); break;
case 2: strcpy(label, "ms"); break;
case 4: strcpy(label, ""); break;
}