do not render voice if no key has been pressed
authorrekado <rekado@elephly.net>
Wed, 16 Jan 2013 11:40:43 +0000 (19:40 +0800)
committerrekado <rekado@elephly.net>
Wed, 16 Jan 2013 11:40:43 +0000 (19:40 +0800)
src/mdaPianoVoice.cpp

index 322b534..b48c0a8 100644 (file)
@@ -139,6 +139,11 @@ void mdaPianoVoice::release(unsigned char velocity)
 
 void mdaPianoVoice::render(uint32_t from, uint32_t to)
 {
+  // abort if no key is pressed
+  // initially m_key is INVALID_KEY, so no sound will be rendered
+  if (m_key == LV2::INVALID_KEY)
+    return;
+
   float x, l, r;
   uint32_t i;