NiCMidi 1.1.0
A MIDI library derived from J.D.Koftinoff jdksmidi
msg.h
Go to the documentation of this file.
1/*
2 * NiCMidi - A C++ Class Library for MIDI
3 *
4 * Copyright (C) 2004 J.D. Koftinoff Software, Ltd.
5 * www.jdkoftinoff.com jeffk@jdkoftinoff.com
6 * Copyright (C) 2021, 2022 Nicola Cassetta
7 * https://github.com/ncassetta/NiCMidi
8 *
9 * This file is part of NiCMidi.
10 *
11 * NiCMidi is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as
13 * published by the Free Software Foundation, either version 3 of
14 * the License, or (at your option) any later version.
15 *
16 * NiCMidi is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with NiCMidi. If not, see <http://www.gnu.org/licenses/>.
23 */
24
25
28
29
30#ifndef _NICMIDI_MSG_H
31#define _NICMIDI_MSG_H
32
33#include "midi.h"
34#include "sysex.h"
35
36#include <string>
37
38
50 public:
57 virtual ~MIDIMessage();
59 virtual void Clear();
61 void ClearSysEx();
65
68 int GetLength() const;
72 unsigned char GetStatus() const { return (unsigned char)status; }
75 unsigned char GetChannel() const { return (unsigned char)(status &0x0f); }
78 unsigned char GetType() const { return (unsigned char)(status & 0xf0); }
80 unsigned char GetMetaType() const { return byte1; }
82 unsigned char GetByte1() const { return byte1; }
84 unsigned char GetByte2() const { return byte2; }
86 unsigned char GetByte3() const { return byte3; }
88 MIDISystemExclusive* GetSysEx() { return sysex; }
90 const MIDISystemExclusive*GetSysEx() const { return sysex; }
92 unsigned char GetNote() const { return byte1; }
94 unsigned char GetVelocity() const { return byte2; }
96 unsigned char GetChannelPressure() const { return byte1; }
98 unsigned char GetProgramValue() const { return byte1; }
100 unsigned char GetController() const { return byte1; }
102 unsigned char GetControllerValue() const { return byte2; }
104 int16_t GetBenderValue() const { return (int16_t)(((byte2 << 7) | byte1) - 8192); }
106 uint16_t GetMetaValue() const { return (uint16_t)((byte3 << 8) | byte2); }
108 unsigned char GetTimeSigNumerator() const { return byte2; }
110 unsigned char GetTimeSigDenominator() const { return byte3; }
113 signed char GetKeySigSharpsFlats() const { return (signed char)byte2; }
116 unsigned char GetKeySigMode() const { return byte3; }
118 float GetTempo() const;
121 unsigned long GetInternalTempo() const;
123 std::string GetText() const;
124
127 bool IsChannelMsg() const { return (status >= 0x80) && (status < 0xf0); }
130 bool IsNoteOn() const { return ((status & 0xf0) == NOTE_ON) && byte2; }
133 bool IsNoteOff() const { return ((status & 0xf0) == NOTE_OFF) ||
134 (((status & 0xf0) == NOTE_ON) && byte2 == 0); }
136 bool IsNote() const { return IsNoteOn() || IsNoteOff(); }
139 bool IsPolyPressure() const { return ((status & 0xf0) == POLY_PRESSURE); }
144 bool IsControlChange() const { return ((status & 0xf0) == CONTROL_CHANGE) &&
145 (byte1 < C_ALL_SOUND_OFF); }
151 bool IsPanChange() const { return IsControlChange() && GetController() == C_PAN; }
154 bool IsPedalOn() const { return IsControlChange() && GetController() == C_DAMPER &&
155 GetControllerValue() & 0x40; }
158 bool IsPedalOff() const { return IsControlChange() && GetController() == C_DAMPER &&
159 !(GetControllerValue() & 0x40); }
162 bool IsProgramChange() const { return ((status & 0xf0) == PROGRAM_CHANGE); }
165 bool IsChannelPressure() const { return ((status & 0xf0) == CHANNEL_PRESSURE); }
168 bool IsPitchBend() const { return ((status & 0xf0) == PITCH_BEND); }
170 bool IsChannelMode() const { return ((status & 0xf0) == CONTROL_CHANGE) &&
171 (byte1 >= C_ALL_SOUND_OFF); }
173 bool IsAllNotesOff() const { return ((status & 0xf0) == CONTROL_CHANGE) &&
174 (byte1 == C_ALL_NOTES_OFF); }
176 bool IsSystemMessage() const { return (status & 0xf0) == 0xf0; }
178 bool IsSysEx() const { return (status == SYSEX_START); }
181 bool IsMetaEvent() const { return (status == META_EVENT); }
184 bool IsTextEvent() const { return (status == META_EVENT && byte1 >= 0x1 && byte1 <= 0xf); }
187 bool IsTrackName() const { return (IsTextEvent() && GetMetaType() == META_TRACK_NAME); }
190 bool IsMarkerText() const { return (IsTextEvent() && GetMetaType() == META_MARKER_TEXT); }
193 bool IsTempo() const { return (status == META_EVENT) && (byte1 == META_TEMPO); }
195 bool IsDataEnd() const { return (status == META_EVENT) && (byte1 == META_END_OF_TRACK); }
198 bool IsSMPTEOffset() const { return (status == META_EVENT) && (byte1 == META_SMPTE); }
201 bool IsTimeSig() const { return (status == META_EVENT) && (byte1 == META_TIMESIG); }
204 bool IsKeySig() const { return (status == META_EVENT) && (byte1 == META_KEYSIG); }
206 bool IsNoOp() const { return (status == STATUS_SERVICE) && (byte1 == NO_OP_VAL); }
209 bool IsBeatMarker() const { return (status == STATUS_SERVICE) && (byte1 == BEAT_MARKER_VAL); }
210
212 void SetStatus(unsigned char s) { status = s; }
214 void SetChannel(unsigned char s) { status = (unsigned char)((status & 0xf0) | (s & 0x0f)); }
216 void SetType(unsigned char s) { status = (unsigned char)((status & 0x0f) | (s & 0xf0)); }
218 void SetByte1(unsigned char b) { byte1 = b; }
220 void SetByte2(unsigned char b) { byte2 = b; }
222 void SetByte3(unsigned char b) { byte3 = b; }
224 void SetNote(unsigned char n) { byte1 = n; }
226 void SetVelocity(unsigned char v) { byte2 = v; }
228 void SetController(unsigned char c) { byte1 = c; }
230 void SetControllerValue(unsigned char v) { byte2 = v; }
232 void SetProgramValue(unsigned char v) { byte1 = v; }
234 void SetBenderValue(int16_t v);
236 void SetMetaType(unsigned char t) { byte1 = t; }
238 void SetMetaValue(unsigned short v);
241 void SetNoteOn(unsigned char chan, unsigned char note, unsigned char vel);
247 void SetNoteOff(unsigned char chan, unsigned char note, unsigned char vel);
250 void SetPolyPressure(unsigned char chan, unsigned char note, unsigned char pres);
253 void SetControlChange(unsigned char chan, unsigned char ctrl, unsigned char val);
256 void SetVolumeChange (unsigned char chan, unsigned char val)
257 { SetControlChange( chan, C_MAIN_VOLUME, val); }
260 void SetPanChange (unsigned char chan, unsigned char val)
261 { SetControlChange( chan, C_PAN, val); }
264 void SetProgramChange(unsigned char chan, unsigned char prog);
267 void SetChannelPressure(unsigned char chan, unsigned char pres);
270 void SetPitchBend(unsigned char chan, short val);
282 void SetChannelMode(unsigned char chan, unsigned char type, unsigned char val = 0)
283 { SetControlChange(chan, type, val); }
286 void SetAllNotesOff(unsigned char chan)
287 { SetControlChange(chan, C_ALL_NOTES_OFF, 0); }
292 void SetMTC(unsigned char field, unsigned char val);
294 void SetSongPosition(int16_t pos);
296 void SetSongSelect(unsigned char sng);
300 void SetSystemMessage(unsigned char type);
303 void SetMetaEvent(unsigned char type, unsigned char v1, unsigned char v2);
306 void SetMetaEvent(unsigned char type, unsigned short val);
311 void SetText(const char* text, unsigned char type = META_GENERIC_TEXT);
316 void SetTempo(float tempo_bpm);
319 void SetSMPTEOffset(unsigned char hour, unsigned char min, unsigned char sec,
320 unsigned char frame,unsigned char subframe);
323 void SetTimeSig(unsigned char num, unsigned char den,
324 unsigned char clocks_per_metronome = 0, unsigned char num_32_per_quarter = 8);
327 void SetKeySig(signed char sharp_flats, unsigned char major_minor)
328 { SetMetaEvent(META_KEYSIG, sharp_flats, major_minor); }
330 void SetNoOp() { Clear(); }
333
336 virtual std::string MsgToText(bool chan_from_1 = false) const;
339 void AllocateSysEx(unsigned int len);
344 friend bool operator== (const MIDIMessage &m1, const MIDIMessage &m2);
345
349 static void UseNoteOnv0ForOff(bool f) { use_note_onv0 = f; }
350
353 enum { STATUS_SERVICE = 0, // Status byte for a service (non MIDI) message
354 NO_OP_VAL = 0, // Byte 1 for a NoOp (uninitialized) message
355 BEAT_MARKER_VAL = 1 }; // Byte 1 for a beat marker message (used internally by the sequencer)
357
358 protected:
359
361 unsigned char status; // The status byte.
362 unsigned char byte1; // 1st data byte.
363 unsigned char byte2; // 2nd data byte.
364 unsigned char byte3; // 3rd data byte (only used for some meta-events).
365 MIDISystemExclusive* sysex; // The sysex pointer.
366 static bool use_note_onv0; // This flag influences the SetNoteOff() method behavior.
368};
369
370// NO NEED TO ADD A Reset MESSAGE (status = 0xff)! If you want it can use SetSystemMessage(0xff)
371
372/* ********************************************************************************************/
373/* C L A S S M I D I T i m e d M e s s a g e */
374/* ********************************************************************************************/
375
376
383 public:
384
396 virtual void Clear();
397
402
405 virtual std::string MsgToText(unsigned char chan_from_1 = 0) const;
406
408 MIDIClockTime GetTime() const { return time; }
410 void SetTime(MIDIClockTime t) { time = t; }
412 void AddTime(MIDIClockTime t) { time += t; }
414 void SubTime(MIDIClockTime t) { time = (t > time ? 0 : time - t); }
415
417 void SetNoOp() { Clear(); }
418
433
447 friend bool IsSameKind (const MIDITimedMessage &m1, const MIDITimedMessage &m2);
448
450 friend bool operator==(const MIDITimedMessage &m1, const MIDITimedMessage &m2);
451
452 protected:
453
455};
456
457#endif
Stores data representing a MIDI event message.
Definition: msg.h:49
uint16_t GetMetaValue() const
If the message is a meta-message, returns the unsigned 14 bit value attached.
Definition: msg.h:106
unsigned char GetMetaType() const
If the message is a meta-message, returns the type byte. See MIDI Enumerations for meta event types....
Definition: msg.h:80
unsigned long GetInternalTempo() const
If the message is a tempo change meta-message, returns the tempo in SMF format.
bool IsChannelPressure() const
Returns true if the message is a channel pressure message.
Definition: msg.h:165
std::string GetText() const
If the message is a text meta-message, returns the associated text as a std::string.
void SetNoOp()
The same of Clear(), makes the message an uninitialized message which will be ignored.
Definition: msg.h:330
void SetPitchBend(unsigned char chan, short val)
Makes the message a pitch bend message with given channel and value (unsigned 14 bit).
bool IsChannelMode() const
Returns true if the message is a channel mode message (a control change with control >= 0x7A).
Definition: msg.h:170
void SetVolumeChange(unsigned char chan, unsigned char val)
Makes the message a volume change (control == 0x07) message with given channel and value.
Definition: msg.h:256
static void UseNoteOnv0ForOff(bool f)
This static method determines if the SetNoteOff() method will produce a MIDI NOTE_OFF message or a NO...
Definition: msg.h:349
int16_t GetBenderValue() const
If the message is a bender message, returns the signed 14 bit bender value.
Definition: msg.h:104
bool IsNoOp() const
Returns true if the message is a NoOp (not initialized) message.
Definition: msg.h:206
unsigned char GetType() const
Returns the relevant top 4 bits of the status byte, which describe what type of channel message it is...
Definition: msg.h:78
void SetSongPosition(int16_t pos)
Makes the message a song position system message with given position (14 bits). Frees the sysex point...
bool IsTrackName() const
Returns true if the message is a track name meta-message.
Definition: msg.h:187
bool IsMarkerText() const
Returns true if the message is a marker text meta-message.
Definition: msg.h:190
bool IsNoteOn() const
Returns true if the message is a note on message (status == NOTE_ON and velocity > 0).
Definition: msg.h:130
bool IsTimeSig() const
Returns true if the message is a time Signature meta-message.
Definition: msg.h:201
void SetTimeSig(unsigned char num, unsigned char den, unsigned char clocks_per_metronome=0, unsigned char num_32_per_quarter=8)
Makes the message a time signature meta-message with given time (numerator and denominator).
virtual std::string MsgToText(bool chan_from_1=false) const
Returns a human readable ascii string describing the message content.
bool IsPedalOff() const
Returns true if the message is a pedal off message (control == 0x40 and value < 0x64).
Definition: msg.h:158
bool IsProgramChange() const
Returns true if the message is a program change message.
Definition: msg.h:162
unsigned char GetByte2() const
Returns the raw value of the data byte 2 of the message.
Definition: msg.h:84
void SetTempo(float tempo_bpm)
Makes the message a tempo change meta-message with given tempo (in bpm).
void SetVelocity(unsigned char v)
Sets the velocity for note on, note off and polyphonic aftertouch messages.
Definition: msg.h:226
void SetSMPTEOffset(unsigned char hour, unsigned char min, unsigned char sec, unsigned char frame, unsigned char subframe)
Makes the message a SMPTE offset meta-message with given data.
void SetController(unsigned char c)
Sets the controller number for a control change message.
Definition: msg.h:228
bool IsSMPTEOffset() const
Returns true if the message is a SMPTE offset meta-message.
Definition: msg.h:198
void SetMetaValue(unsigned short v)
Sets the meta value for a meta-event message.
float GetTempo() const
If the message is a tempo change meta-message, returns the tempo value in bpm.
void SetByte3(unsigned char b)
Sets the raw value of the data byte 3 of the message.
Definition: msg.h:222
void SetNoteOff(unsigned char chan, unsigned char note, unsigned char vel)
Makes the message a note off message with given channel, note and velocity.
void SetBenderValue(int16_t v)
Sets the bender value (a signed 14 bit value) for a bender message.
bool IsPolyPressure() const
Returns true if the message is a polyphonic pressure channel message.
Definition: msg.h:139
unsigned char GetChannelPressure() const
If the message is a channel pressure message, returns the pressure value.
Definition: msg.h:96
bool IsPanChange() const
Returns true if the message is a pan change message (control == 0x0A).
Definition: msg.h:151
unsigned char GetVelocity() const
If the message is a note on, note off, or poly aftertouch message, returns the note velocity (or pres...
Definition: msg.h:94
void SetControlChange(unsigned char chan, unsigned char ctrl, unsigned char val)
Makes the message a control change message with given channel, controller and value.
void SetSysEx(const MIDISystemExclusive *se)
Makes the message a system exclusive message with given MIDISystemExclusive object.
MIDISystemExclusive * GetSysEx()
Returns a pointer to the MIDISystemExclusive object (0 if it is not allocated).
Definition: msg.h:88
unsigned char GetChannel() const
If the message is a channel message, returns its MIDI channel.
Definition: msg.h:75
MIDIMessage()
Creates a a NoOp MIDIMessage (an undefined MIDI message, which will be ignored when playing).
friend bool operator==(const MIDIMessage &m1, const MIDIMessage &m2)
The compare operator executes a bitwise comparison.
signed char GetKeySigSharpsFlats() const
If the message is a key signature meta-message, returns the key in SMF format.
Definition: msg.h:113
virtual ~MIDIMessage()
The destructor.
bool IsKeySig() const
Returns true if the message is a key signature meta-message.
Definition: msg.h:204
void AllocateSysEx(unsigned int len)
Allocates a MIDISystemExclusive object, with a buffer of given max size.
bool IsMetaEvent() const
Returns true if the message is a meta event message.
Definition: msg.h:181
void SetMetaEvent(unsigned char type, unsigned short val)
Makes the message a meta-message with given type and data value.
unsigned char GetNote() const
If the message is a note on, note off, or poly aftertouch message, returns the note number.
Definition: msg.h:92
MIDIMessage(const MIDIMessage &msg)
The copy constructor.
unsigned char GetStatus() const
Returns the status byte of the message.
Definition: msg.h:72
void SetSystemMessage(unsigned char type)
Makes the message a one-byte system message with given status (type must be a valid MIDI system messa...
bool IsNoteOff() const
Returns true if the message is a note off message (status == NOTE_OFF or status == NOTE_ON and veloci...
Definition: msg.h:133
bool IsDataEnd() const
Returns true if the message is a data end (i.e. end of track) meta-message.
Definition: msg.h:195
bool IsChannelMsg() const
Returns true if the message is some sort of channel message.
Definition: msg.h:127
void SetProgramChange(unsigned char chan, unsigned char prog)
Makes the message a program change message with given channel and program.
void SetByte1(unsigned char b)
Sets the raw value of the data byte 1 of the message.
Definition: msg.h:218
void SetPolyPressure(unsigned char chan, unsigned char note, unsigned char pres)
Makes the message a polyphonic aftertouch message with given channel, note and pressure.
void SetMetaEvent(unsigned char type, unsigned char v1, unsigned char v2)
Makes the message a meta-message with given type and data value.
unsigned char GetController() const
If the message is a control change message, returns the controller number.
Definition: msg.h:100
void SetPanChange(unsigned char chan, unsigned char val)
Makes the message a pan change (control == 0x0A) message with given channel and value.
Definition: msg.h:260
bool IsAllNotesOff() const
Returns true if the message is a all notes off message.
Definition: msg.h:173
virtual void Clear()
Resets the message and frees the MIDISystemExclusive pointer; the message becomes a NoOp.
bool IsPitchBend() const
Returns true if the message is a bender message.
Definition: msg.h:168
unsigned char GetProgramValue() const
If the message is a program change (patch) message, returns the program number.
Definition: msg.h:98
const MIDIMessage & operator=(const MIDIMessage &msg)
The assignment operator.
void SetProgramValue(unsigned char v)
Sets the program number for a program change message.
Definition: msg.h:232
bool IsSystemMessage() const
Returns true if the message is a system message (the status byte is 0xf0 or higher).
Definition: msg.h:176
void SetChannelPressure(unsigned char chan, unsigned char pres)
Makes the message a channel pressure message with given channel and pressure.
void CopySysEx(const MIDISystemExclusive *se)
Copies the given MIDISystemExclusive object into the message without changing other bytes.
void SetMTC(unsigned char field, unsigned char val)
Makes the message a MIDI time code message with given field (3 bits) and value (4 bits)....
bool IsNote() const
Returns true if the message is a note on or a note off message.
Definition: msg.h:136
void SetControllerValue(unsigned char v)
Sets the controller value for a control change message.
Definition: msg.h:230
unsigned char GetByte3() const
Returns the raw value of the data byte 3 of the message.
Definition: msg.h:86
unsigned char GetTimeSigNumerator() const
If the message is a time signature meta-message, returns the numerator of the time signature.
Definition: msg.h:108
void SetNoteOn(unsigned char chan, unsigned char note, unsigned char vel)
Makes the message a note on message with given channel, note and velocity.
void SetStatus(unsigned char s)
Sets all 8 bits of the status byte of the message. These define, for channel messages,...
Definition: msg.h:212
const MIDISystemExclusive * GetSysEx() const
Returns a pointer to the MIDISystemExclusive object (0 if it is not allocated).
Definition: msg.h:90
void SetType(unsigned char s)
Sets the upper 4 bits of the status byte without changing the lower 4 bits.
Definition: msg.h:216
void ClearSysEx()
Frees the MIDISystemExclusive pointer without changing other bytes.
bool IsPedalOn() const
Returns true if the message is a pedal on message (control == 0x40 and value >= 0x64).
Definition: msg.h:154
void SetNote(unsigned char n)
Sets the note number for note on, note off, and polyphonic aftertouch messages.
Definition: msg.h:224
bool IsTextEvent() const
Returns true if the message is a text message (a subset of meta events).
Definition: msg.h:184
bool IsControlChange() const
Returns true if the message is a control change message.
Definition: msg.h:144
void SetSongSelect(unsigned char sng)
Makes the message a song select system message with given song. Frees the sysex pointer.
int GetLength() const
Returns the length in bytes of the entire message.
bool IsSysEx() const
Returns true if the message is a system exclusive message.
Definition: msg.h:178
void SetMetaType(unsigned char t)
Sets the meta message type for a meta-event message.
Definition: msg.h:236
bool IsVolumeChange() const
Returns true if the message is a volume change message (control == 0x07).
Definition: msg.h:148
void SetChannelMode(unsigned char chan, unsigned char type, unsigned char val=0)
Makes the message a channel mode message (i.e.
Definition: msg.h:282
void SetText(const char *text, unsigned char type=META_GENERIC_TEXT)
Makes the message a text meta-message with given type.
void SetBeatMarker()
Makes the message a beat marker internal service message.
bool IsTempo() const
Returns true if the message is a tempo change meta-message.
Definition: msg.h:193
void SetDataEnd()
Makes the message a data end (i.e. end of track) meta-message.
Definition: msg.h:313
unsigned char GetByte1() const
Returns the raw value of the data byte 1 of the message.
Definition: msg.h:82
void SetKeySig(signed char sharp_flats, unsigned char major_minor)
Makes the message a key signature meta-message with given accidents and mode.
Definition: msg.h:327
bool IsBeatMarker() const
Returns true if the message is a beat marker message.
Definition: msg.h:209
void SetAllNotesOff(unsigned char chan)
Makes the message a all notes off message with given channel.
Definition: msg.h:286
unsigned char GetKeySigMode() const
If the message is a key signature meta-message, returns major/minor SMF flag.
Definition: msg.h:116
void SetByte2(unsigned char b)
Sets the raw value of the data byte 2 of the message.
Definition: msg.h:220
void SetChannel(unsigned char s)
Sets the lower 4 bits of the status byte without changing the upper 4 bits. See Numbering conventions...
Definition: msg.h:214
unsigned char GetControllerValue() const
If the message is a control change message, returns the controller value.
Definition: msg.h:102
unsigned char GetTimeSigDenominator() const
If the message is a time signature meta-message, returns the denominator of the time signature.
Definition: msg.h:110
Stores a buffer of MIDI data bytes in a std::vector, plus a byte for the checksum.
Definition: sysex.h:45
The MIDITimedMessage class inherits from the MIDIMessage and represents a message associated with a s...
Definition: msg.h:382
friend bool IsSameKind(const MIDITimedMessage &m1, const MIDITimedMessage &m2)
Used by methods that search and insert events in a MIDITrack to find events that are of the same kind...
~MIDITimedMessage()
Destructor.
virtual void Clear()
Resets the message, frees the MIDISystemExclusive pointer and sets the time to 0.
MIDIClockTime time
The time of the event.
Definition: msg.h:454
friend bool operator==(const MIDITimedMessage &m1, const MIDITimedMessage &m2)
The equal operator. It compares the messages bitwise.
MIDITimedMessage()
Creates a a NoOp MIDITimedMessage with the time set to 0.
friend int CompareEventsForInsert(const MIDITimedMessage &m1, const MIDITimedMessage &m2)
Used by the MIDITrack::InsertEvent() and MIDITrack::InsertNote() methods for ordering events when ins...
void SetNoOp()
The same of Clear(), makes the message an undefined message which will be ignored.
Definition: msg.h:417
MIDIClockTime GetTime() const
Returns the MIDIClockTime associated with the message.
Definition: msg.h:408
void SetTime(MIDIClockTime t)
Sets the MIDIClockTime associated with the message.
Definition: msg.h:410
void AddTime(MIDIClockTime t)
Adds the given amount to the associated time.
Definition: msg.h:412
MIDITimedMessage(const MIDIMessage &msg)
Copy constructor (sets the time to 0).
const MIDITimedMessage & operator=(const MIDITimedMessage &msg)
Assignment operator.
MIDITimedMessage(const MIDITimedMessage &msg)
Copy constructor.
virtual std::string MsgToText(unsigned char chan_from_1=0) const
Returns a human readable ascii string describing the message content.
void SubTime(MIDIClockTime t)
Subtracts the given amount from the associated time (if t is greater set the time to 0).
Definition: msg.h:414
unsigned long MIDIClockTime
The type of a variable which can hold a time in MIDI ticks.
Definition: midi.h:40
@ META_MARKER_TEXT
Text: marker.
Definition: midi.h:220
@ META_SMPTE
Specifies the initial SMPTE offset of the beginning of playback. It has 5 data bytes (stored in the s...
Definition: midi.h:246
@ META_END_OF_TRACK
The end of track marker in a MIDI file (also used in the MIDITrack object). The data length is 0 byte...
Definition: midi.h:239
@ META_TEMPO
Specifies a tempo change and has a length of 3 bytes. The data is a 3-byte integer,...
Definition: midi.h:243
@ META_KEYSIG
Specifies a musical key signature change. It has 2 data bytes: the 1st is a signed char denoting the ...
Definition: midi.h:256
@ META_TIMESIG
Specifies a musical time signature change. It has 4 data bytes (stored in the sysex object) which den...
Definition: midi.h:252
@ META_TRACK_NAME
Text: track name.
Definition: midi.h:217
@ META_GENERIC_TEXT
This and the following are used for embedding ascii text in a MIDI file. They have variable data leng...
Definition: midi.h:215
@ C_ALL_NOTES_OFF
all notes off
Definition: midi.h:180
@ C_DAMPER
hold pedal (sustain)
Definition: midi.h:152
@ C_ALL_SOUND_OFF
all sound off
Definition: midi.h:177
@ C_MAIN_VOLUME
main volume control
Definition: midi.h:143
@ C_PAN
panpot stereo control
Definition: midi.h:145
@ PROGRAM_CHANGE
Program (patch) change.
Definition: midi.h:98
@ PITCH_BEND
Pitch bend.
Definition: midi.h:100
@ META_EVENT
Meta event.
Definition: midi.h:108
@ CONTROL_CHANGE
Control change.
Definition: midi.h:97
@ CHANNEL_PRESSURE
Channel (afertouch) pressure.
Definition: midi.h:99
@ NOTE_ON
Note on.
Definition: midi.h:95
@ NOTE_OFF
Note off.
Definition: midi.h:94
@ SYSEX_START
Start of a sysex.
Definition: midi.h:101
@ POLY_PRESSURE
Polyphonic (aftertouch) pressure.
Definition: midi.h:96
Contains the MIDI values enumerations (to have readable values instead of hexadecimal values) and som...
Contains the definition of the class MIDISystemExclusive.