diff options
author | rekado <rekado@elephly.net> | 2013-01-14 21:36:55 +0800 |
---|---|---|
committer | rekado <rekado@elephly.net> | 2013-01-14 21:42:14 +0800 |
commit | a05e7ee521b3273f67bfea530cbaadf1f1b0fa3d (patch) | |
tree | 901f5cd59c2346d7af4e79a8faf20d9d8c335136 | |
parent | a5c1fa43261a7ce246a92c6ffd1c339b4cb1b613 (diff) |
implement muffling setter
-rw-r--r-- | src/mdaPiano.cpp | 9 | ||||
-rw-r--r-- | src/mdaPianoVoice.h | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/mdaPiano.cpp b/src/mdaPiano.cpp index 9912c75..a015439 100644 --- a/src/mdaPiano.cpp +++ b/src/mdaPiano.cpp @@ -98,8 +98,13 @@ void mdaPiano::handle_midi(uint32_t size, unsigned char* data) { { case 0x01: //mod wheel case 0x43: //soft pedal - muff = 0.01f * (float)((127 - data[2]) * (127 - data[2])); - break; + { + float muff = 0.01f * (float)((127 - data[2]) * (127 - data[2])); + for (unsigned i = 0; i < NVOICES; ++i) { + voices[i]->set_muff(muff); + } + break; + } case 0x07: //volume setVolume(0.00002f * (float)(data[2] * data[2])); diff --git a/src/mdaPianoVoice.h b/src/mdaPianoVoice.h index dc87719..e38e7bc 100644 --- a/src/mdaPianoVoice.h +++ b/src/mdaPianoVoice.h @@ -21,7 +21,7 @@ class mdaPianoVoice : public LV2::Voice { short *waves; float default_preset[NPARAMS]; // contains the default preset short sustain; - float volume; + float volume, muff; // voice state uint32_t delta; //sample playback @@ -48,6 +48,7 @@ class mdaPianoVoice : public LV2::Voice { public: mdaPianoVoice(double, short*, KGRP*); void set_volume(float v) { volume = v; } + void set_muff(float v) { muff = v; } float p_helper(unsigned short, Param); void update(Param); // recalculates internal variables |