From 0fcfb78675cfa596d84f5ca47d9f4d6edb366266 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 23 Feb 2013 03:07:31 +0000 Subject: 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 --- NEWS | 6 ++++++ src/mdaEPiano.cpp | 13 +++++++++---- src/mdaEPiano.h | 1 + src/mdaPiano.cpp | 12 +++++++++--- src/mdaPiano.h | 1 + wscript | 15 +++++---------- 6 files changed, 31 insertions(+), 17 deletions(-) diff --git a/NEWS b/NEWS index c244772..82bff50 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +mda-lv2 (1.1.0) unstable; + + * Fix tuning of Piano and EPiano at sample rates other than 44.1 kHz + + -- David Robillard Fri, 22 Feb 2013 21:43:47 -0500 + mda-lv2 (1.0.0) stable; * Initial release 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(); diff --git a/wscript b/wscript index 1502c3f..0e55dd4 100644 --- a/wscript +++ b/wscript @@ -4,7 +4,7 @@ import re import shutil import waflib.extras.autowaf as autowaf -MDA_VERSION = '1.0.0' +MDA_VERSION = '1.1.0' # Mandatory waf variables APPNAME = 'MDA' # Package name for waf dist @@ -31,16 +31,11 @@ def configure(conf): def build(bld): bundle = 'mda.lv2' - # Copy data files to build bundle (build/mda.lv2) - def do_copy(task): - src = task.inputs[0].abspath() - tgt = task.outputs[0].abspath() - return shutil.copy(src, tgt) - for i in bld.path.ant_glob('mda.lv2/[A-Z]*.ttl'): - bld(rule = do_copy, - source = i, - target = bld.path.get_bld().make_node('mda.lv2/%s' % i), + bld(features = 'subst', + is_copy = True, + source = i, + target = bld.path.get_bld().make_node('mda.lv2/%s' % i), install_path = '${LV2DIR}/mda.lv2') # Make a pattern for shared objects without the 'lib' prefix -- cgit v1.2.1