46 MidiMessage (
int byte1,
int byte2,
int byte3,
double timeStamp = 0)
noexcept;
55 MidiMessage (
int byte1,
int byte2,
double timeStamp = 0)
noexcept;
63 MidiMessage (
int byte1,
double timeStamp = 0)
noexcept;
66 template <
typename... Data>
67 MidiMessage (
int byte1,
int byte2,
int byte3, Data... otherBytes) : size (3 + sizeof... (otherBytes))
72 const uint8 data[] = { (uint8) byte1, (uint8) byte2, (uint8) byte3,
static_cast<uint8
> (otherBytes)... };
73 memcpy (allocateSpace (size), data, (
size_t) size);
78 MidiMessage (
const void* data,
int numBytes,
double timeStamp = 0);
101 int& numBytesUsed, uint8 lastStatusByte,
102 double timeStamp = 0,
103 bool sysexHasEmbeddedLength =
true);
134 const uint8*
getRawData() const noexcept {
return getData(); }
145 String getDescription()
const;
170 void setTimeStamp (
double newTimestamp)
noexcept { timeStamp = newTimestamp; }
180 MidiMessage withTimeStamp (
double newTimestamp)
const;
189 int getChannel() const noexcept;
196 bool isForChannel (
int channelNumber) const noexcept;
202 void setChannel (
int newChannelNumber) noexcept;
207 bool isSysEx() const noexcept;
213 const uint8* getSysExData() const noexcept;
219 int getSysExDataSize() const noexcept;
224 return {
reinterpret_cast<const std::byte*
> (
getSysExData()),
239 bool isNoteOn (
bool returnTrueForVelocity0 =
false) const noexcept;
248 static
MidiMessage noteOn (
int channel,
int noteNumber,
float velocity) noexcept;
257 static
MidiMessage noteOn (
int channel,
int noteNumber, uint8 velocity) noexcept;
266 bool isNoteOff (
bool returnTrueForNoteOnVelocity0 = true) const noexcept;
275 static
MidiMessage noteOff (
int channel,
int noteNumber,
float velocity) noexcept;
284 static
MidiMessage noteOff (
int channel,
int noteNumber, uint8 velocity) noexcept;
292 static
MidiMessage noteOff (
int channel,
int noteNumber) noexcept;
298 bool isNoteOnOrOff() const noexcept;
304 int getNoteNumber() const noexcept;
309 void setNoteNumber (
int newNoteNumber) noexcept;
319 uint8 getVelocity() const noexcept;
328 float getFloatVelocity() const noexcept;
337 void setVelocity (
float newVelocity) noexcept;
346 void multiplyVelocity (
float scaleFactor) noexcept;
350 bool isSustainPedalOn() const noexcept;
352 bool isSustainPedalOff() const noexcept;
355 bool isSostenutoPedalOn() const noexcept;
357 bool isSostenutoPedalOff() const noexcept;
360 bool isSoftPedalOn() const noexcept;
362 bool isSoftPedalOff() const noexcept;
368 bool isProgramChange() const noexcept;
374 int getProgramChangeNumber() const noexcept;
382 static
MidiMessage programChange (
int channel,
int programNumber) noexcept;
388 bool isPitchWheel() const noexcept;
398 int getPitchWheelValue() const noexcept;
406 static
MidiMessage pitchWheel (
int channel,
int position) noexcept;
417 bool isAftertouch() const noexcept;
426 int getAfterTouchValue() const noexcept;
437 int aftertouchAmount) noexcept;
447 bool isChannelPressure() const noexcept;
454 int getChannelPressureValue() const noexcept;
462 static
MidiMessage channelPressureChange (
int channel,
int pressure) noexcept;
469 bool isController() const noexcept;
478 int getControllerNumber() const noexcept;
487 int getControllerValue() const noexcept;
492 bool isControllerOfType (
int controllerType) const noexcept;
507 bool isAllNotesOff() const noexcept;
512 bool isAllSoundOff() const noexcept;
517 bool isResetAllControllers() const noexcept;
523 static
MidiMessage allNotesOff (
int channel) noexcept;
529 static
MidiMessage allSoundOff (
int channel) noexcept;
534 static
MidiMessage allControllersOff (
int channel) noexcept;
545 bool isMetaEvent() const noexcept;
555 int getMetaEventType() const noexcept;
560 const uint8* getMetaEventData() const noexcept;
565 int getMetaEventLength() const noexcept;
569 bool isTrackMetaEvent() const noexcept;
572 bool isEndOfTrackMetaEvent() const noexcept;
582 bool isTrackNameEvent() const noexcept;
587 bool isTextMetaEvent() const noexcept;
592 String getTextFromTextMetaEvent() const;
601 bool isTempoMetaEvent() const noexcept;
609 double getTempoMetaEventTickLength (
short timeFormat) const noexcept;
614 double getTempoSecondsPerQuarterNote() const noexcept;
619 static
MidiMessage tempoMetaEvent (
int microsecondsPerQuarterNote) noexcept;
625 bool isTimeSignatureMetaEvent() const noexcept;
630 void getTimeSignatureInfo (
int& numerator,
int& denominator) const noexcept;
635 static
MidiMessage timeSignatureMetaEvent (
int numerator,
int denominator);
641 bool isKeySignatureMetaEvent() const noexcept;
650 int getKeySignatureNumberOfSharpsOrFlats() const noexcept;
655 bool isKeySignatureMajorKey() const noexcept;
663 static
MidiMessage keySignatureMetaEvent (
int numberOfSharpsOrFlats,
bool isMinorKey);
673 bool isMidiChannelMetaEvent() const noexcept;
680 int getMidiChannelMetaEventChannel() const noexcept;
687 static
MidiMessage midiChannelMetaEvent (
int channel) noexcept;
691 bool isActiveSense() const noexcept;
697 bool isMidiStart() const noexcept;
705 bool isMidiContinue() const noexcept;
713 bool isMidiStop() const noexcept;
721 bool isMidiClock() const noexcept;
729 bool isSongPositionPointer() const noexcept;
734 int getSongPositionPointerMidiBeat() const noexcept;
744 static
MidiMessage songPositionPointer (
int positionInMidiBeats) noexcept;
750 bool isQuarterFrame() const noexcept;
756 int getQuarterFrameSequenceNumber() const noexcept;
761 int getQuarterFrameValue() const noexcept;
768 static
MidiMessage quarterFrame (
int sequenceNumber,
int value) noexcept;
782 bool isFullFrame() const noexcept;
789 void getFullFrameParameters (
int& hours,
793 SmpteTimecodeType& timecodeType) const noexcept;
800 SmpteTimecodeType timecodeType);
811 mmc_deferredplay = 3,
822 bool isMidiMachineControlMessage() const noexcept;
829 MidiMachineControlCommand getMidiMachineControlCommand() const noexcept;
832 static
MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
838 bool isMidiMachineControlGoto (
int& hours,
841 int& frames) const noexcept;
847 static
MidiMessage midiMachineControlGoto (
int hours,
862 static
MidiMessage createSysExMessage (const
void* sysexData,
878 [[deprecated (
"This signature has been deprecated in favour of the safer readVariableLengthValue.")]]
879 static int readVariableLengthVal (
const uint8* data,
int& numBytesUsed)
noexcept;
887 struct VariableLengthValue
889 VariableLengthValue() =
default;
891 VariableLengthValue (
int valueIn,
int bytesUsedIn)
892 : value (valueIn), bytesUsed (bytesUsedIn) {}
894 bool isValid()
const noexcept {
return bytesUsed > 0; }
910 int maxBytesToUse)
noexcept;
936 bool includeOctaveNumber,
937 int octaveNumForMiddleC);
944 static double getMidiNoteInHertz (
int noteNumber,
double frequencyOfA = 440.0) noexcept;
976 float pitchbendRangeInSemitones) noexcept;
983 uint8* allocatedData;
984 uint8 asBytes[
sizeof (uint8*)];
987 PackedData packedData;
988 double timeStamp = 0;
992 inline bool isHeapAllocated() const noexcept {
return size > (int)
sizeof (packedData); }
993 inline uint8* getData() const noexcept {
return isHeapAllocated() ? packedData.allocatedData : (uint8*) packedData.asBytes; }
994 uint8* allocateSpace (
int);