MidiMessage Class Reference

Encapsulates a MIDI message. More...

List of all members.

Public Types

enum  SmpteTimecodeType { fps24 = 0, fps25 = 1, fps30drop = 2, fps30 = 3 }
 SMPTE timecode types. More...
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
}
 Types of MMC command. More...

Public Member Functions

 MidiMessage (const int byte1, const int byte2, const int byte3, const double timeStamp=0) throw ()
 Creates a 3-byte short midi message.
 MidiMessage (const int byte1, const int byte2, const double timeStamp=0) throw ()
 Creates a 2-byte short midi message.
 MidiMessage (const int byte1, const double timeStamp=0) throw ()
 Creates a 1-byte short midi message.
 MidiMessage (const uint8 *const data, const int dataSize, const double timeStamp=0) throw ()
 Creates a midi message from a block of data.
 MidiMessage (const uint8 *data, int size, int &numBytesUsed, uint8 lastStatusByte, double timeStamp=0) throw ()
 Reads the next midi message from some data.
 MidiMessage (const MidiMessage &other) throw ()
 Creates a copy of another midi message.
 MidiMessage (const MidiMessage &other, const double newTimeStamp) throw ()
 Creates a copy of another midi message, with a different timestamp.
 ~MidiMessage () throw ()
 Destructor.
const MidiMessageoperator= (const MidiMessage &other) throw ()
 Copies this message from another one.
uint8getRawData () const throw ()
 Returns a pointer to the raw midi data.
int getRawDataSize () const throw ()
 Returns the number of bytes of data in the message.
double getTimeStamp () const throw ()
 Returns the timestamp associated with this message.
void setTimeStamp (const double newTimestamp) throw ()
 Changes the message's associated timestamp.
void addToTimeStamp (const double delta) throw ()
 Adds a value to the message's timestamp.
int getChannel () const throw ()
 Returns the midi channel associated with the message.
bool isForChannel (const int channelNumber) const throw ()
 Returns true if the message applies to the given midi channel.
void setChannel (const int newChannelNumber) throw ()
 Changes the message's midi channel.
bool isSysEx () const throw ()
 Returns true if this is a system-exclusive message.
const uint8getSysExData () const throw ()
 Returns a pointer to the sysex data inside the message.
int getSysExDataSize () const throw ()
 Returns the size of the sysex data.
bool isNoteOn () const throw ()
 Returns true if this message is a 'key-down' event.
bool isNoteOff () const throw ()
 Returns true if this message is a 'key-up' event.
bool isNoteOnOrOff () const throw ()
 Returns true if this message is a 'key-down' or 'key-up' event.
int getNoteNumber () const throw ()
 Returns the midi note number for note-on and note-off messages.
void setNoteNumber (const int newNoteNumber) throw ()
 Changes the midi note number of a note-on or note-off message.
uint8 getVelocity () const throw ()
 Returns the velocity of a note-on or note-off message.
float getFloatVelocity () const throw ()
 Returns the velocity of a note-on or note-off message.
void setVelocity (const float newVelocity) throw ()
 Changes the velocity of a note-on or note-off message.
void multiplyVelocity (const float scaleFactor) throw ()
 Multiplies the velocity of a note-on or note-off message by a given amount.
bool isProgramChange () const throw ()
 Returns true if the message is a program (patch) change message.
int getProgramChangeNumber () const throw ()
 Returns the new program number of a program change message.
bool isPitchWheel () const throw ()
 Returns true if the message is a pitch-wheel move.
int getPitchWheelValue () const throw ()
 Returns the pitch wheel position from a pitch-wheel move message.
bool isAftertouch () const throw ()
 Returns true if the message is an aftertouch event.
int getAfterTouchValue () const throw ()
 Returns the amount of aftertouch from an aftertouch messages.
bool isChannelPressure () const throw ()
 Returns true if the message is a channel-pressure change event.
int getChannelPressureValue () const throw ()
 Returns the pressure from a channel pressure change message.
bool isController () const throw ()
 Returns true if this is a midi controller message.
int getControllerNumber () const throw ()
 Returns the controller number of a controller message.
int getControllerValue () const throw ()
 Returns the controller value from a controller message.
bool isAllNotesOff () const throw ()
 Checks whether this message is an all-notes-off message.
bool isAllSoundOff () const throw ()
 Checks whether this message is an all-sound-off message.
bool isMetaEvent () const throw ()
 Returns true if this event is a meta-event.
int getMetaEventType () const throw ()
 Returns a meta-event's type number.
const uint8getMetaEventData () const throw ()
 Returns a pointer to the data in a meta-event.
int getMetaEventLength () const throw ()
 Returns the length of the data for a meta-event.
bool isTrackMetaEvent () const throw ()
 Returns true if this is a 'track' meta-event.
bool isEndOfTrackMetaEvent () const throw ()
 Returns true if this is an 'end-of-track' meta-event.
bool isTrackNameEvent () const throw ()
 Returns true if this is an 'track name' meta-event.
bool isTextMetaEvent () const throw ()
 Returns true if this is a 'text' meta-event.
const String getTextFromTextMetaEvent () const throw ()
 Returns the text from a text meta-event.
bool isTempoMetaEvent () const throw ()
 Returns true if this is a 'tempo' meta-event.
double getTempoMetaEventTickLength (const short timeFormat) const throw ()
 Returns the tick length from a tempo meta-event.
double getTempoSecondsPerQuarterNote () const throw ()
 Calculates the seconds-per-quarter-note from a tempo meta-event.
bool isTimeSignatureMetaEvent () const throw ()
 Returns true if this is a 'time-signature' meta-event.
void getTimeSignatureInfo (int &numerator, int &denominator) const throw ()
 Returns the time-signature values from a time-signature meta-event.
bool isKeySignatureMetaEvent () const throw ()
 Returns true if this is a 'key-signature' meta-event.
int getKeySignatureNumberOfSharpsOrFlats () const throw ()
 Returns the key from a key-signature meta-event.
bool isMidiChannelMetaEvent () const throw ()
 Returns true if this is a 'channel' meta-event.
int getMidiChannelMetaEventChannel () const throw ()
 Returns the channel number from a channel meta-event.
bool isActiveSense () const throw ()
 Returns true if this is an active-sense message.
bool isMidiStart () const throw ()
 Returns true if this is a midi start event.
bool isMidiContinue () const throw ()
 Returns true if this is a midi continue event.
bool isMidiStop () const throw ()
 Returns true if this is a midi stop event.
bool isMidiClock () const throw ()
 Returns true if this is a midi clock event.
bool isSongPositionPointer () const throw ()
 Returns true if this is a song-position-pointer message.
int getSongPositionPointerMidiBeat () const throw ()
 Returns the midi beat-number of a song-position-pointer message.
bool isQuarterFrame () const throw ()
 Returns true if this is a quarter-frame midi timecode message.
int getQuarterFrameSequenceNumber () const throw ()
 Returns the sequence number of a quarter-frame midi timecode message.
int getQuarterFrameValue () const throw ()
 Returns the value from a quarter-frame message.
bool isFullFrame () const throw ()
 Returns true if this is a full-frame midi timecode message.
void getFullFrameParameters (int &hours, int &minutes, int &seconds, int &frames, SmpteTimecodeType &timecodeType) const throw ()
 Extracts the timecode information from a full-frame midi timecode message.
bool isMidiMachineControlMessage () const throw ()
 Checks whether this is an MMC message.
MidiMachineControlCommand getMidiMachineControlCommand () const throw ()
 For an MMC message, this returns its type.
bool isMidiMachineControlGoto (int &hours, int &minutes, int &seconds, int &frames) const throw ()
 Checks whether this is an MMC "goto" message.

Static Public Member Functions

static const MidiMessage noteOn (const int channel, const int noteNumber, const float velocity) throw ()
 Creates a key-down message (using a floating-point velocity).
static const MidiMessage noteOn (const int channel, const int noteNumber, const uint8 velocity) throw ()
 Creates a key-down message (using an integer velocity).
static const MidiMessage noteOff (const int channel, const int noteNumber) throw ()
 Creates a key-up message.
static const MidiMessage programChange (const int channel, const int programNumber) throw ()
 Creates a program-change message.
static const MidiMessage pitchWheel (const int channel, const int position) throw ()
 Creates a pitch-wheel move message.
static const MidiMessage aftertouchChange (const int channel, const int noteNumber, const int aftertouchAmount) throw ()
 Creates an aftertouch message.
static const MidiMessage channelPressureChange (const int channel, const int pressure) throw ()
 Creates a channel-pressure change event.
static const MidiMessage controllerEvent (const int channel, const int controllerType, const int value) throw ()
 Creates a controller message.
static const MidiMessage allNotesOff (const int channel) throw ()
 Creates an all-notes-off message.
static const MidiMessage allSoundOff (const int channel) throw ()
 Creates an all-sound-off message.
static const MidiMessage allControllersOff (const int channel) throw ()
 Creates an all-controllers-off message.
static const MidiMessage endOfTrack () throw ()
 Creates an end-of-track meta-event.
static const MidiMessage tempoMetaEvent (const int microsecondsPerQuarterNote) throw ()
 Creates a tempo meta-event.
static const MidiMessage timeSignatureMetaEvent (const int numerator, const int denominator) throw ()
 Creates a time-signature meta-event.
static const MidiMessage midiChannelMetaEvent (const int channel) throw ()
 Creates a midi channel meta-event.
static const MidiMessage midiStart () throw ()
 Creates a midi start event.
static const MidiMessage midiContinue () throw ()
 Creates a midi continue event.
static const MidiMessage midiStop () throw ()
 Creates a midi stop event.
static const MidiMessage midiClock () throw ()
 Creates a midi clock event.
static const MidiMessage songPositionPointer (const int positionInMidiBeats) throw ()
 Creates a song-position-pointer message.
static const MidiMessage quarterFrame (const int sequenceNumber, const int value) throw ()
 Creates a quarter-frame MTC message.
static const MidiMessage fullFrame (const int hours, const int minutes, const int seconds, const int frames, SmpteTimecodeType timecodeType)
 Creates a full-frame MTC message.
static const MidiMessage midiMachineControlCommand (MidiMachineControlCommand command)
 Creates an MMC message.
static const MidiMessage midiMachineControlGoto (int hours, int minutes, int seconds, int frames)
 Creates an MMC "goto" message.
static const MidiMessage masterVolume (const float volume) throw ()
 Creates a master-volume change message.
static const MidiMessage createSysExMessage (const uint8 *sysexData, const int dataSize) throw ()
 Creates a system-exclusive message.
static int readVariableLengthVal (const uint8 *data, int &numBytesUsed) throw ()
 Reads a midi variable-length integer.
static int getMessageLengthFromFirstByte (const uint8 firstByte) throw ()
 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).
static const String getMidiNoteName (int noteNumber, bool useSharps, bool includeOctaveNumber, int octaveNumForMiddleC) throw ()
 Returns the name of a midi note number.
static const double getMidiNoteInHertz (int noteNumber) throw ()
 Returns the frequency of a midi note number.
static const String getGMInstrumentName (int midiInstrumentNumber) throw ()
 Returns the standard name of a GM instrument.
static const String getGMInstrumentBankName (int midiBankNumber) throw ()
 Returns the name of a bank of GM instruments.
static const String getRhythmInstrumentName (int midiNoteNumber) throw ()
 Returns the standard name of a channel 10 percussion sound.
static const String getControllerName (int controllerNumber) throw ()
 Returns the name of a controller type number.


Detailed Description

Encapsulates a MIDI message.

See also:
MidiMessageSequence, MidiOutput, MidiInput

Member Enumeration Documentation

SMPTE timecode types.

Used by the getFullFrameParameters() and fullFrame() methods.

Enumerator:
fps24 
fps25 
fps30drop 
fps30 

Types of MMC command.

See also:
isMidiMachineControlMessage, getMidiMachineControlCommand, midiMachineControlCommand
Enumerator:
mmc_stop 
mmc_play 
mmc_deferredplay 
mmc_fastforward 
mmc_rewind 
mmc_recordStart 
mmc_recordStop 
mmc_pause 


Constructor & Destructor Documentation

MidiMessage::MidiMessage ( const int  byte1,
const int  byte2,
const int  byte3,
const double  timeStamp = 0 
) throw ()

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

MidiMessage::MidiMessage ( const int  byte1,
const int  byte2,
const double  timeStamp = 0 
) throw ()

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

MidiMessage::MidiMessage ( const int  byte1,
const double  timeStamp = 0 
) throw ()

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

MidiMessage::MidiMessage ( const uint8 *const   data,
const int  dataSize,
const double  timeStamp = 0 
) throw ()

Creates a midi message from a block of data.

MidiMessage::MidiMessage ( const uint8 data,
int  size,
int &  numBytesUsed,
uint8  lastStatusByte,
double  timeStamp = 0 
) throw ()

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
size 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

MidiMessage::MidiMessage ( const MidiMessage other  )  throw ()

Creates a copy of another midi message.

MidiMessage::MidiMessage ( const MidiMessage other,
const double  newTimeStamp 
) throw ()

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

MidiMessage::~MidiMessage (  )  throw ()

Destructor.


Member Function Documentation

const MidiMessage& MidiMessage::operator= ( const MidiMessage other  )  throw ()

Copies this message from another one.

uint8* MidiMessage::getRawData (  )  const throw ()

Returns a pointer to the raw midi data.

See also:
getRawDataSize

int MidiMessage::getRawDataSize (  )  const throw ()

Returns the number of bytes of data in the message.

See also:
getRawData

double MidiMessage::getTimeStamp (  )  const throw ()

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

void MidiMessage::setTimeStamp ( const double  newTimestamp  )  throw ()

Changes the message's associated timestamp.

The units for the timestamp will be application-specific - see the notes for getTimeStamp().

See also:
addToTimeStamp, getTimeStamp

void MidiMessage::addToTimeStamp ( const double  delta  )  throw ()

Adds a value to the message's timestamp.

The units for the timestamp will be application-specific.

int MidiMessage::getChannel (  )  const throw ()

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

bool MidiMessage::isForChannel ( const int  channelNumber  )  const throw ()

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

void MidiMessage::setChannel ( const int  newChannelNumber  )  throw ()

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

bool MidiMessage::isSysEx (  )  const throw ()

Returns true if this is a system-exclusive message.

const uint8* MidiMessage::getSysExData (  )  const throw ()

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

int MidiMessage::getSysExDataSize (  )  const throw ()

Returns the size of the sysex data.

This value excludes the 0xf0 header byte and the 0xf7 at the end.

See also:
getSysExData

bool MidiMessage::isNoteOn (  )  const throw ()

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

This will return false for a note-on event with a velocity of 0.

See also:
isNoteOff, getNoteNumber, getVelocity, noteOn

static const MidiMessage MidiMessage::noteOn ( const int  channel,
const int  noteNumber,
const float  velocity 
) throw () [static]

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

static const MidiMessage MidiMessage::noteOn ( const int  channel,
const int  noteNumber,
const uint8  velocity 
) throw () [static]

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

bool MidiMessage::isNoteOff (  )  const throw ()

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

This will also return true for a note-on event with a velocity of 0.

See also:
isNoteOn, getNoteNumber, getVelocity, noteOff

static const MidiMessage MidiMessage::noteOff ( const int  channel,
const int  noteNumber 
) throw () [static]

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

bool MidiMessage::isNoteOnOrOff (  )  const throw ()

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

See also:
isNoteOn, isNoteOff

int MidiMessage::getNoteNumber (  )  const throw ()

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 will be meaningless.

See also:
isNoteOff, getMidiNoteName, getMidiNoteInHertz, setNoteNumber

void MidiMessage::setNoteNumber ( const int  newNoteNumber  )  throw ()

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.

uint8 MidiMessage::getVelocity (  )  const throw ()

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

float MidiMessage::getFloatVelocity (  )  const throw ()

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

void MidiMessage::setVelocity ( const float  newVelocity  )  throw ()

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

void MidiMessage::multiplyVelocity ( const float  scaleFactor  )  throw ()

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

bool MidiMessage::isProgramChange (  )  const throw ()

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

See also:
getProgramChangeNumber, getGMInstrumentName

int MidiMessage::getProgramChangeNumber (  )  const throw ()

Returns the new program number of a program change message.

If the message isn't a program change, the value returned will be nonsense.

See also:
isProgramChange, getGMInstrumentName

static const MidiMessage MidiMessage::programChange ( const int  channel,
const int  programNumber 
) throw () [static]

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

bool MidiMessage::isPitchWheel (  )  const throw ()

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

See also:
getPitchWheelValue, pitchWheel

int MidiMessage::getPitchWheelValue (  )  const throw ()

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

static const MidiMessage MidiMessage::pitchWheel ( const int  channel,
const int  position 
) throw () [static]

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

bool MidiMessage::isAftertouch (  )  const throw ()

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

int MidiMessage::getAfterTouchValue (  )  const throw ()

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

static const MidiMessage MidiMessage::aftertouchChange ( const int  channel,
const int  noteNumber,
const int  aftertouchAmount 
) throw () [static]

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

bool MidiMessage::isChannelPressure (  )  const throw ()

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

int MidiMessage::getChannelPressureValue (  )  const throw ()

Returns the pressure from a channel pressure change message.

Returns:
the pressure, in the range 0 to 127
See also:
isChannelPressure, channelPressureChange

static const MidiMessage MidiMessage::channelPressureChange ( const int  channel,
const int  pressure 
) throw () [static]

Creates a channel-pressure change event.

Parameters:
channel the midi channel: 1 to 16
pressure the pressure, 0 to 127
See also:
isChannelPressure

bool MidiMessage::isController (  )  const throw ()

Returns true if this is a midi controller message.

See also:
getControllerNumber, getControllerValue, controllerEvent

int MidiMessage::getControllerNumber (  )  const throw ()

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

int MidiMessage::getControllerValue (  )  const throw ()

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

static const MidiMessage MidiMessage::controllerEvent ( const int  channel,
const int  controllerType,
const int  value 
) throw () [static]

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

bool MidiMessage::isAllNotesOff (  )  const throw ()

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

See also:
allNotesOff

bool MidiMessage::isAllSoundOff (  )  const throw ()

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

See also:
allSoundOff

static const MidiMessage MidiMessage::allNotesOff ( const int  channel  )  throw () [static]

Creates an all-notes-off message.

Parameters:
channel the midi channel, in the range 1 to 16
See also:
isAllNotesOff

static const MidiMessage MidiMessage::allSoundOff ( const int  channel  )  throw () [static]

Creates an all-sound-off message.

Parameters:
channel the midi channel, in the range 1 to 16
See also:
isAllSoundOff

static const MidiMessage MidiMessage::allControllersOff ( const int  channel  )  throw () [static]

Creates an all-controllers-off message.

Parameters:
channel the midi channel, in the range 1 to 16

bool MidiMessage::isMetaEvent (  )  const throw ()

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

int MidiMessage::getMetaEventType (  )  const throw ()

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

const uint8* MidiMessage::getMetaEventData (  )  const throw ()

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

See also:
isMetaEvent, getMetaEventLength

int MidiMessage::getMetaEventLength (  )  const throw ()

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

See also:
isMetaEvent, getMetaEventData

bool MidiMessage::isTrackMetaEvent (  )  const throw ()

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

bool MidiMessage::isEndOfTrackMetaEvent (  )  const throw ()

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

static const MidiMessage MidiMessage::endOfTrack (  )  throw () [static]

Creates an end-of-track meta-event.

See also:
isEndOfTrackMetaEvent

bool MidiMessage::isTrackNameEvent (  )  const throw ()

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

You can use the getTextFromTextMetaEvent() method to get the track's name.

bool MidiMessage::isTextMetaEvent (  )  const throw ()

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

See also:
getTextFromTextMetaEvent

const String MidiMessage::getTextFromTextMetaEvent (  )  const throw ()

Returns the text from a text meta-event.

See also:
isTextMetaEvent

bool MidiMessage::isTempoMetaEvent (  )  const throw ()

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

See also:
getTempoMetaEventTickLength, getTempoSecondsPerQuarterNote

double MidiMessage::getTempoMetaEventTickLength ( const short  timeFormat  )  const throw ()

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

double MidiMessage::getTempoSecondsPerQuarterNote (  )  const throw ()

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

See also:
isTempoMetaEvent, getTempoMetaEventTickLength

static const MidiMessage MidiMessage::tempoMetaEvent ( const int  microsecondsPerQuarterNote  )  throw () [static]

Creates a tempo meta-event.

See also:
isTempoMetaEvent

bool MidiMessage::isTimeSignatureMetaEvent (  )  const throw ()

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

See also:
getTimeSignatureInfo

void MidiMessage::getTimeSignatureInfo ( int &  numerator,
int &  denominator 
) const throw ()

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

See also:
isTimeSignatureMetaEvent

static const MidiMessage MidiMessage::timeSignatureMetaEvent ( const int  numerator,
const int  denominator 
) throw () [static]

Creates a time-signature meta-event.

See also:
isTimeSignatureMetaEvent

bool MidiMessage::isKeySignatureMetaEvent (  )  const throw ()

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

See also:
getKeySignatureNumberOfSharpsOrFlats

int MidiMessage::getKeySignatureNumberOfSharpsOrFlats (  )  const throw ()

Returns the key from a key-signature meta-event.

See also:
isKeySignatureMetaEvent

bool MidiMessage::isMidiChannelMetaEvent (  )  const throw ()

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

int MidiMessage::getMidiChannelMetaEventChannel (  )  const throw ()

Returns the channel number from a channel meta-event.

Returns:
the channel, in the range 1 to 16.
See also:
isMidiChannelMetaEvent

static const MidiMessage MidiMessage::midiChannelMetaEvent ( const int  channel  )  throw () [static]

Creates a midi channel meta-event.

Parameters:
channel the midi channel, in the range 1 to 16
See also:
isMidiChannelMetaEvent

bool MidiMessage::isActiveSense (  )  const throw ()

Returns true if this is an active-sense message.

bool MidiMessage::isMidiStart (  )  const throw ()

Returns true if this is a midi start event.

See also:
midiStart

static const MidiMessage MidiMessage::midiStart (  )  throw () [static]

Creates a midi start event.

bool MidiMessage::isMidiContinue (  )  const throw ()

Returns true if this is a midi continue event.

See also:
midiContinue

static const MidiMessage MidiMessage::midiContinue (  )  throw () [static]

Creates a midi continue event.

bool MidiMessage::isMidiStop (  )  const throw ()

Returns true if this is a midi stop event.

See also:
midiStop

static const MidiMessage MidiMessage::midiStop (  )  throw () [static]

Creates a midi stop event.

bool MidiMessage::isMidiClock (  )  const throw ()

Returns true if this is a midi clock event.

See also:
midiClock, songPositionPointer

static const MidiMessage MidiMessage::midiClock (  )  throw () [static]

Creates a midi clock event.

bool MidiMessage::isSongPositionPointer (  )  const throw ()

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

See also:
getSongPositionPointerMidiBeat, songPositionPointer

int MidiMessage::getSongPositionPointerMidiBeat (  )  const throw ()

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

See also:
isSongPositionPointer, songPositionPointer

static const MidiMessage MidiMessage::songPositionPointer ( const int  positionInMidiBeats  )  throw () [static]

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

bool MidiMessage::isQuarterFrame (  )  const throw ()

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

See also:
quarterFrame, getQuarterFrameSequenceNumber, getQuarterFrameValue

int MidiMessage::getQuarterFrameSequenceNumber (  )  const throw ()

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

int MidiMessage::getQuarterFrameValue (  )  const throw ()

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

static const MidiMessage MidiMessage::quarterFrame ( const int  sequenceNumber,
const int  value 
) throw () [static]

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

bool MidiMessage::isFullFrame (  )  const throw ()

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

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

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.

static const MidiMessage MidiMessage::fullFrame ( const int  hours,
const int  minutes,
const int  seconds,
const int  frames,
SmpteTimecodeType  timecodeType 
) [static]

Creates a full-frame MTC message.

bool MidiMessage::isMidiMachineControlMessage (  )  const throw ()

Checks whether this is an MMC message.

If it is, you can use the getMidiMachineControlCommand() to find out its type.

MidiMachineControlCommand MidiMessage::getMidiMachineControlCommand (  )  const throw ()

For an MMC message, this returns its type.

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

static const MidiMessage MidiMessage::midiMachineControlCommand ( MidiMachineControlCommand  command  )  [static]

Creates an MMC message.

bool MidiMessage::isMidiMachineControlGoto ( int &  hours,
int &  minutes,
int &  seconds,
int &  frames 
) const throw ()

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

static const MidiMessage 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

static const MidiMessage MidiMessage::masterVolume ( const float  volume  )  throw () [static]

Creates a master-volume change message.

Parameters:
volume the volume, 0 to 1.0

static const MidiMessage MidiMessage::createSysExMessage ( const uint8 sysexData,
const int  dataSize 
) throw () [static]

Creates a system-exclusive message.

The data passed in is wrapped with header and tail bytes of 0xf0 and 0xf7.

static int MidiMessage::readVariableLengthVal ( const uint8 data,
int &  numBytesUsed 
) throw () [static]

Reads a midi variable-length integer.

Parameters:
data the data to read the number from
numBytesUsed on return, this will be set to the number of bytes that were read

static int MidiMessage::getMessageLengthFromFirstByte ( const uint8  firstByte  )  throw () [static]

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.

static const String MidiMessage::getMidiNoteName ( int  noteNumber,
bool  useSharps,
bool  includeOctaveNumber,
int  octaveNumForMiddleC 
) throw () [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

static const double MidiMessage::getMidiNoteInHertz ( int  noteNumber  )  throw () [static]

Returns the frequency of a midi note number.

See also:
getMidiNoteName

static const String MidiMessage::getGMInstrumentName ( int  midiInstrumentNumber  )  throw () [static]

Returns the standard name of a GM instrument.

Parameters:
midiInstrumentNumber the program number 0 to 127
See also:
getProgramChangeNumber

static const String MidiMessage::getGMInstrumentBankName ( int  midiBankNumber  )  throw () [static]

Returns the name of a bank of GM instruments.

Parameters:
midiBankNumber the bank, 0 to 15

static const String MidiMessage::getRhythmInstrumentName ( int  midiNoteNumber  )  throw () [static]

Returns the standard name of a channel 10 percussion sound.

Parameters:
midiNoteNumber the key number, 35 to 81

static const String MidiMessage::getControllerName ( int  controllerNumber  )  throw () [static]

Returns the name of a controller type number.

See also:
getControllerNumber


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

Generated on Fri Nov 20 12:00:45 2009 for JUCE by  doxygen 1.5.9