50 MidiMessage (
int byte1,
int byte2,
int byte3,
double timeStamp = 0) noexcept;
59 MidiMessage (
int byte1,
int byte2,
double timeStamp = 0) noexcept;
67 MidiMessage (
int byte1,
double timeStamp = 0) noexcept;
70 template <
typename... Data>
71 MidiMessage (
int byte1,
int byte2,
int byte3, Data... otherBytes) : size (3 + sizeof... (otherBytes))
74 jassert (size > 3 || byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == size);
76 const uint8 data[] = { (uint8) byte1, (uint8) byte2, (uint8) byte3,
static_cast<uint8
> (otherBytes)... };
77 memcpy (allocateSpace (size), data, (
size_t) size);
82 MidiMessage (
const void* data,
int numBytes,
double timeStamp = 0);
105 int& numBytesUsed, uint8 lastStatusByte,
106 double timeStamp = 0,
107 bool sysexHasEmbeddedLength =
true);
137 const uint8* getRawData() const noexcept {
return getData(); }
148 String getDescription()
const;
173 void setTimeStamp (
double newTimestamp) noexcept { timeStamp = newTimestamp; }
183 MidiMessage withTimeStamp (
double newTimestamp)
const;
192 int getChannel() const noexcept;
199 bool isForChannel (
int channelNumber) const noexcept;
205 void setChannel (
int newChannelNumber) noexcept;
210 bool isSysEx() const noexcept;
216 const uint8* getSysExData() const noexcept;
222 int getSysExDataSize() const noexcept;
235 bool isNoteOn (
bool returnTrueForVelocity0 = false) const noexcept;
244 static
MidiMessage noteOn (
int channel,
int noteNumber,
float velocity) noexcept;
253 static
MidiMessage noteOn (
int channel,
int noteNumber, uint8 velocity) noexcept;
262 bool isNoteOff (
bool returnTrueForNoteOnVelocity0 = true) const noexcept;
271 static
MidiMessage noteOff (
int channel,
int noteNumber,
float velocity) noexcept;
280 static
MidiMessage noteOff (
int channel,
int noteNumber, uint8 velocity) noexcept;
288 static
MidiMessage noteOff (
int channel,
int noteNumber) noexcept;
294 bool isNoteOnOrOff() const noexcept;
300 int getNoteNumber() const noexcept;
305 void setNoteNumber (
int newNoteNumber) noexcept;
315 uint8 getVelocity() const noexcept;
324 float getFloatVelocity() const noexcept;
333 void setVelocity (
float newVelocity) noexcept;
342 void multiplyVelocity (
float scaleFactor) noexcept;
346 bool isSustainPedalOn() const noexcept;
348 bool isSustainPedalOff() const noexcept;
351 bool isSostenutoPedalOn() const noexcept;
353 bool isSostenutoPedalOff() const noexcept;
356 bool isSoftPedalOn() const noexcept;
358 bool isSoftPedalOff() const noexcept;
364 bool isProgramChange() const noexcept;
370 int getProgramChangeNumber() const noexcept;
378 static
MidiMessage programChange (
int channel,
int programNumber) noexcept;
384 bool isPitchWheel() const noexcept;
394 int getPitchWheelValue() const noexcept;
402 static
MidiMessage pitchWheel (
int channel,
int position) noexcept;
413 bool isAftertouch() const noexcept;
422 int getAfterTouchValue() const noexcept;
433 int aftertouchAmount) noexcept;
443 bool isChannelPressure() const noexcept;
450 int getChannelPressureValue() const noexcept;
458 static
MidiMessage channelPressureChange (
int channel,
int pressure) noexcept;
465 bool isController() const noexcept;
474 int getControllerNumber() const noexcept;
483 int getControllerValue() const noexcept;
488 bool isControllerOfType (
int controllerType) const noexcept;
503 bool isAllNotesOff() const noexcept;
508 bool isAllSoundOff() const noexcept;
513 bool isResetAllControllers() const noexcept;
519 static
MidiMessage allNotesOff (
int channel) noexcept;
525 static
MidiMessage allSoundOff (
int channel) noexcept;
530 static
MidiMessage allControllersOff (
int channel) noexcept;
541 bool isMetaEvent() const noexcept;
551 int getMetaEventType() const noexcept;
556 const uint8* getMetaEventData() const noexcept;
561 int getMetaEventLength() const noexcept;
565 bool isTrackMetaEvent() const noexcept;
568 bool isEndOfTrackMetaEvent() const noexcept;
578 bool isTrackNameEvent() const noexcept;
583 bool isTextMetaEvent() const noexcept;
588 String getTextFromTextMetaEvent() const;
597 bool isTempoMetaEvent() const noexcept;
605 double getTempoMetaEventTickLength (
short timeFormat) const noexcept;
610 double getTempoSecondsPerQuarterNote() const noexcept;
615 static
MidiMessage tempoMetaEvent (
int microsecondsPerQuarterNote) noexcept;
621 bool isTimeSignatureMetaEvent() const noexcept;
626 void getTimeSignatureInfo (
int& numerator,
int& denominator) const noexcept;
631 static
MidiMessage timeSignatureMetaEvent (
int numerator,
int denominator);
637 bool isKeySignatureMetaEvent() const noexcept;
646 int getKeySignatureNumberOfSharpsOrFlats() const noexcept;
651 bool isKeySignatureMajorKey() const noexcept;
659 static
MidiMessage keySignatureMetaEvent (
int numberOfSharpsOrFlats,
bool isMinorKey);
669 bool isMidiChannelMetaEvent() const noexcept;
676 int getMidiChannelMetaEventChannel() const noexcept;
683 static
MidiMessage midiChannelMetaEvent (
int channel) noexcept;
687 bool isActiveSense() const noexcept;
693 bool isMidiStart() const noexcept;
701 bool isMidiContinue() const noexcept;
709 bool isMidiStop() const noexcept;
717 bool isMidiClock() const noexcept;
725 bool isSongPositionPointer() const noexcept;
730 int getSongPositionPointerMidiBeat() const noexcept;
740 static
MidiMessage songPositionPointer (
int positionInMidiBeats) noexcept;
746 bool isQuarterFrame() const noexcept;
752 int getQuarterFrameSequenceNumber() const noexcept;
757 int getQuarterFrameValue() const noexcept;
764 static
MidiMessage quarterFrame (
int sequenceNumber,
int value) noexcept;
778 bool isFullFrame() const noexcept;
785 void getFullFrameParameters (
int& hours,
789 SmpteTimecodeType& timecodeType) const noexcept;
796 SmpteTimecodeType timecodeType);
807 mmc_deferredplay = 3,
818 bool isMidiMachineControlMessage() const noexcept;
825 MidiMachineControlCommand getMidiMachineControlCommand() const noexcept;
828 static
MidiMessage midiMachineControlCommand (MidiMachineControlCommand command);
834 bool isMidiMachineControlGoto (
int& hours,
837 int& frames) const noexcept;
843 static
MidiMessage midiMachineControlGoto (
int hours,
858 static
MidiMessage createSysExMessage (const
void* sysexData,
868 static
int readVariableLengthVal (const uint8* data,
869 int& numBytesUsed) noexcept;
876 static
int getMessageLengthFromFirstByte (uint8 firstByte) noexcept;
893 static
String getMidiNoteName (
int noteNumber,
895 bool includeOctaveNumber,
896 int octaveNumForMiddleC);
903 static
double getMidiNoteInHertz (
int noteNumber,
double frequencyOfA = 440.0) noexcept;
906 static
bool isMidiNoteBlack (
int noteNumber) noexcept;
913 static const
char* getGMInstrumentName (
int midiInstrumentNumber);
918 static const
char* getGMInstrumentBankName (
int midiBankNumber);
923 static const
char* getRhythmInstrumentName (
int midiNoteNumber);
928 static const
char* getControllerName (
int controllerNumber);
931 static uint8 floatValueToMidiByte (
float valueBetween0and1) noexcept;
934 static uint16 pitchbendToPitchwheelPos (
float pitchbendInSemitones,
935 float pitchbendRangeInSemitones) noexcept;
942 uint8* allocatedData;
943 uint8 asBytes[
sizeof (uint8*)];
946 PackedData packedData;
947 double timeStamp = 0;
951 inline bool isHeapAllocated() const noexcept {
return size > (int)
sizeof (packedData); }
952 inline uint8* getData() const noexcept {
return isHeapAllocated() ? packedData.allocatedData : (uint8*) packedData.asBytes; }
953 uint8* allocateSpace (
int);