aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-02-23 03:07:31 +0000
committerDavid Robillard <d@drobilla.net>2013-02-23 03:07:31 +0000
commit0fcfb78675cfa596d84f5ca47d9f4d6edb366266 (patch)
tree44d44b24ce7d8caace3f98ac1b6767d288af2898 /src
parent6d5085640d4fa0648fd8f0d1971f4500570431f8 (diff)
downloadmda.lv2-0fcfb78675cfa596d84f5ca47d9f4d6edb366266.tar.gz
mda.lv2-0fcfb78675cfa596d84f5ca47d9f4d6edb366266.tar.bz2
mda.lv2-0fcfb78675cfa596d84f5ca47d9f4d6edb366266.zip
Fix tuning of Piano and EPiano at sample rates other than 44.1 kHz.
git-svn-id: http://svn.drobilla.net/lad/trunk/plugins/mda.lv2@5068 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/mdaEPiano.cpp13
-rw-r--r--src/mdaEPiano.h1
-rw-r--r--src/mdaPiano.cpp12
-rw-r--r--src/mdaPiano.h1
4 files changed, 20 insertions, 7 deletions
diff --git a/src/mdaEPiano.cpp b/src/mdaEPiano.cpp
index 3aa101a..ece9a94 100644
--- a/src/mdaEPiano.cpp
+++ b/src/mdaEPiano.cpp
@@ -169,12 +169,17 @@ void mdaEPiano::update() //parameter change
}
-void mdaEPiano::resume()
+void mdaEPiano::setSampleRate(float rate)
{
- Fs = getSampleRate();
- iFs = 1.0f / Fs;
- dlfo = 6.283f * iFs * (float)exp(6.22f * programs[curProgram].param[5] - 2.61f); //lfo rate
+ AudioEffectX::setSampleRate(rate);
+ Fs = rate;
+ iFs = 1.0f / Fs;
+ dlfo = 6.283f * iFs * (float)exp(6.22f * programs[curProgram].param[5] - 2.61f); //lfo rate
+}
+
+void mdaEPiano::resume()
+{
DECLARE_LVZ_DEPRECATED (wantEvents) ();
}
diff --git a/src/mdaEPiano.h b/src/mdaEPiano.h
index 41d0fb0..ffa238f 100644
--- a/src/mdaEPiano.h
+++ b/src/mdaEPiano.h
@@ -86,6 +86,7 @@ public:
virtual void getParameterLabel(int32_t index, char *label);
virtual void getParameterDisplay(int32_t index, char *text);
virtual void getParameterName(int32_t index, char *text);
+ virtual void setSampleRate(float sampleRate);
virtual void setBlockSize(int32_t blockSize);
virtual void resume();
diff --git a/src/mdaPiano.cpp b/src/mdaPiano.cpp
index f207079..3a05fbe 100644
--- a/src/mdaPiano.cpp
+++ b/src/mdaPiano.cpp
@@ -145,11 +145,17 @@ void mdaPiano::update() //parameter change
}
+void mdaPiano::setSampleRate(float rate)
+{
+ AudioEffectX::setSampleRate(rate);
+ Fs = rate;
+ iFs = 1.0f / Fs;
+ if(Fs > 64000.0f) cmax = 0xFF; else cmax = 0x7F;
+}
+
+
void mdaPiano::resume()
{
- Fs = getSampleRate();
- iFs = 1.0f / Fs;
- if(Fs > 64000.0f) cmax = 0xFF; else cmax = 0x7F;
memset(comb, 0, sizeof(float) * 256);
DECLARE_LVZ_DEPRECATED (wantEvents) ();
diff --git a/src/mdaPiano.h b/src/mdaPiano.h
index bd6f82a..012fcee 100644
--- a/src/mdaPiano.h
+++ b/src/mdaPiano.h
@@ -90,6 +90,7 @@ public:
virtual void getParameterLabel(int32_t index, char *label);
virtual void getParameterDisplay(int32_t index, char *text);
virtual void getParameterName(int32_t index, char *text);
+ virtual void setSampleRate(float sampleRate);
virtual void setBlockSize(int32_t blockSize);
virtual void resume();