diff options
author | rekado <rekado@elephly.net> | 2013-01-14 21:19:34 +0800 |
---|---|---|
committer | rekado <rekado@elephly.net> | 2013-01-14 21:19:34 +0800 |
commit | 2b7b9db59fe837838df10b686c7aacd0e05f3d7a (patch) | |
tree | 512c0dbc70e05297ee68442bce59b9e3d5f393f0 | |
parent | e8c0cd081ecd07ad0d30b66426d69a6c60d545b6 (diff) |
store key in m_key; implement get_key
-rw-r--r-- | src/mdaPianoVoice.cpp | 4 | ||||
-rw-r--r-- | src/mdaPianoVoice.h | 3 |
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 |