diff options
author | David Robillard <d@drobilla.net> | 2010-02-22 21:24:34 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-22 21:24:34 +0000 |
commit | adacb33bf4eadcd49a744177bf3f059e7b2f2f52 (patch) | |
tree | 922620c99fdc348529002d1a000ec0e8f94f3041 /src/mdaSplitter.cpp | |
parent | 4514036c46168f4bbc693649989d53bdffe6137b (diff) | |
download | mda.lv2-adacb33bf4eadcd49a744177bf3f059e7b2f2f52.tar.gz mda.lv2-adacb33bf4eadcd49a744177bf3f059e7b2f2f52.tar.bz2 mda.lv2-adacb33bf4eadcd49a744177bf3f059e7b2f2f52.zip |
Merge with upstream r2.
git-svn-id: http://svn.drobilla.net/lad/trunk/mda-lv2@2471 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/mdaSplitter.cpp')
-rw-r--r-- | src/mdaSplitter.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/mdaSplitter.cpp b/src/mdaSplitter.cpp index 018f0c9..f0c4fd6 100644 --- a/src/mdaSplitter.cpp +++ b/src/mdaSplitter.cpp @@ -37,7 +37,7 @@ mdaSplitter::mdaSplitter(audioMasterCallback audioMaster): AudioEffectX(audioMas DECLARE_LVZ_DEPRECATED(canMono) (); canProcessReplacing(); - programs = new mdaSplitterProgram[numPrograms]; + programs = new mdaSplitterProgram[NPROGS]; setProgram(0); ///differences from default program... @@ -56,7 +56,7 @@ bool mdaSplitter::getEffectName(char* name) { strcpy(name, "Splitter"); retu void mdaSplitter::resume() ///update internal parameters... { - long tmp; + float * param = programs[curProgram].param; freq = param[1]; fdisp = (float)pow(10.0f, 2.0f + 2.0f * freq); //frequency @@ -64,7 +64,7 @@ void mdaSplitter::resume() ///update internal parameters... if(freq>1.0f) freq = 1.0f; ff = -1.0f; //above - tmp = (long)(2.9f * param[2]); //frequency switching + LvzInt32 tmp = (LvzInt32)(2.9f * param[2]); //frequency switching if(tmp==0) ff = 0.0f; //below if(tmp==1) freq = 0.001f; //all @@ -72,7 +72,7 @@ void mdaSplitter::resume() ///update internal parameters... level = (float)pow(10.0f, 0.05f * ldisp + 0.3f); ll = 0.0f; //above - tmp = (long)(2.9f * param[4]); //level switching + tmp = (LvzInt32)(2.9f * param[4]); //level switching if(tmp==0) ll = -1.0f; //below if(tmp==1) level = 0.0f; //all @@ -87,7 +87,7 @@ void mdaSplitter::resume() ///update internal parameters... i2l = i2r = o2l = o2r = (float)pow(10.0f, 2.0f * param[6] - 1.0f); //gain - mode = (long)(3.9f * param[0]); //output routing + mode = (LvzInt32)(3.9f * param[0]); //output routing switch(mode) { case 0: i2l = 0.0f; i2r = 0.0f; break; @@ -112,27 +112,30 @@ mdaSplitter::~mdaSplitter() ///destroy any buffers... void mdaSplitter::setProgram(LvzInt32 program) { - int i=0; - - mdaSplitterProgram *p = &programs[program]; curProgram = program; - setProgramName(p->name); - for(i=0; i<NPARAMS; i++) param[i] = p->param[i]; resume(); } void mdaSplitter::setParameter(LvzInt32 index, float value) { - programs[curProgram].param[index] = param[index] = value; //bug was here! + programs[curProgram].param[index] = value; //bug was here! resume(); } -float mdaSplitter::getParameter(LvzInt32 index) { return param[index]; } -void mdaSplitter::setProgramName(char *name) { strcpy(programName, name); } -void mdaSplitter::getProgramName(char *name) { strcpy(name, programName); } - +float mdaSplitter::getParameter(LvzInt32 index) { return programs[curProgram].param[index]; } +void mdaSplitter::setProgramName(char *name) { strcpy(programs[curProgram].name, name); } +void mdaSplitter::getProgramName(char *name) { strcpy(name, programs[curProgram].name); } +bool mdaSplitter::getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name) +{ + if ((unsigned int)index < NPROGS) + { + strcpy(name, programs[index].name); + return true; + } + return false; +} void mdaSplitter::getParameterName(LvzInt32 index, char *label) { @@ -152,6 +155,7 @@ void mdaSplitter::getParameterName(LvzInt32 index, char *label) void mdaSplitter::getParameterDisplay(LvzInt32 index, char *text) { char string[16]; + float * param = programs[curProgram].param; switch(index) { @@ -166,7 +170,7 @@ void mdaSplitter::getParameterDisplay(LvzInt32 index, char *text) case 3: sprintf(string, "%.0f", ldisp); break; case 5: sprintf(string, "%.0f", (float)pow(10.0f, 1.0f + 2.0f * param[index])); break; case 6: sprintf(string, "%.1f", 40.0f * param[index] - 20.0f); break; - default: switch((long)(2.9f * param[index])) + default: switch((LvzInt32)(2.9f * param[index])) { case 0: strcpy (string, "BELOW"); break; case 1: strcpy (string, "ALL"); break; |