From 2e84cd3e0ce3b888d4dd9b87a85011af26e29767 Mon Sep 17 00:00:00 2001 From: Dominic Clark Date: Sun, 8 Sep 2019 13:43:15 +0100 Subject: [PATCH] Fix stuck keys when dragging on piano view (#5127) * Fix stuck keys when dragging on piano view * Add comment Co-Authored-By: Shmuel H. --- src/core/NotePlayHandle.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/NotePlayHandle.cpp b/src/core/NotePlayHandle.cpp index 1e6ce01c9..d62857350 100644 --- a/src/core/NotePlayHandle.cpp +++ b/src/core/NotePlayHandle.cpp @@ -199,7 +199,12 @@ void NotePlayHandle::play( sampleFrame * _working_buffer ) lock(); - if( m_totalFramesPlayed == 0 && !m_hasMidiNote + /* It is possible for NotePlayHandle::noteOff to be called before NotePlayHandle::play, + * which results in a note-on message being sent without a subsequent note-off message. + * Therefore, we check here whether the note has already been released before sending + * the note-on message. */ + if( !m_released + && m_totalFramesPlayed == 0 && !m_hasMidiNote && ( hasParent() || ! m_instrumentTrack->isArpeggioEnabled() ) ) { m_hasMidiNote = true;