Browse Source

MidiKeyboadComponent: Fixed an assertion when translating the mouse position to a note velocity

tags/2021-05-28
hogliux 7 years ago
parent
commit
0f7c867534
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp

+ 2
- 2
modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp View File

@@ -307,7 +307,7 @@ int MidiKeyboardComponent::remappedXYToNote (Point<float> pos, float& mousePosit
{
if (getKeyPos (note).contains (pos.x - xOffset))
{
mousePositionVelocity = pos.y / blackNoteLength;
mousePositionVelocity = jmax (0.0f, pos.y / blackNoteLength);
return note;
}
}
@@ -326,7 +326,7 @@ int MidiKeyboardComponent::remappedXYToNote (Point<float> pos, float& mousePosit
if (getKeyPos (note).contains (pos.x - xOffset))
{
auto whiteNoteLength = (orientation == horizontalKeyboard) ? getHeight() : getWidth();
mousePositionVelocity = pos.y / (float) whiteNoteLength;
mousePositionVelocity = jmax (0.0f, pos.y / (float) whiteNoteLength);
return note;
}
}


Loading…
Cancel
Save