mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-06 04:00:08 +00:00
Added method MidiMessage::isMidiNoteBlack()
This commit is contained in:
parent
e22e536626
commit
c67c180b07
3 changed files with 9 additions and 9 deletions
|
|
@ -211,19 +211,11 @@ void MidiKeyboardComponent::getKeyPosition (int midiNoteNumber, const float keyW
|
|||
5.0f, 6 - blackNoteWidth * 0.3f,
|
||||
6.0f };
|
||||
|
||||
static const float widths[] = { 1.0f, blackNoteWidth,
|
||||
1.0f, blackNoteWidth,
|
||||
1.0f,
|
||||
1.0f, blackNoteWidth,
|
||||
1.0f, blackNoteWidth,
|
||||
1.0f, blackNoteWidth,
|
||||
1.0f };
|
||||
|
||||
const int octave = midiNoteNumber / 12;
|
||||
const int note = midiNoteNumber % 12;
|
||||
|
||||
x = roundToInt (octave * 7.0f * keyWidth_ + notePos [note] * keyWidth_);
|
||||
w = roundToInt (widths [note] * keyWidth_);
|
||||
w = roundToInt (MidiMessage::isMidiNoteBlack (note) ? blackNoteWidth * keyWidth_ : keyWidth_);
|
||||
}
|
||||
|
||||
void MidiKeyboardComponent::getKeyPos (int midiNoteNumber, int& x, int& w) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue