OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
juce::MidiMessage Class Reference

`#include <juce_MidiMessage.h>`

## Classes
struct | VariableLengthValue

## Public Types
enum | SmpteTimecodeType { fps24 = 0 , fps25 = 1 , fps30drop = 2 , fps30 = 3 }
enum | MidiMachineControlCommand { mmc_stop = 1 , mmc_play = 2 , mmc_deferredplay = 3 , mmc_fastforward = 4 , mmc_rewind = 5 , mmc_recordStart = 6 , mmc_recordStop = 7 , mmc_pause = 9 }

## Public Member Functions
| MidiMessage (int byte1, int byte2, int byte3, double timeStamp=0) noexcept
| MidiMessage (int byte1, int byte2, double timeStamp=0) noexcept
| MidiMessage (int byte1, double timeStamp=0) noexcept
template<typename... Data>
| MidiMessage (int byte1, int byte2, int byte3, Data... otherBytes)
| MidiMessage (const void *data, int numBytes, double timeStamp=0)
| MidiMessage (const void *data, int maxBytesToUse, int &numBytesUsed, uint8 lastStatusByte, double timeStamp=0, bool sysexHasEmbeddedLength=true)
| MidiMessage () noexcept
| MidiMessage (const MidiMessage &)
| MidiMessage (const MidiMessage &, double newTimeStamp)
| ~MidiMessage () noexcept
MidiMessage & | operator= (const MidiMessage &other)
| MidiMessage (MidiMessage &&) noexcept
MidiMessage & | operator= (MidiMessage &&) noexcept
const uint8 * | getRawData () const noexcept
int | getRawDataSize () const noexcept
String | getDescription () const
double | getTimeStamp () const noexcept
void | setTimeStamp (double newTimestamp) noexcept
void | addToTimeStamp (double delta) noexcept
MidiMessage | withTimeStamp (double newTimestamp) const
int | getChannel () const noexcept
bool | isForChannel (int channelNumber) const noexcept
void | setChannel (int newChannelNumber) noexcept
bool | isSysEx () const noexcept
const uint8 * | getSysExData () const noexcept
int | getSysExDataSize () const noexcept
Span< const std::byte > | getSysExDataSpan () const noexcept
bool | isNoteOn (bool returnTrueForVelocity0=false) const noexcept
bool | isNoteOff (bool returnTrueForNoteOnVelocity0=true) const noexcept
bool | isNoteOnOrOff () const noexcept
int | getNoteNumber () const noexcept
void | setNoteNumber (int newNoteNumber) noexcept
uint8 | getVelocity () const noexcept
float | getFloatVelocity () const noexcept
void | setVelocity (float newVelocity) noexcept
void | multiplyVelocity (float scaleFactor) noexcept
bool | isSustainPedalOn () const noexcept
bool | isSustainPedalOff () const noexcept
bool | isSostenutoPedalOn () const noexcept
bool | isSostenutoPedalOff () const noexcept
bool | isSoftPedalOn () const noexcept
bool | isSoftPedalOff () const noexcept
bool | isProgramChange () const noexcept
int | getProgramChangeNumber () const noexcept
bool | isPitchWheel () const noexcept
int | getPitchWheelValue () const noexcept
bool | isAftertouch () const noexcept
int | getAfterTouchValue () const noexcept
bool | isChannelPressure () const noexcept
int | getChannelPressureValue () const noexcept
bool | isController () const noexcept
int | getControllerNumber () const noexcept
int | getControllerValue () const noexcept
bool | isControllerOfType (int controllerType) const noexcept
bool | isAllNotesOff () const noexcept
bool | isAllSoundOff () const noexcept
bool | isResetAllControllers () const noexcept
bool | isMetaEvent () const noexcept
int | getMetaEventType () const noexcept
const uint8 * | getMetaEventData () const noexcept
int | getMetaEventLength () const noexcept
bool | isTrackMetaEvent () const noexcept
bool | isEndOfTrackMetaEvent () const noexcept
bool | isTrackNameEvent () const noexcept
bool | isTextMetaEvent () const noexcept
String | getTextFromTextMetaEvent () const
bool | isTempoMetaEvent () const noexcept
double | getTempoMetaEventTickLength (short timeFormat) const noexcept
double | getTempoSecondsPerQuarterNote () const noexcept
bool | isTimeSignatureMetaEvent () const noexcept
void | getTimeSignatureInfo (int &numerator, int &denominator) const noexcept
bool | isKeySignatureMetaEvent () const noexcept
int | getKeySignatureNumberOfSharpsOrFlats () const noexcept
bool | isKeySignatureMajorKey () const noexcept
bool | isMidiChannelMetaEvent () const noexcept
int | getMidiChannelMetaEventChannel () const noexcept
bool | isActiveSense () const noexcept
bool | isMidiStart () const noexcept
bool | isMidiContinue () const noexcept
bool | isMidiStop () const noexcept
bool | isMidiClock () const noexcept
bool | isSongPositionPointer () const noexcept
int | getSongPositionPointerMidiBeat () const noexcept
bool | isQuarterFrame () const noexcept
int | getQuarterFrameSequenceNumber () const noexcept
int | getQuarterFrameValue () const noexcept
bool | isFullFrame () const noexcept
void | getFullFrameParameters (int &hours, int &minutes, int &seconds, int &frames, SmpteTimecodeType &timecodeType) const noexcept
bool | isMidiMachineControlMessage () const noexcept
MidiMachineControlCommand | getMidiMachineControlCommand () const noexcept
bool | isMidiMachineControlGoto (int &hours, int &minutes, int &seconds, int &frames) const noexcept

## Static Public Member Functions
static MidiMessage | noteOn (int channel, int noteNumber, float velocity) noexcept
static MidiMessage | noteOn (int channel, int noteNumber, uint8 velocity) noexcept
static MidiMessage | noteOff (int channel, int noteNumber, float velocity) noexcept
static MidiMessage | noteOff (int channel, int noteNumber, uint8 velocity) noexcept
static MidiMessage | noteOff (int channel, int noteNumber) noexcept
static MidiMessage | programChange (int channel, int programNumber) noexcept
static MidiMessage | pitchWheel (int channel, int position) noexcept
static MidiMessage | aftertouchChange (int channel, int noteNumber, int aftertouchAmount) noexcept
static MidiMessage | channelPressureChange (int channel, int pressure) noexcept
static MidiMessage | controllerEvent (int channel, int controllerType, int value) noexcept
static MidiMessage | allNotesOff (int channel) noexcept
static MidiMessage | allSoundOff (int channel) noexcept
static MidiMessage | allControllersOff (int channel) noexcept
static MidiMessage | endOfTrack () noexcept
static MidiMessage | textMetaEvent (int type, StringRef text)
static MidiMessage | tempoMetaEvent (int microsecondsPerQuarterNote) noexcept
static MidiMessage | timeSignatureMetaEvent (int numerator, int denominator)
static MidiMessage | keySignatureMetaEvent (int numberOfSharpsOrFlats, bool isMinorKey)
static MidiMessage | midiChannelMetaEvent (int channel) noexcept
static MidiMessage | midiStart () noexcept
static MidiMessage | midiContinue () noexcept
static MidiMessage | midiStop () noexcept
static MidiMessage | midiClock () noexcept
static MidiMessage | songPositionPointer (int positionInMidiBeats) noexcept
static MidiMessage | quarterFrame (int sequenceNumber, int value) noexcept
static MidiMessage | fullFrame (int hours, int minutes, int seconds, int frames, SmpteTimecodeType timecodeType)
static MidiMessage | midiMachineControlCommand (MidiMachineControlCommand command)
static MidiMessage | midiMachineControlGoto (int hours, int minutes, int seconds, int frames)
static MidiMessage | masterVolume (float volume)
static MidiMessage | createSysExMessage (const void *sysexData, int dataSize)
static MidiMessage | createSysExMessage (Span< const std::byte > data)
static int | readVariableLengthVal (const uint8 *data, int &numBytesUsed) noexcept
static VariableLengthValue | readVariableLengthValue (const uint8 *data, int maxBytesToUse) noexcept
static int | getMessageLengthFromFirstByte (uint8 firstByte) noexcept
static String | getMidiNoteName (int noteNumber, bool useSharps, bool includeOctaveNumber, int octaveNumForMiddleC)
static double | getMidiNoteInHertz (int noteNumber, double frequencyOfA=440.0) noexcept
static bool | isMidiNoteBlack (int noteNumber) noexcept
static const char * | getGMInstrumentName (int midiInstrumentNumber)
static const char * | getGMInstrumentBankName (int midiBankNumber)
static const char * | getRhythmInstrumentName (int midiNoteNumber)
static const char * | getControllerName (int controllerNumber)
static uint8 | floatValueToMidiByte (float valueBetween0and1) noexcept
static uint16 | pitchbendToPitchwheelPos (float pitchbendInSemitones, float pitchbendRangeInSemitones) noexcept

## Detailed Description

Encapsulates a MIDI message.

See also
  MidiMessageSequence, MidiOutput, MidiInput

Definition at line 34 of file juce_MidiMessage.h.

## Member Enumeration Documentation

## ◆ MidiMachineControlCommand

enum juce::MidiMessage::MidiMachineControlCommand

Types of MMC command.

See also
  isMidiMachineControlMessage, getMidiMachineControlCommand, midiMachineControlCommand

Definition at line 807 of file juce_MidiMessage.h.

## ◆ SmpteTimecodeType

enum juce::MidiMessage::SmpteTimecodeType

SMPTE timecode types. Used by the getFullFrameParameters() and fullFrame() methods.

Definition at line 773 of file juce_MidiMessage.h.

## Constructor & Destructor Documentation

## ◆ MidiMessage() [1/10]

juce::MidiMessage::MidiMessage | ( | int | byte1,
|  | int | byte2,
|  | int | byte3,
|  | double | timeStamp = 0 )
| noexcept

Creates a 3-byte short midi message.

Parameters

  byte1 | message byte 1
  byte2 | message byte 2
  byte3 | message byte 3
  timeStamp | the time to give the midi message - this value doesn't use any particular units, so will be application-specific

Definition at line 161 of file juce_MidiMessage.cpp.

## ◆ MidiMessage() [2/10]

juce::MidiMessage::MidiMessage | ( | int | byte1,
|  | int | byte2,
|  | double | timeStamp = 0 )
| noexcept

Creates a 2-byte short midi message.

Parameters

  byte1 | message byte 1
  byte2 | message byte 2
  timeStamp | the time to give the midi message - this value doesn't use any particular units, so will be application-specific

Definition at line 151 of file juce_MidiMessage.cpp.

## ◆ MidiMessage() [3/10]

juce::MidiMessage::MidiMessage | ( | int | byte1,
|  | double | timeStamp = 0 )
| noexcept

Creates a 1-byte short midi message.

Parameters

  byte1 | message byte 1
  timeStamp | the time to give the midi message - this value doesn't use any particular units, so will be application-specific

Definition at line 142 of file juce_MidiMessage.cpp.

## ◆ MidiMessage() [4/10]

template<typename... Data>

juce::MidiMessage::MidiMessage | ( | int | byte1,
|  | int | byte2,
|  | int | byte3,
|  | Data... | otherBytes )
| inline

Creates a midi message from a list of bytes.

Definition at line 67 of file juce_MidiMessage.h.

## ◆ MidiMessage() [5/10]

juce::MidiMessage::MidiMessage | ( | const void * | data,
|  | int | numBytes,
|  | double | timeStamp = 0 )

Creates a midi message from a block of data.

Definition at line 132 of file juce_MidiMessage.cpp.

## ◆ MidiMessage() [6/10]

juce::MidiMessage::MidiMessage | ( | const void * | data,
|  | int | maxBytesToUse,
|  | int & | numBytesUsed,
|  | uint8 | lastStatusByte,
|  | double | timeStamp = 0,
|  | bool | sysexHasEmbeddedLength = true )

Reads the next midi message from some data.

This will read as many bytes from a data stream as it needs to make a complete message, and will return the number of bytes it used. This lets you read a sequence of midi messages from a file or stream.

Parameters

  data | the data to read from
  maxBytesToUse | the maximum number of bytes it's allowed to read
  numBytesUsed | returns the number of bytes that were actually needed
  lastStatusByte | in a sequence of midi messages, the initial byte can be dropped from a message if it's the same as the first byte of the previous message, so this lets you supply the byte to use if the first byte of the message has in fact been dropped.
  timeStamp | the time to give the midi message - this value doesn't use any particular units, so will be application-specific
  sysexHasEmbeddedLength | when reading sysexes, this flag indicates whether to expect the data to begin with a variable-length field indicating its size

Definition at line 190 of file juce_MidiMessage.cpp.

## ◆ MidiMessage() [7/10]

juce::MidiMessage::MidiMessage | ( |  | ) |
| noexcept

Creates an empty sysex message.

Since the MidiMessage has to contain a valid message, this default constructor just initialises it with an empty sysex message.

Definition at line 125 of file juce_MidiMessage.cpp.

Referenced by createSysExMessage(), midiClock(), midiContinue(), midiStart(), and midiStop().

## ◆ MidiMessage() [8/10]

juce::MidiMessage::MidiMessage | ( | const MidiMessage & | other | ) |

Creates a copy of another midi message.

Definition at line 172 of file juce_MidiMessage.cpp.

## ◆ MidiMessage() [9/10]

juce::MidiMessage::MidiMessage | ( | const MidiMessage & | other,
|  | double | newTimeStamp )

Creates a copy of another midi message, with a different timestamp.

Definition at line 181 of file juce_MidiMessage.cpp.

## ◆ ~MidiMessage()

juce::MidiMessage::~MidiMessage | ( |  | ) |
| noexcept

Destructor.

Definition at line 331 of file juce_MidiMessage.cpp.

## ◆ MidiMessage() [10/10]

juce::MidiMessage::MidiMessage | ( | MidiMessage && | other | ) |
| noexcept

Move constructor

Definition at line 315 of file juce_MidiMessage.cpp.

## Member Function Documentation

## ◆ addToTimeStamp()

void juce::MidiMessage::addToTimeStamp | ( | double | delta | ) |
| inline noexcept

Adds a value to the message's timestamp. The units for the timestamp will be application-specific.

Definition at line 175 of file juce_MidiMessage.h.

## ◆ aftertouchChange()

MidiMessage juce::MidiMessage::aftertouchChange | ( | int | channel,
|  | int | noteNumber,
|  | int | aftertouchAmount )
| static noexcept

Creates an aftertouch message.

Parameters

  channel | the midi channel, in the range 1 to 16
  noteNumber | the key number, 0 to 127
  aftertouchAmount | the amount of aftertouch, 0 to 127

See also
  isAftertouch

Definition at line 482 of file juce_MidiMessage.cpp.

## ◆ allControllersOff()

MidiMessage juce::MidiMessage::allControllersOff | ( | int | channel | ) |
| static noexcept

Creates an all-controllers-off message.

Parameters

  channel | the midi channel, in the range 1 to 16

Definition at line 659 of file juce_MidiMessage.cpp.

## ◆ allNotesOff()

MidiMessage juce::MidiMessage::allNotesOff | ( | int | channel | ) |
| static noexcept

Creates an all-notes-off message.

Parameters

  channel | the midi channel, in the range 1 to 16

See also
  isAllNotesOff

Definition at line 631 of file juce_MidiMessage.cpp.

## ◆ allSoundOff()

MidiMessage juce::MidiMessage::allSoundOff | ( | int | channel | ) |
| static noexcept

Creates an all-sound-off message.

Parameters

  channel | the midi channel, in the range 1 to 16

See also
  isAllSoundOff

Definition at line 642 of file juce_MidiMessage.cpp.

## ◆ channelPressureChange()

MidiMessage juce::MidiMessage::channelPressureChange | ( | int | channel,
|  | int | pressure )
| static noexcept

Creates a channel-pressure change event.

Parameters

  channel | the midi channel: 1 to 16
  pressure | the pressure, 0 to 127

See also
  isChannelPressure

Definition at line 506 of file juce_MidiMessage.cpp.

## ◆ controllerEvent()

MidiMessage juce::MidiMessage::controllerEvent | ( | int | channel,
|  | int | controllerType,
|  | int | value )
| static noexcept

Creates a controller message.

Parameters

  channel | the midi channel, in the range 1 to 16
  controllerType | the type of controller
  value | the controller value

See also
  isController

Definition at line 586 of file juce_MidiMessage.cpp.

## ◆ createSysExMessage() [1/2]

MidiMessage juce::MidiMessage::createSysExMessage | ( | const void * | sysexData,
|  | int | dataSize )
| static

Creates a system-exclusive message. The data passed in is wrapped with header and tail bytes of 0xf0 and 0xf7.

Definition at line 677 of file juce_MidiMessage.cpp.

Referenced by createSysExMessage().

## ◆ createSysExMessage() [2/2]

MidiMessage juce::MidiMessage::createSysExMessage | ( | Span< const std::byte > | data | ) |
| static

Creates a system-exclusive message. The data passed in is wrapped with header and tail bytes of 0xf0 and 0xf7.

Definition at line 688 of file juce_MidiMessage.cpp.

## ◆ endOfTrack()

MidiMessage juce::MidiMessage::endOfTrack | ( |  | ) |
| static noexcept

Creates an end-of-track meta-event.

See also
  isEndOfTrackMetaEvent

Definition at line 901 of file juce_MidiMessage.cpp.

## ◆ floatValueToMidiByte()

uint8 juce::MidiMessage::floatValueToMidiByte | ( | float | valueBetween0and1 | ) |
| static noexcept

Converts a floating-point value between 0 and 1 to a MIDI 7-bit value between 0 and 127.

Definition at line 40 of file juce_MidiMessage.cpp.

## ◆ fullFrame()

MidiMessage juce::MidiMessage::fullFrame | ( | int | hours,
|  | int | minutes,
|  | int | seconds,
|  | int | frames,
|  | MidiMessage::SmpteTimecodeType | timecodeType )
| static

Creates a full-frame MTC message.

Definition at line 962 of file juce_MidiMessage.cpp.

## ◆ getAfterTouchValue()

int juce::MidiMessage::getAfterTouchValue | ( |  | ) | const
| noexcept

Returns the amount of aftertouch from an aftertouch messages.

The value returned is in the range 0 to 127, and will be nonsense for messages other than aftertouch messages.

See also
  isAftertouch

Definition at line 476 of file juce_MidiMessage.cpp.

Referenced by getDescription(), and juce::Synthesiser::handleMidiEvent().

## ◆ getChannel()

int juce::MidiMessage::getChannel | ( |  | ) | const
| noexcept

Returns the midi channel associated with the message.

Returns
  a value 1 to 16 if the message has a channel, or 0 if it hasn't (e.g. if it's a sysex)

See also
  isForChannel, setChannel

Definition at line 379 of file juce_MidiMessage.cpp.

Referenced by getDescription(), juce::MPESynthesiser::handleMidiEvent(), juce::Synthesiser::handleMidiEvent(), juce::MidiKeyboardState::processNextMidiEvent(), and juce::MPEZoneLayout::processNextMidiEvent().

## ◆ getChannelPressureValue()

int juce::MidiMessage::getChannelPressureValue | ( |  | ) | const
| noexcept

Returns the pressure from a channel pressure change message.

Returns
  the pressure, in the range 0 to 127

See also
  isChannelPressure, channelPressureChange

Definition at line 500 of file juce_MidiMessage.cpp.

Referenced by getDescription(), and juce::Synthesiser::handleMidiEvent().

## ◆ getControllerName()

const char * juce::MidiMessage::getControllerName | ( | int | controllerNumber | ) |
| static

Returns the name of a controller type number, or nullptr if unknown for this controller number.

See also
  getControllerNumber

Definition at line 1127 of file juce_MidiMessage.cpp.

Referenced by getDescription().

## ◆ getControllerNumber()

int juce::MidiMessage::getControllerNumber | ( |  | ) | const
| noexcept

Returns the controller number of a controller message.

The name of the controller can be looked up using the getControllerName() method. Note that the value returned is invalid for messages that aren't controller changes.

See also
  isController, getControllerName, getControllerValue

Definition at line 574 of file juce_MidiMessage.cpp.

Referenced by getDescription(), juce::MPESynthesiser::handleMidiEvent(), juce::Synthesiser::handleMidiEvent(), and juce::MPEZoneLayout::processNextMidiEvent().

## ◆ getControllerValue()

int juce::MidiMessage::getControllerValue | ( |  | ) | const
| noexcept

Returns the controller value from a controller message.

A value 0 to 127 is returned to indicate the new controller position. Note that the value returned is invalid for messages that aren't controller changes.

See also
  isController, getControllerNumber

Definition at line 580 of file juce_MidiMessage.cpp.

Referenced by getDescription(), juce::MPESynthesiser::handleMidiEvent(), juce::Synthesiser::handleMidiEvent(), and juce::MPEZoneLayout::processNextMidiEvent().

## ◆ getDescription()

String juce::MidiMessage::getDescription | ( |  | ) | const

Returns a human-readable description of the midi message as a string, for example "Note On C#3 Velocity 120 Channel 1".

Definition at line 349 of file juce_MidiMessage.cpp.

## ◆ getFloatVelocity()

float juce::MidiMessage::getFloatVelocity | ( |  | ) | const
| noexcept

Returns the velocity of a note-on or note-off message.

The value returned will be in the range 0 to 1.0 If the message isn't a note-on or off event, it will return 0.

See also
  getVelocity, setVelocity

Definition at line 451 of file juce_MidiMessage.cpp.

Referenced by juce::Synthesiser::handleMidiEvent(), and juce::MidiKeyboardState::processNextMidiEvent().

## ◆ getFullFrameParameters()

void juce::MidiMessage::getFullFrameParameters | ( | int & | hours,
|  | int & | minutes,
|  | int & | seconds,
|  | int & | frames,
|  | MidiMessage::SmpteTimecodeType & | timecodeType ) const
| noexcept

Extracts the timecode information from a full-frame midi timecode message.

You should only call this on messages where you've used isFullFrame() to check that they're the right kind.

Definition at line 949 of file juce_MidiMessage.cpp.

## ◆ getGMInstrumentBankName()

const char * juce::MidiMessage::getGMInstrumentBankName | ( | int | midiBankNumber | ) |
| static

Returns the name of a bank of GM instruments, or nullptr if unknown for this bank number.

Parameters

  midiBankNumber | the bank, 0 to 15

Definition at line 1093 of file juce_MidiMessage.cpp.

## ◆ getGMInstrumentName()

const char * juce::MidiMessage::getGMInstrumentName | ( | int | midiInstrumentNumber | ) |
| static

Returns the standard name of a GM instrument, or nullptr if unknown for this index.

Parameters

  midiInstrumentNumber | the program number 0 to 127

See also
  getProgramChangeNumber

Definition at line 1052 of file juce_MidiMessage.cpp.

## ◆ getKeySignatureNumberOfSharpsOrFlats()

int juce::MidiMessage::getKeySignatureNumberOfSharpsOrFlats | ( |  | ) | const
| noexcept

Returns the key from a key-signature meta-event. This method must only be called if isKeySignatureMetaEvent() is true. A positive number here indicates the number of sharps in the key signature, and a negative number indicates a number of flats. So e.g. 3 = F# + C# + G#, -2 = Bb + Eb

See also
  isKeySignatureMetaEvent, isKeySignatureMajorKey

Definition at line 884 of file juce_MidiMessage.cpp.

## ◆ getMessageLengthFromFirstByte()

int juce::MidiMessage::getMessageLengthFromFirstByte | ( | uint8 | firstByte | ) |
| static noexcept

Based on the first byte of a short midi message, this uses a lookup table to return the message length (either 1, 2, or 3 bytes).

The value passed in must be 0x80 or higher.

Definition at line 104 of file juce_MidiMessage.cpp.

Referenced by juce::universal_midi_packets::Midi1ToBytestreamTranslator::fromUmp(), MidiMessage(), and MidiMessage().

## ◆ getMetaEventData()

const uint8 * juce::MidiMessage::getMetaEventData | ( |  | ) | const
| noexcept

Returns a pointer to the data in a meta-event.

See also
  isMetaEvent, getMetaEventLength

Definition at line 726 of file juce_MidiMessage.cpp.

Referenced by getKeySignatureNumberOfSharpsOrFlats(), getTempoSecondsPerQuarterNote(), getTextFromTextMetaEvent(), and isKeySignatureMajorKey().

## ◆ getMetaEventLength()

int juce::MidiMessage::getMetaEventLength | ( |  | ) | const
| noexcept

Returns the length of the data for a meta-event.

See also
  isMetaEvent, getMetaEventData

Definition at line 713 of file juce_MidiMessage.cpp.

Referenced by getTextFromTextMetaEvent().

## ◆ getMetaEventType()

int juce::MidiMessage::getMetaEventType | ( |  | ) | const
| noexcept

Returns a meta-event's type number.

If the message isn't a meta-event, this will return -1.

See also
  isMetaEvent, isTrackMetaEvent, isEndOfTrackMetaEvent, isTextMetaEvent, isTrackNameEvent, isTempoMetaEvent, isTimeSignatureMetaEvent, isKeySignatureMetaEvent, isMidiChannelMetaEvent

Definition at line 707 of file juce_MidiMessage.cpp.

Referenced by isEndOfTrackMetaEvent(), isKeySignatureMetaEvent(), isTextMetaEvent(), and isTrackMetaEvent().

## ◆ getMidiChannelMetaEventChannel()

int juce::MidiMessage::getMidiChannelMetaEventChannel | ( |  | ) | const
| noexcept

Returns the channel number from a channel meta-event.

Returns
  the channel, in the range 1 to 16.

See also
  isMidiChannelMetaEvent

Definition at line 787 of file juce_MidiMessage.cpp.

## ◆ getMidiMachineControlCommand()

MidiMessage::MidiMachineControlCommand juce::MidiMessage::getMidiMachineControlCommand | ( |  | ) | const
| noexcept

For an MMC message, this returns its type.

Make sure it's actually an MMC message with isMidiMachineControlMessage() before calling this method.

Definition at line 981 of file juce_MidiMessage.cpp.

## ◆ getMidiNoteInHertz()

double juce::MidiMessage::getMidiNoteInHertz | ( | int | noteNumber,
|  | double | frequencyOfA = 440.0 )
| static noexcept

Returns the frequency of a midi note number.

The frequencyOfA parameter is an optional frequency for 'A', normally 440-444Hz for concert pitch.

See also
  getMidiNoteName

Definition at line 1042 of file juce_MidiMessage.cpp.

## ◆ getMidiNoteName()

String juce::MidiMessage::getMidiNoteName | ( | int | noteNumber,
|  | bool | useSharps,
|  | bool | includeOctaveNumber,
|  | int | octaveNumForMiddleC )
| static

Returns the name of a midi note number.

E.g "C", "D#", etc.

Parameters

  noteNumber | the midi note number, 0 to 127
  useSharps | if true, sharpened notes are used, e.g. "C#", otherwise they'll be flattened, e.g. "Db"
  includeOctaveNumber | if true, the octave number will be appended to the string, e.g. "C#4"
  octaveNumForMiddleC | if an octave number is being appended, this indicates the number that will be used for middle C's octave

See also
  getMidiNoteInHertz

Definition at line 1023 of file juce_MidiMessage.cpp.

Referenced by getDescription().

## ◆ getNoteNumber()

int juce::MidiMessage::getNoteNumber | ( |  | ) | const
| noexcept

Returns the midi note number for note-on and note-off messages. If the message isn't a note-on or off, the value returned is undefined.

See also
  isNoteOff, getMidiNoteName, getMidiNoteInHertz, setNoteNumber

Definition at line 432 of file juce_MidiMessage.cpp.

Referenced by getDescription(), juce::Synthesiser::handleMidiEvent(), and juce::MidiKeyboardState::processNextMidiEvent().

## ◆ getPitchWheelValue()

int juce::MidiMessage::getPitchWheelValue | ( |  | ) | const
| noexcept

Returns the pitch wheel position from a pitch-wheel move message.

The value returned is a 14-bit number from 0 to 0x3fff, indicating the wheel position. If called for messages which aren't pitch wheel events, the number returned will be nonsense.

See also
  isPitchWheel

Definition at line 547 of file juce_MidiMessage.cpp.

Referenced by getDescription(), and juce::Synthesiser::handleMidiEvent().

## ◆ getProgramChangeNumber()

int juce::MidiMessage::getProgramChangeNumber | ( |  | ) | const
| noexcept

Returns the new program number of a program change message. If the message isn't a program change, the value returned is undefined.

See also
  isProgramChange, getGMInstrumentName

Definition at line 529 of file juce_MidiMessage.cpp.

Referenced by getDescription(), juce::MPESynthesiser::handleMidiEvent(), and juce::Synthesiser::handleMidiEvent().

## ◆ getQuarterFrameSequenceNumber()

int juce::MidiMessage::getQuarterFrameSequenceNumber | ( |  | ) | const
| noexcept

Returns the sequence number of a quarter-frame midi timecode message. This will be a value between 0 and 7.

See also
  isQuarterFrame, getQuarterFrameValue, quarterFrame

Definition at line 930 of file juce_MidiMessage.cpp.

## ◆ getQuarterFrameValue()

int juce::MidiMessage::getQuarterFrameValue | ( |  | ) | const
| noexcept

Returns the value from a quarter-frame message. This will be the lower nybble of the message's data-byte, a value between 0 and 15

Definition at line 931 of file juce_MidiMessage.cpp.

## ◆ getRawData()

const uint8 * juce::MidiMessage::getRawData | ( |  | ) | const
| inline noexcept

Returns a pointer to the raw midi data.

See also
  getRawDataSize

Definition at line 134 of file juce_MidiMessage.h.

Referenced by juce::MidiBuffer::addEvent(), getAfterTouchValue(), getChannel(), getChannelPressureValue(), getControllerNumber(), getControllerValue(), getDescription(), getMetaEventData(), getMetaEventLength(), getMetaEventType(), getMidiChannelMetaEventChannel(), getMidiMachineControlCommand(), getNoteNumber(), getPitchWheelValue(), getProgramChangeNumber(), getQuarterFrameSequenceNumber(), getQuarterFrameValue(), getSongPositionPointerMidiBeat(), getSysExData(), getVelocity(), isActiveSense(), isAftertouch(), isAllNotesOff(), isAllSoundOff(), isChannelPressure(), isController(), isFullFrame(), isMetaEvent(), isMidiChannelMetaEvent(), isMidiClock(), isMidiContinue(), isMidiMachineControlMessage(), isMidiStart(), isMidiStop(), isNoteOnOrOff(), isPitchWheel(), isProgramChange(), isQuarterFrame(), isResetAllControllers(), isSoftPedalOff(), isSoftPedalOn(), isSongPositionPointer(), isSostenutoPedalOff(), isSostenutoPedalOn(), isSustainPedalOff(), isSustainPedalOn(), isSysEx(), isTempoMetaEvent(), isTimeSignatureMetaEvent(), and isTrackNameEvent().

## ◆ getRawDataSize()

int juce::MidiMessage::getRawDataSize | ( |  | ) | const
| inline noexcept

Returns the number of bytes of data in the message.

See also
  getRawData

Definition at line 139 of file juce_MidiMessage.h.

Referenced by juce::MidiBuffer::addEvent(), and getDescription().

## ◆ getRhythmInstrumentName()

const char * juce::MidiMessage::getRhythmInstrumentName | ( | int | midiNoteNumber | ) |
| static

Returns the standard name of a channel 10 percussion sound, or nullptr if unknown for this note number.

Parameters

  midiNoteNumber | the key number, 35 to 81

Definition at line 1106 of file juce_MidiMessage.cpp.

## ◆ getSongPositionPointerMidiBeat()

int juce::MidiMessage::getSongPositionPointerMidiBeat | ( |  | ) | const
| noexcept

Returns the midi beat-number of a song-position-pointer message.

See also
  isSongPositionPointer, songPositionPointer

Definition at line 908 of file juce_MidiMessage.cpp.

## ◆ getSysExData()

const uint8 * juce::MidiMessage::getSysExData | ( |  | ) | const
| noexcept

Returns a pointer to the sysex data inside the message. If this event isn't a sysex event, it'll return 0.

See also
  getSysExDataSize

Definition at line 693 of file juce_MidiMessage.cpp.

## ◆ getSysExDataSize()

int juce::MidiMessage::getSysExDataSize | ( |  | ) | const
| noexcept

Returns the size of the sysex data. This value excludes the 0xf0 header byte and the 0xf7 at the end.

See also
  getSysExData

Definition at line 698 of file juce_MidiMessage.cpp.

## ◆ getSysExDataSpan()

Span< const std::byte > juce::MidiMessage::getSysExDataSpan | ( |  | ) | const
| inline noexcept

Returns a span that bounds the sysex body bytes contained in this message.

Definition at line 222 of file juce_MidiMessage.h.

## ◆ getTempoMetaEventTickLength()

double juce::MidiMessage::getTempoMetaEventTickLength | ( | short | timeFormat | ) | const
| noexcept

Returns the tick length from a tempo meta-event.

Parameters

  timeFormat | the 16-bit time format value from the midi file's header.

Returns
  the tick length (in seconds).

See also
  isTempoMetaEvent

Definition at line 806 of file juce_MidiMessage.cpp.

## ◆ getTempoSecondsPerQuarterNote()

double juce::MidiMessage::getTempoSecondsPerQuarterNote | ( |  | ) | const
| noexcept

Calculates the seconds-per-quarter-note from a tempo meta-event.

See also
  isTempoMetaEvent, getTempoMetaEventTickLength

Definition at line 793 of file juce_MidiMessage.cpp.

## ◆ getTextFromTextMetaEvent()

String juce::MidiMessage::getTextFromTextMetaEvent | ( |  | ) | const

Returns the text from a text meta-event.

See also
  isTextMetaEvent

Definition at line 744 of file juce_MidiMessage.cpp.

## ◆ getTimeSignatureInfo()

void juce::MidiMessage::getTimeSignatureInfo | ( | int & | numerator,
|  | int & | denominator ) const
| noexcept

Returns the time-signature values from a time-signature meta-event.

See also
  isTimeSignatureMetaEvent

Definition at line 845 of file juce_MidiMessage.cpp.

## ◆ getTimeStamp()

double juce::MidiMessage::getTimeStamp | ( |  | ) | const
| inline noexcept

Returns the timestamp associated with this message.

The exact meaning of this time and its units will vary, as messages are used in a variety of different contexts.

If you're getting the message from a midi file, this could be a time in seconds, or a number of ticks - see MidiFile::convertTimestampTicksToSeconds().

If the message is being used in a MidiBuffer, it might indicate the number of audio samples from the start of the buffer.

If the message was created by a MidiInput, see MidiInputCallback::handleIncomingMidiMessage() for details of the way that it initialises this value.

See also
  setTimeStamp, addToTimeStamp

Definition at line 164 of file juce_MidiMessage.h.

Referenced by juce::MidiMessageCollector::addMessageToQueue(), and juce::MidiOutput::sendBlockOfMessages().

## ◆ getVelocity()

uint8 juce::MidiMessage::getVelocity | ( |  | ) | const
| noexcept

Returns the velocity of a note-on or note-off message.

The value returned will be in the range 0 to 127. If the message isn't a note-on or off event, it will return 0.

See also
  getFloatVelocity

Definition at line 443 of file juce_MidiMessage.cpp.

Referenced by getDescription(), and getFloatVelocity().

## ◆ isActiveSense()

bool juce::MidiMessage::isActiveSense | ( |  | ) | const
| noexcept

Returns true if this is an active-sense message.

Definition at line 705 of file juce_MidiMessage.cpp.

## ◆ isAftertouch()

bool juce::MidiMessage::isAftertouch | ( |  | ) | const
| noexcept

Returns true if the message is an aftertouch event.

For aftertouch events, use the getNoteNumber() method to find out the key that it applies to, and getAfterTouchValue() to find out the amount. Use getChannel() to find out the channel.

See also
  getAftertouchValue, getNoteNumber

Definition at line 471 of file juce_MidiMessage.cpp.

Referenced by getAfterTouchValue(), getDescription(), juce::Synthesiser::handleMidiEvent(), and juce::MPEInstrument::processNextMidiEvent().

## ◆ isAllNotesOff()

bool juce::MidiMessage::isAllNotesOff | ( |  | ) | const
| noexcept

Checks whether this message is an all-notes-off message.

See also
  allNotesOff

Definition at line 636 of file juce_MidiMessage.cpp.

Referenced by getDescription(), juce::Synthesiser::handleMidiEvent(), juce::MidiKeyboardState::processNextMidiEvent(), and juce::MPEInstrument::processNextMidiEvent().

## ◆ isAllSoundOff()

bool juce::MidiMessage::isAllSoundOff | ( |  | ) | const
| noexcept

Checks whether this message is an all-sound-off message.

See also
  allSoundOff

Definition at line 647 of file juce_MidiMessage.cpp.

Referenced by getDescription(), and juce::Synthesiser::handleMidiEvent().

## ◆ isChannelPressure()

bool juce::MidiMessage::isChannelPressure | ( |  | ) | const
| noexcept

Returns true if the message is a channel-pressure change event.

This is like aftertouch, but common to the whole channel rather than a specific note. Use getChannelPressureValue() to find out the pressure, and getChannel() to find out the channel.

See also
  channelPressureChange

Definition at line 495 of file juce_MidiMessage.cpp.

Referenced by getChannelPressureValue(), getDescription(), juce::Synthesiser::handleMidiEvent(), and juce::MPEInstrument::processNextMidiEvent().

## ◆ isController()

bool juce::MidiMessage::isController | ( |  | ) | const
| noexcept

Returns true if this is a midi controller message.

See also
  getControllerNumber, getControllerValue, controllerEvent

Definition at line 563 of file juce_MidiMessage.cpp.

Referenced by getControllerNumber(), getControllerValue(), getDescription(), juce::MPESynthesiser::handleMidiEvent(), juce::Synthesiser::handleMidiEvent(), juce::MPEInstrument::processNextMidiEvent(), and juce::MPEZoneLayout::processNextMidiEvent().

## ◆ isControllerOfType()

bool juce::MidiMessage::isControllerOfType | ( | int | controllerType | ) | const
| noexcept

Returns true if this message is a controller message and if it has the specified controller type.

Definition at line 568 of file juce_MidiMessage.cpp.

Referenced by isSoftPedalOff(), isSoftPedalOn(), isSostenutoPedalOff(), isSostenutoPedalOn(), isSustainPedalOff(), and isSustainPedalOn().

## ◆ isEndOfTrackMetaEvent()

bool juce::MidiMessage::isEndOfTrackMetaEvent | ( |  | ) | const
| noexcept

Returns true if this is an 'end-of-track' meta-event.

Definition at line 736 of file juce_MidiMessage.cpp.

## ◆ isForChannel()

bool juce::MidiMessage::isForChannel | ( | int | channelNumber | ) | const
| noexcept

Returns true if the message applies to the given midi channel.

Parameters

  channelNumber | the channel number to look for, in the range 1 to 16

See also
  getChannel, setChannel

Definition at line 389 of file juce_MidiMessage.cpp.

## ◆ isFullFrame()

bool juce::MidiMessage::isFullFrame | ( |  | ) | const
| noexcept

Returns true if this is a full-frame midi timecode message.

Definition at line 938 of file juce_MidiMessage.cpp.

## ◆ isKeySignatureMajorKey()

bool juce::MidiMessage::isKeySignatureMajorKey | ( |  | ) | const
| noexcept

Returns true if this key-signature event is major, or false if it's minor. This method must only be called if isKeySignatureMetaEvent() is true.

Definition at line 889 of file juce_MidiMessage.cpp.

## ◆ isKeySignatureMetaEvent()

bool juce::MidiMessage::isKeySignatureMetaEvent | ( |  | ) | const
| noexcept

Returns true if this is a 'key-signature' meta-event.

See also
  getKeySignatureNumberOfSharpsOrFlats, isKeySignatureMajorKey

Definition at line 879 of file juce_MidiMessage.cpp.

Referenced by juce::MidiFile::findAllKeySigEvents().

## ◆ isMetaEvent()

bool juce::MidiMessage::isMetaEvent | ( |  | ) | const
| noexcept

Returns true if this event is a meta-event.

Meta-events are things like tempo changes, track names, etc.

See also
  getMetaEventType, isTrackMetaEvent, isEndOfTrackMetaEvent, isTextMetaEvent, isTrackNameEvent, isTempoMetaEvent, isTimeSignatureMetaEvent, isKeySignatureMetaEvent, isMidiChannelMetaEvent

Definition at line 704 of file juce_MidiMessage.cpp.

Referenced by getDescription(), and getMetaEventData().

## ◆ isMidiChannelMetaEvent()

bool juce::MidiMessage::isMidiChannelMetaEvent | ( |  | ) | const
| noexcept

Returns true if this is a 'channel' meta-event.

A channel meta-event specifies the midi channel that should be used for subsequent meta-events.

See also
  getMidiChannelMetaEventChannel

Definition at line 785 of file juce_MidiMessage.cpp.

Referenced by getMidiChannelMetaEventChannel().

## ◆ isMidiClock()

bool juce::MidiMessage::isMidiClock | ( |  | ) | const
| noexcept

Returns true if this is a midi clock event.

See also
  midiClock, songPositionPointer

Definition at line 926 of file juce_MidiMessage.cpp.

## ◆ isMidiContinue()

bool juce::MidiMessage::isMidiContinue | ( |  | ) | const
| noexcept

Returns true if this is a midi continue event.

See also
  midiContinue

Definition at line 920 of file juce_MidiMessage.cpp.

## ◆ isMidiMachineControlGoto()

bool juce::MidiMessage::isMidiMachineControlGoto | ( | int & | hours,
|  | int & | minutes,
|  | int & | seconds,
|  | int & | frames ) const
| noexcept

Checks whether this is an MMC "goto" message. If it is, the parameters passed-in are set to the time that the message contains.

See also
  midiMachineControlGoto

Definition at line 994 of file juce_MidiMessage.cpp.

## ◆ isMidiMachineControlMessage()

bool juce::MidiMessage::isMidiMachineControlMessage | ( |  | ) | const
| noexcept

Checks whether this is an MMC message. If it is, you can use the getMidiMachineControlCommand() to find out its type.

Definition at line 971 of file juce_MidiMessage.cpp.

Referenced by getMidiMachineControlCommand().

## ◆ isMidiNoteBlack()

bool juce::MidiMessage::isMidiNoteBlack | ( | int | noteNumber | ) |
| static noexcept

Returns true if the given midi note number is a black key.

Definition at line 1047 of file juce_MidiMessage.cpp.

## ◆ isMidiStart()

bool juce::MidiMessage::isMidiStart | ( |  | ) | const
| noexcept

Returns true if this is a midi start event.

See also
  midiStart

Definition at line 917 of file juce_MidiMessage.cpp.

## ◆ isMidiStop()

bool juce::MidiMessage::isMidiStop | ( |  | ) | const
| noexcept

Returns true if this is a midi stop event.

See also
  midiStop

Definition at line 923 of file juce_MidiMessage.cpp.

## ◆ isNoteOff()

bool juce::MidiMessage::isNoteOff | ( | bool | returnTrueForNoteOnVelocity0 = true | ) | const
| noexcept

Returns true if this message is a 'key-up' event.

If returnTrueForNoteOnVelocity0 is true, then his will also return true for a note-on event with a velocity of 0.

See also
  isNoteOn, getNoteNumber, getVelocity, noteOff

Definition at line 418 of file juce_MidiMessage.cpp.

Referenced by getDescription(), juce::Synthesiser::handleMidiEvent(), juce::MidiKeyboardState::processNextMidiEvent(), and juce::MPEInstrument::processNextMidiEvent().

## ◆ isNoteOn()

bool juce::MidiMessage::isNoteOn | ( | bool | returnTrueForVelocity0 = false | ) | const
| noexcept

Returns true if this message is a 'key-down' event.

Parameters

  returnTrueForVelocity0 | if true, then if this event is a note-on with velocity 0, it will still be considered to be a note-on and the method will return true. If returnTrueForVelocity0 is false, then if this is a note-on event with velocity 0, it'll be regarded as a note-off, and the method will return false

See also
  isNoteOff, getNoteNumber, getVelocity, noteOn

Definition at line 410 of file juce_MidiMessage.cpp.

Referenced by getDescription(), juce::Synthesiser::handleMidiEvent(), juce::MidiKeyboardState::processNextMidiEvent(), and juce::MPEInstrument::processNextMidiEvent().

## ◆ isNoteOnOrOff()

bool juce::MidiMessage::isNoteOnOrOff | ( |  | ) | const
| noexcept

Returns true if this message is a 'key-down' or 'key-up' event.

See also
  isNoteOn, isNoteOff

Definition at line 426 of file juce_MidiMessage.cpp.

Referenced by getVelocity().

## ◆ isPitchWheel()

bool juce::MidiMessage::isPitchWheel | ( |  | ) | const
| noexcept

Returns true if the message is a pitch-wheel move.

See also
  getPitchWheelValue, pitchWheel

Definition at line 542 of file juce_MidiMessage.cpp.

Referenced by getDescription(), getPitchWheelValue(), juce::Synthesiser::handleMidiEvent(), and juce::MPEInstrument::processNextMidiEvent().

## ◆ isProgramChange()

bool juce::MidiMessage::isProgramChange | ( |  | ) | const
| noexcept

Returns true if the message is a program (patch) change message.

See also
  getProgramChangeNumber, getGMInstrumentName

Definition at line 524 of file juce_MidiMessage.cpp.

Referenced by getDescription(), getProgramChangeNumber(), juce::MPESynthesiser::handleMidiEvent(), and juce::Synthesiser::handleMidiEvent().

## ◆ isQuarterFrame()

bool juce::MidiMessage::isQuarterFrame | ( |  | ) | const
| noexcept

Returns true if this is a quarter-frame midi timecode message.

See also
  quarterFrame, getQuarterFrameSequenceNumber, getQuarterFrameValue

Definition at line 929 of file juce_MidiMessage.cpp.

## ◆ isResetAllControllers()

bool juce::MidiMessage::isResetAllControllers | ( |  | ) | const
| noexcept

Checks whether this message is a reset all controllers message.

See also
  allControllerOff

Definition at line 653 of file juce_MidiMessage.cpp.

Referenced by juce::MPEInstrument::processNextMidiEvent().

## ◆ isSoftPedalOff()

bool juce::MidiMessage::isSoftPedalOff | ( |  | ) | const
| noexcept

Returns true if this message is a 'soft pedal up' controller message.

Definition at line 521 of file juce_MidiMessage.cpp.

## ◆ isSoftPedalOn()

bool juce::MidiMessage::isSoftPedalOn | ( |  | ) | const
| noexcept

Returns true if this message is a 'soft pedal down' controller message.

Definition at line 520 of file juce_MidiMessage.cpp.

## ◆ isSongPositionPointer()

bool juce::MidiMessage::isSongPositionPointer | ( |  | ) | const
| noexcept

Returns true if this is a song-position-pointer message.

See also
  getSongPositionPointerMidiBeat, songPositionPointer

Definition at line 907 of file juce_MidiMessage.cpp.

## ◆ isSostenutoPedalOff()

bool juce::MidiMessage::isSostenutoPedalOff | ( |  | ) | const
| noexcept

Returns true if this message is a 'sostenuto pedal up' controller message.

Definition at line 518 of file juce_MidiMessage.cpp.

## ◆ isSostenutoPedalOn()

bool juce::MidiMessage::isSostenutoPedalOn | ( |  | ) | const
| noexcept

Returns true if this message is a 'sostenuto pedal down' controller message.

Definition at line 517 of file juce_MidiMessage.cpp.

## ◆ isSustainPedalOff()

bool juce::MidiMessage::isSustainPedalOff | ( |  | ) | const
| noexcept

Returns true if this message is a 'sustain pedal up' controller message.

Definition at line 515 of file juce_MidiMessage.cpp.

## ◆ isSustainPedalOn()

bool juce::MidiMessage::isSustainPedalOn | ( |  | ) | const
| noexcept

Returns true if this message is a 'sustain pedal down' controller message.

Definition at line 514 of file juce_MidiMessage.cpp.

## ◆ isSysEx()

bool juce::MidiMessage::isSysEx | ( |  | ) | const
| noexcept

Returns true if this is a system-exclusive message.

Definition at line 672 of file juce_MidiMessage.cpp.

Referenced by getSysExData(), and getSysExDataSize().

## ◆ isTempoMetaEvent()

bool juce::MidiMessage::isTempoMetaEvent | ( |  | ) | const
| noexcept

Returns true if this is a 'tempo' meta-event.

See also
  getTempoMetaEventTickLength, getTempoSecondsPerQuarterNote

Definition at line 784 of file juce_MidiMessage.cpp.

Referenced by juce::MidiFile::findAllTempoEvents(), and getTempoSecondsPerQuarterNote().

## ◆ isTextMetaEvent()

bool juce::MidiMessage::isTextMetaEvent | ( |  | ) | const
| noexcept

Returns true if this is a 'text' meta-event.

See also
  getTextFromTextMetaEvent

Definition at line 738 of file juce_MidiMessage.cpp.

## ◆ isTimeSignatureMetaEvent()

bool juce::MidiMessage::isTimeSignatureMetaEvent | ( |  | ) | const
| noexcept

Returns true if this is a 'time-signature' meta-event.

See also
  getTimeSignatureInfo

Definition at line 839 of file juce_MidiMessage.cpp.

Referenced by juce::MidiFile::findAllTimeSigEvents().

## ◆ isTrackMetaEvent()

bool juce::MidiMessage::isTrackMetaEvent | ( |  | ) | const
| noexcept

Returns true if this is a 'track' meta-event.

Definition at line 735 of file juce_MidiMessage.cpp.

## ◆ isTrackNameEvent()

bool juce::MidiMessage::isTrackNameEvent | ( |  | ) | const
| noexcept

Returns true if this is an 'track name' meta-event. You can use the getTextFromTextMetaEvent() method to get the track's name.

Definition at line 783 of file juce_MidiMessage.cpp.

## ◆ keySignatureMetaEvent()

MidiMessage juce::MidiMessage::keySignatureMetaEvent | ( | int | numberOfSharpsOrFlats,
|  | bool | isMinorKey )
| static

Creates a key-signature meta-event.

Parameters

  numberOfSharpsOrFlats | if positive, this indicates the number of sharps in the key; if negative, the number of flats
  isMinorKey | if true, the key is minor; if false, it is major

See also
  isKeySignatureMetaEvent

Definition at line 894 of file juce_MidiMessage.cpp.

## ◆ masterVolume()

MidiMessage juce::MidiMessage::masterVolume | ( | float | volume | ) |
| static

Creates a master-volume change message.

Parameters

  volume | the volume, 0 to 1.0

Definition at line 664 of file juce_MidiMessage.cpp.

## ◆ midiChannelMetaEvent()

MidiMessage juce::MidiMessage::midiChannelMetaEvent | ( | int | channel | ) |
| static noexcept

Creates a midi channel meta-event.

Parameters

  channel | the midi channel, in the range 1 to 16

See also
  isMidiChannelMetaEvent

Definition at line 874 of file juce_MidiMessage.cpp.

## ◆ midiClock()

MidiMessage juce::MidiMessage::midiClock | ( |  | ) |
| static noexcept

Creates a midi clock event.

Definition at line 927 of file juce_MidiMessage.cpp.

## ◆ midiContinue()

MidiMessage juce::MidiMessage::midiContinue | ( |  | ) |
| static noexcept

Creates a midi continue event.

Definition at line 921 of file juce_MidiMessage.cpp.

## ◆ midiMachineControlCommand()

MidiMessage juce::MidiMessage::midiMachineControlCommand | ( | MidiMessage::MidiMachineControlCommand | command | ) |
| static

Creates an MMC message.

Definition at line 988 of file juce_MidiMessage.cpp.

## ◆ midiMachineControlGoto()

MidiMessage juce::MidiMessage::midiMachineControlGoto | ( | int | hours,
|  | int | minutes,
|  | int | seconds,
|  | int | frames )
| static

Creates an MMC "goto" message. This messages tells the device to go to a specific frame.

See also
  isMidiMachineControlGoto

Definition at line 1017 of file juce_MidiMessage.cpp.

## ◆ midiStart()

MidiMessage juce::MidiMessage::midiStart | ( |  | ) |
| static noexcept

Creates a midi start event.

Definition at line 918 of file juce_MidiMessage.cpp.

## ◆ midiStop()

MidiMessage juce::MidiMessage::midiStop | ( |  | ) |
| static noexcept

Creates a midi stop event.

Definition at line 924 of file juce_MidiMessage.cpp.

## ◆ multiplyVelocity()

void juce::MidiMessage::multiplyVelocity | ( | float | scaleFactor | ) |
| noexcept

Multiplies the velocity of a note-on or note-off message by a given amount.

If the message isn't a note on or off, this will do nothing.

Parameters

  scaleFactor | the value by which to multiply the velocity

See also
  setVelocity

Definition at line 462 of file juce_MidiMessage.cpp.

## ◆ noteOff() [1/3]

MidiMessage juce::MidiMessage::noteOff | ( | int | channel,
|  | int | noteNumber )
| static noexcept

Creates a key-up message.

Parameters

  channel | the midi channel, in the range 1 to 16
  noteNumber | the key number, 0 to 127

See also
  isNoteOff

Definition at line 623 of file juce_MidiMessage.cpp.

## ◆ noteOff() [2/3]

MidiMessage juce::MidiMessage::noteOff | ( | int | channel,
|  | int | noteNumber,
|  | float | velocity )
| static noexcept

Creates a key-up message.

Parameters

  channel | the midi channel, in the range 1 to 16
  noteNumber | the key number, 0 to 127
  velocity | in the range 0 to 1.0

See also
  isNoteOff

Definition at line 618 of file juce_MidiMessage.cpp.

Referenced by juce::MidiMessageCollector::handleNoteOff(), and juce::MidiKeyboardState::noteOff().

## ◆ noteOff() [3/3]

MidiMessage juce::MidiMessage::noteOff | ( | int | channel,
|  | int | noteNumber,
|  | uint8 | velocity )
| static noexcept

Creates a key-up message.

Parameters

  channel | the midi channel, in the range 1 to 16
  noteNumber | the key number, 0 to 127
  velocity | in the range 0 to 127

See also
  isNoteOff

Definition at line 609 of file juce_MidiMessage.cpp.

## ◆ noteOn() [1/2]

MidiMessage juce::MidiMessage::noteOn | ( | int | channel,
|  | int | noteNumber,
|  | float | velocity )
| static noexcept

Creates a key-down message (using a floating-point velocity).

Parameters

  channel | the midi channel, in the range 1 to 16
  noteNumber | the key number, 0 to 127
  velocity | in the range 0 to 1.0

See also
  isNoteOn

Definition at line 604 of file juce_MidiMessage.cpp.

Referenced by juce::MidiMessageCollector::handleNoteOn(), and juce::MidiKeyboardState::noteOn().

## ◆ noteOn() [2/2]

MidiMessage juce::MidiMessage::noteOn | ( | int | channel,
|  | int | noteNumber,
|  | uint8 | velocity )
| static noexcept

Creates a key-down message (using an integer velocity).

Parameters

  channel | the midi channel, in the range 1 to 16
  noteNumber | the key number, 0 to 127
  velocity | in the range 0 to 127

See also
  isNoteOn

Definition at line 595 of file juce_MidiMessage.cpp.

## ◆ operator=() [1/2]

MidiMessage & juce::MidiMessage::operator= | ( | const MidiMessage & | other | ) |

Copies this message from another one.

Definition at line 284 of file juce_MidiMessage.cpp.

## ◆ operator=() [2/2]

MidiMessage & juce::MidiMessage::operator= | ( | MidiMessage && | other | ) |
| noexcept

Move assignment operator

Definition at line 322 of file juce_MidiMessage.cpp.

## ◆ pitchbendToPitchwheelPos()

uint16 juce::MidiMessage::pitchbendToPitchwheelPos | ( | float | pitchbendInSemitones,
|  | float | pitchbendRangeInSemitones )
| static noexcept

Converts a pitchbend value in semitones to a MIDI 14-bit pitchwheel position value.

Definition at line 48 of file juce_MidiMessage.cpp.

## ◆ pitchWheel()

MidiMessage juce::MidiMessage::pitchWheel | ( | int | channel,
|  | int | position )
| static noexcept

Creates a pitch-wheel move message.

Parameters

  channel | the midi channel, in the range 1 to 16
  position | the wheel position, in the range 0 to 16383

See also
  isPitchWheel

Definition at line 554 of file juce_MidiMessage.cpp.

## ◆ programChange()

MidiMessage juce::MidiMessage::programChange | ( | int | channel,
|  | int | programNumber )
| static noexcept

Creates a program-change message.

Parameters

  channel | the midi channel, in the range 1 to 16
  programNumber | the midi program number, 0 to 127

See also
  isProgramChange, getGMInstrumentName

Definition at line 535 of file juce_MidiMessage.cpp.

## ◆ quarterFrame()

MidiMessage juce::MidiMessage::quarterFrame | ( | int | sequenceNumber,
|  | int | value )
| static noexcept

Creates a quarter-frame MTC message.

Parameters

  sequenceNumber | a value 0 to 7 for the upper nybble of the message's data byte
  value | a value 0 to 15 for the lower nybble of the message's data byte

Definition at line 933 of file juce_MidiMessage.cpp.

## ◆ readVariableLengthVal()

int juce::MidiMessage::readVariableLengthVal | ( | const uint8 * | data,
|  | int & | numBytesUsed )
| static noexcept

Reads a midi variable-length integer.

The `data` argument indicates the data to read the number from, and `numBytesUsed` is used as an out-parameter to indicate the number of bytes that were read.

Definition at line 85 of file juce_MidiMessage.cpp.

## ◆ readVariableLengthValue()

MidiMessage::VariableLengthValue juce::MidiMessage::readVariableLengthValue | ( | const uint8 * | data,
|  | int | maxBytesToUse )
| static noexcept

Reads a midi variable-length integer, with protection against buffer overflow.

Parameters

  data | the data to read the number from
  maxBytesToUse | the number of bytes in the region following `data`

Returns
  a struct containing the parsed value, and the number of bytes that were read. If parsing fails, both the `value` and `bytesUsed` fields will be set to 0 and `isValid()` will return false

Definition at line 60 of file juce_MidiMessage.cpp.

Referenced by getMetaEventData(), getMetaEventLength(), and MidiMessage().

## ◆ setChannel()

void juce::MidiMessage::setChannel | ( | int | newChannelNumber | ) |
| noexcept

Changes the message's midi channel. This won't do anything for non-channel messages like sysexes.

Parameters

  newChannelNumber | the channel number to change it to, in the range 1 to 16

Definition at line 399 of file juce_MidiMessage.cpp.

## ◆ setNoteNumber()

void juce::MidiMessage::setNoteNumber | ( | int | newNoteNumber | ) |
| noexcept

Changes the midi note number of a note-on or note-off message. If the message isn't a note on or off, this will do nothing.

Definition at line 437 of file juce_MidiMessage.cpp.

## ◆ setTimeStamp()

void juce::MidiMessage::setTimeStamp | ( | double | newTimestamp | ) |
| inline noexcept

Changes the message's associated timestamp. The units for the timestamp will be application-specific - see the notes for getTimeStamp().

See also
  addToTimeStamp, getTimeStamp

Definition at line 170 of file juce_MidiMessage.h.

Referenced by juce::MidiMessageCollector::handleNoteOff(), and juce::MidiMessageCollector::handleNoteOn().

## ◆ setVelocity()

void juce::MidiMessage::setVelocity | ( | float | newVelocity | ) |
| noexcept

Changes the velocity of a note-on or note-off message.

If the message isn't a note on or off, this will do nothing.

Parameters

  newVelocity | the new velocity, in the range 0 to 1.0

See also
  getFloatVelocity, multiplyVelocity

Definition at line 456 of file juce_MidiMessage.cpp.

## ◆ songPositionPointer()

MidiMessage juce::MidiMessage::songPositionPointer | ( | int | positionInMidiBeats | ) |
| static noexcept

Creates a song-position-pointer message.

The position is a number of midi beats from the start of the song, where 1 midi beat is 6 midi clocks, and there are 24 midi clocks in a quarter-note. So there are 4 midi beats in a quarter-note.

See also
  isSongPositionPointer, getSongPositionPointerMidiBeat

Definition at line 910 of file juce_MidiMessage.cpp.

## ◆ tempoMetaEvent()

MidiMessage juce::MidiMessage::tempoMetaEvent | ( | int | microsecondsPerQuarterNote | ) |
| static noexcept

Creates a tempo meta-event.

See also
  isTempoMetaEvent

Definition at line 831 of file juce_MidiMessage.cpp.

## ◆ textMetaEvent()

MidiMessage juce::MidiMessage::textMetaEvent | ( | int | type,
|  | StringRef | text )
| static

Creates a text meta-event.

Definition at line 752 of file juce_MidiMessage.cpp.

## ◆ timeSignatureMetaEvent()

MidiMessage juce::MidiMessage::timeSignatureMetaEvent | ( | int | numerator,
|  | int | denominator )
| static

Creates a time-signature meta-event.

See also
  isTimeSignatureMetaEvent

Definition at line 860 of file juce_MidiMessage.cpp.

## ◆ withTimeStamp()

MidiMessage juce::MidiMessage::withTimeStamp | ( | double | newTimestamp | ) | const

Return a copy of this message with a new timestamp. The units for the timestamp will be application-specific - see the notes for getTimeStamp().

Definition at line 374 of file juce_MidiMessage.cpp.

The documentation for this class was generated from the following files:

- juce_MidiMessage.h
- juce_MidiMessage.cpp