summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mdaPianoVoice.cpp4
-rw-r--r--src/mdaPianoVoice.h3
2 files changed, 7 insertions, 0 deletions
diff --git a/src/mdaPianoVoice.cpp b/src/mdaPianoVoice.cpp
index f7824d7..e23dc78 100644
--- a/src/mdaPianoVoice.cpp
+++ b/src/mdaPianoVoice.cpp
@@ -31,6 +31,7 @@ void mdaPianoVoice::reset() {
muff = 160.0f;
volume = 0.2f;
sustain = 0;
+ m_key = LV2::INVALID_KEY;
}
@@ -44,6 +45,9 @@ float mdaPianoVoice::p_helper(unsigned short id, Param d) {
void mdaPianoVoice::on(unsigned char note, unsigned char velocity)
{
+ // store key that turned this voice on (used in 'get_key')
+ m_key = key;
+
// TODO: replace with this voice's local copy
float * param = programs[curProgram].param;
float l=99.0f;
diff --git a/src/mdaPianoVoice.h b/src/mdaPianoVoice.h
index 441558f..53d8d60 100644
--- a/src/mdaPianoVoice.h
+++ b/src/mdaPianoVoice.h
@@ -41,6 +41,8 @@ class mdaPianoVoice : public LV2::Voice {
uint32_t note; //remember what note triggered this
// end of voice state
+ protected:
+ unsigned char m_key;
public:
mdaPianoVoice(double, short*, KGRP*);
@@ -49,6 +51,7 @@ class mdaPianoVoice : public LV2::Voice {
void update(Param); // recalculates internal variables
void on(unsigned char key, unsigned char velocity);
void reset(void);
+ unsigned char get_key(void) const { return m_key; }
};
#endif