diff --git a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp index db77d0f610..7c3dc57805 100644 --- a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp @@ -696,7 +696,7 @@ void MidiKeyboardComponent::updateNoteUnderMouse (Point pos, bool isDown, i mouseOverNotes.set (fingerNum, newNote); } - int oldNoteDown = mouseDownNotes.getUnchecked (fingerNum); + const int oldNoteDown = mouseDownNotes.getUnchecked (fingerNum); if (isDown) { @@ -710,7 +710,7 @@ void MidiKeyboardComponent::updateNoteUnderMouse (Point pos, bool isDown, i state.noteOff (midiChannel, oldNoteDown); } - if (newNote >= 0) + if (newNote >= 0 && ! mouseDownNotes.contains (newNote)) { if (! useMousePositionForVelocity) mousePositionVelocity = 1.0f;