mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added method MidiMessage::keySignatureMetaEvent
This commit is contained in:
parent
329127ad87
commit
354b5d38ae
2 changed files with 18 additions and 5 deletions
|
|
@ -777,22 +777,19 @@ MidiMessage MidiMessage::timeSignatureMetaEvent (const int numerator, const int
|
|||
++powerOfTwo;
|
||||
}
|
||||
|
||||
const uint8 d[] = { 0xff, 0x58, 0x04, (uint8) numerator,
|
||||
(uint8) powerOfTwo, 1, 96 };
|
||||
|
||||
const uint8 d[] = { 0xff, 0x58, 0x04, (uint8) numerator, (uint8) powerOfTwo, 1, 96 };
|
||||
return MidiMessage (d, 7, 0.0);
|
||||
}
|
||||
|
||||
MidiMessage MidiMessage::midiChannelMetaEvent (const int channel) noexcept
|
||||
{
|
||||
const uint8 d[] = { 0xff, 0x20, 0x01, (uint8) jlimit (0, 0xff, channel - 1) };
|
||||
|
||||
return MidiMessage (d, 4, 0.0);
|
||||
}
|
||||
|
||||
bool MidiMessage::isKeySignatureMetaEvent() const noexcept
|
||||
{
|
||||
return getMetaEventType() == 89;
|
||||
return getMetaEventType() == 0x59;
|
||||
}
|
||||
|
||||
int MidiMessage::getKeySignatureNumberOfSharpsOrFlats() const noexcept
|
||||
|
|
@ -805,6 +802,14 @@ bool MidiMessage::isKeySignatureMajorKey() const noexcept
|
|||
return getMetaEventData()[1] == 0;
|
||||
}
|
||||
|
||||
MidiMessage MidiMessage::keySignatureMetaEvent (int numberOfSharpsOrFlats, bool isMinorKey)
|
||||
{
|
||||
jassert (numberOfSharpsOrFlats >= -7 && numberOfSharpsOrFlats <= 7);
|
||||
|
||||
const uint8 d[] = { 0xff, 0x59, 0x02, (uint8) numberOfSharpsOrFlats, isMinorKey ? (uint8) 1 : (uint8) 0 };
|
||||
return MidiMessage (d, 5, 0.0);
|
||||
}
|
||||
|
||||
MidiMessage MidiMessage::endOfTrack() noexcept
|
||||
{
|
||||
return MidiMessage (0xff, 0x2f, 0, 0.0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue