aboutsummaryrefslogtreecommitdiffstats
path: root/src/mdaDelay.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-22 21:24:34 +0000
committerDavid Robillard <d@drobilla.net>2010-02-22 21:24:34 +0000
commitadacb33bf4eadcd49a744177bf3f059e7b2f2f52 (patch)
tree922620c99fdc348529002d1a000ec0e8f94f3041 /src/mdaDelay.cpp
parent4514036c46168f4bbc693649989d53bdffe6137b (diff)
downloadmda.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/mdaDelay.cpp')
-rw-r--r--src/mdaDelay.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/mdaDelay.cpp b/src/mdaDelay.cpp
index 6780679..233251e 100644
--- a/src/mdaDelay.cpp
+++ b/src/mdaDelay.cpp
@@ -52,7 +52,7 @@ void mdaDelay::setParameter(LvzInt32 index, float value)
case 5: fParam5 = value; break;
}
//calcs here
- ldel = (long)(size * fParam0 * fParam0);
+ ldel = (LvzInt32)(size * fParam0 * fParam0);
if(ldel<4) ldel=4;
switch(int(fParam1 * 17.9f)) //fixed left/right ratios
@@ -68,7 +68,7 @@ void mdaDelay::setParameter(LvzInt32 index, float value)
case 9: tmp = 2.0000f; break;
default: tmp = 4.0f * fParam1; break; //variable ratio
}
- rdel = (long)(size * fParam0 * fParam0 * tmp);
+ rdel = (LvzInt32)(size * fParam0 * fParam0 * tmp);
if(rdel>size) rdel=size;
if(rdel<4) rdel=4;
@@ -115,6 +115,16 @@ void mdaDelay::getProgramName(char *name)
strcpy(name, programName);
}
+bool mdaDelay::getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name)
+{
+ if (index == 0)
+ {
+ strcpy(name, programName);
+ return true;
+ }
+ return false;
+}
+
float mdaDelay::getParameter(LvzInt32 index)
{
float v=0;
@@ -145,18 +155,18 @@ void mdaDelay::getParameterName(LvzInt32 index, char *label)
}
#include <stdio.h>
-void long2string(long value, char *string) { sprintf(string, "%ld", value); }
+void int2strng(LvzInt32 value, char *string) { sprintf(string, "%d", value); }
void mdaDelay::getParameterDisplay(LvzInt32 index, char *text)
{
switch(index)
{
- case 0: long2string((long)(ldel * 1000.0f / getSampleRate()), text); break;
- case 1: long2string((long)(100 * rdel / ldel), text); break;
- case 2: long2string((long)(99 * fParam2), text); break;
- case 3: long2string((long)(200 * fParam3 - 100), text); break;
- case 4: long2string((long)(100 * fParam4), text); break;
- case 5: long2string((long)(20 * log10(2.0 * fParam5)), text); break;
+ case 0: int2strng((LvzInt32)(ldel * 1000.0f / getSampleRate()), text); break;
+ case 1: int2strng((LvzInt32)(100 * rdel / ldel), text); break;
+ case 2: int2strng((LvzInt32)(99 * fParam2), text); break;
+ case 3: int2strng((LvzInt32)(200 * fParam3 - 100), text); break;
+ case 4: int2strng((LvzInt32)(100 * fParam4), text); break;
+ case 5: int2strng((LvzInt32)(20 * log10(2.0 * fParam5)), text); break;
}
}
@@ -182,7 +192,7 @@ void mdaDelay::process(float **inputs, float **outputs, LvzInt32 sampleFrames)
float *out2 = outputs[1];
float a, b, c, d, ol, or_, w=wet, y=dry, fb=fbk;
float lx=lmix, hx=hmix, f=fil, f0=fil0, tmp;
- long i=ipos, l, r, s=size;
+ LvzInt32 i=ipos, l, r, s=size;
l = (i + ldel) % (s + 1);
r = (i + rdel) % (s + 1);
@@ -224,7 +234,7 @@ void mdaDelay::processReplacing(float **inputs, float **outputs, LvzInt32 sample
float *out2 = outputs[1];
float a, b, ol, or_, w=wet, y=dry, fb=fbk;
float lx=lmix, hx=hmix, f=fil, f0=fil0, tmp;
- long i=ipos, l, r, s=size;
+ LvzInt32 i=ipos, l, r, s=size;
l = (i + ldel) % (s + 1);
r = (i + rdel) % (s + 1);