1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added methods to SynthesiserVoice for checking key-down status.

This commit is contained in:
jules 2013-12-10 09:43:41 +00:00
parent 66fb2e61a5
commit 403b5c10bc

View file

@ -116,7 +116,6 @@ public:
virtual bool canPlaySound (SynthesiserSound*) = 0;
/** Called to start a new note.
This will be called during the rendering callback, so must be fast and thread-safe.
*/
virtual void startNote (int midiNoteNumber,
@ -186,6 +185,14 @@ public:
*/
void setCurrentPlaybackSampleRate (double newRate);
/** Returns true if the key that triggered this voice is still held down.
Note that the voice may still be playing after the key was released (e.g because the
sostenuto pedal is down).
*/
bool isKeyDown() const noexcept { return keyIsDown; }
/** Returns true if the sostenuto pedal is currently active for this voice. */
bool isSostenutoPedalDown() const noexcept { return sostenutoPedalDown; }
protected:
//==============================================================================
@ -218,8 +225,7 @@ private:
int currentlyPlayingNote;
uint32 noteOnTime;
SynthesiserSound::Ptr currentlyPlayingSound;
bool keyIsDown; // the voice may still be playing when the key is not down (i.e. sustain pedal)
bool sostenutoPedalDown;
bool keyIsDown, sostenutoPedalDown;
JUCE_LEAK_DETECTOR (SynthesiserVoice)
};