summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mdaPiano.cpp9
-rw-r--r--src/mdaPianoVoice.h3
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