diff options
author | David Robillard <d@drobilla.net> | 2013-02-23 03:07:31 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-02-23 03:07:31 +0000 |
commit | 0fcfb78675cfa596d84f5ca47d9f4d6edb366266 (patch) | |
tree | 44d44b24ce7d8caace3f98ac1b6767d288af2898 /src/mdaPiano.cpp | |
parent | 6d5085640d4fa0648fd8f0d1971f4500570431f8 (diff) | |
download | mda.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/mdaPiano.cpp')
-rw-r--r-- | src/mdaPiano.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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) (); |