| 1 | /* |
|---|
| 2 | * libjdkmidi-2004 C++ Class Library for MIDI |
|---|
| 3 | * |
|---|
| 4 | * Copyright (C) 2004 J.D. Koftinoff Software, Ltd. |
|---|
| 5 | * www.jdkoftinoff.com |
|---|
| 6 | * jeffk@jdkoftinoff.com |
|---|
| 7 | * |
|---|
| 8 | * *** RELEASED UNDER THE GNU GENERAL PUBLIC LICENSE (GPL) April 27, 2004 *** |
|---|
| 9 | * |
|---|
| 10 | * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | * it under the terms of the GNU General Public License as published by |
|---|
| 12 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 13 | * (at your option) any later version. |
|---|
| 14 | * |
|---|
| 15 | * This program is distributed in the hope that it will be useful, |
|---|
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 18 | * GNU General Public License for more details. |
|---|
| 19 | * |
|---|
| 20 | * You should have received a copy of the GNU General Public License |
|---|
| 21 | * along with this program; if not, write to the Free Software |
|---|
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 23 | */ |
|---|
| 24 | /* |
|---|
| 25 | ** Copyright 1986 to 1998 By J.D. Koftinoff Software, Ltd. |
|---|
| 26 | ** |
|---|
| 27 | ** All rights reserved. |
|---|
| 28 | ** |
|---|
| 29 | ** No one may duplicate this source code in any form for any reason |
|---|
| 30 | ** without the written permission given by J.D. Koftinoff Software, Ltd. |
|---|
| 31 | ** |
|---|
| 32 | */ |
|---|
| 33 | |
|---|
| 34 | #ifndef JDKMIDI_MSG_H |
|---|
| 35 | #define JDKMIDI_MSG_H |
|---|
| 36 | |
|---|
| 37 | #include "jdkmidi/midi.h" |
|---|
| 38 | #include "jdkmidi/tempo.h" |
|---|
| 39 | #include "jdkmidi/sysex.h" |
|---|
| 40 | |
|---|
| 41 | namespace jdkmidi |
|---|
| 42 | { |
|---|
| 43 | |
|---|
| 44 | class MIDIMessage; |
|---|
| 45 | class MIDIBigMessage; |
|---|
| 46 | |
|---|
| 47 | class MIDITimedMessage; |
|---|
| 48 | class MIDIDeltaTimedMessage; |
|---|
| 49 | |
|---|
| 50 | class MIDITimedBigMessage; |
|---|
| 51 | class MIDIDeltaTimedBigMessage; |
|---|
| 52 | |
|---|
| 53 | /// |
|---|
| 54 | /// The MIDIMessage class is a simple, lightweight container which can hold a single |
|---|
| 55 | /// MIDI Message that can fit within 3 bytes plus status byte. It can also hold some |
|---|
| 56 | /// non-MIDI messages, known as Meta messages like No-op, Key signature, Time Signature, etc, |
|---|
| 57 | /// which are useful for internal processing. |
|---|
| 58 | /// |
|---|
| 59 | /// This class is the base class |
|---|
| 60 | /// for a number of MIDIMessage variants, such as the MIDIBigMessage, MIDITimedMessage, |
|---|
| 61 | /// MIDITimedBigMessage, and MIDIDeltaTimedBigMessage. This could be a good candidate |
|---|
| 62 | /// for using a mix-in architecture ( see http://en.wikipedia.org/wiki/Mixin ) via |
|---|
| 63 | /// multiple inheritance, but at the time this was written in 1990, C++ compilers typically |
|---|
| 64 | /// had problems with MI. |
|---|
| 65 | /// |
|---|
| 66 | |
|---|
| 67 | class MIDIMessage |
|---|
| 68 | { |
|---|
| 69 | public: |
|---|
| 70 | |
|---|
| 71 | ///@name The Constructors and Initializing methods |
|---|
| 72 | //@{ |
|---|
| 73 | |
|---|
| 74 | MIDIMessage(); ///< Create a MIDIMessage object which holds no values. |
|---|
| 75 | |
|---|
| 76 | MIDIMessage ( const MIDIMessage &m ); ///< Copy Constructor. |
|---|
| 77 | |
|---|
| 78 | const MIDIMessage & operator = ( const MIDIMessage &m ); ///< The assignment operator. Copies the MIDIMessage value. |
|---|
| 79 | |
|---|
| 80 | void Clear(); ///< Set the MIDIMessage object to 0,0,0,0. |
|---|
| 81 | |
|---|
| 82 | void Copy ( const MIDIMessage & m ); ///< Copy the value of the specified MIDIMessage. |
|---|
| 83 | |
|---|
| 84 | //@} |
|---|
| 85 | |
|---|
| 86 | const char * MsgToText ( char *txt ) const; ///< Create a human readable ascii string describing the message. This is potentially unsafe as the 'txt' param must point to a buffer of at least 64 chars long. |
|---|
| 87 | |
|---|
| 88 | ///@name The Query methods. |
|---|
| 89 | //@{ |
|---|
| 90 | |
|---|
| 91 | char GetLength() const; ///< Get the length in bytes of the entire message. |
|---|
| 92 | |
|---|
| 93 | /// Get the status byte of the message. |
|---|
| 94 | unsigned char GetStatus() const |
|---|
| 95 | { |
|---|
| 96 | return ( unsigned char ) status; |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | /// If the message is a channel message, this method returns the MIDI channel that the message is on. |
|---|
| 100 | unsigned char GetChannel() const |
|---|
| 101 | { |
|---|
| 102 | return ( unsigned char ) ( status&0x0f ); |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | /// If the message is a channel message, this method returns the relevant top 4 bits which describe what type of channel message it is. |
|---|
| 106 | unsigned char GetType() const |
|---|
| 107 | { |
|---|
| 108 | return ( unsigned char ) ( status&0xf0 ); |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | /// If the message is some sort of meta-message, then GetMetaType returns the type byte. |
|---|
| 112 | unsigned char GetMetaType() const |
|---|
| 113 | { |
|---|
| 114 | return byte1; |
|---|
| 115 | } |
|---|
| 116 | |
|---|
| 117 | /// Access to the raw byte1 of the message |
|---|
| 118 | unsigned char GetByte1() const |
|---|
| 119 | { |
|---|
| 120 | return byte1; |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | /// Access to the raw byte2 of the message |
|---|
| 124 | unsigned char GetByte2() const |
|---|
| 125 | { |
|---|
| 126 | return byte2; |
|---|
| 127 | } |
|---|
| 128 | |
|---|
| 129 | /// Access to the raw byte3 of the message |
|---|
| 130 | unsigned char GetByte3() const |
|---|
| 131 | { |
|---|
| 132 | return byte3; |
|---|
| 133 | } |
|---|
| 134 | |
|---|
| 135 | /// If the message is a note on, note off, or poly aftertouch message, GetNote() returns the note number |
|---|
| 136 | unsigned char GetNote() const |
|---|
| 137 | { |
|---|
| 138 | return byte1; |
|---|
| 139 | } |
|---|
| 140 | |
|---|
| 141 | /// If the message is a note on, note off, or poly aftertouch message, GetVelocity() returns the velocity or pressure |
|---|
| 142 | unsigned char GetVelocity() const |
|---|
| 143 | { |
|---|
| 144 | return byte2; |
|---|
| 145 | } |
|---|
| 146 | |
|---|
| 147 | /// If the message is a channel pressure message, GetChannelPressure() returns the pressure value. |
|---|
| 148 | unsigned char GetChannelPressure() const |
|---|
| 149 | { |
|---|
| 150 | return byte1; |
|---|
| 151 | } |
|---|
| 152 | |
|---|
| 153 | /// If the message is a 7 bit program change value, GetPGValue() returns the program number. |
|---|
| 154 | unsigned char GetPGValue() const |
|---|
| 155 | { |
|---|
| 156 | return byte1; |
|---|
| 157 | } |
|---|
| 158 | |
|---|
| 159 | /// If the message is a control change message, GetController() returns the controller number. |
|---|
| 160 | unsigned char GetController() const |
|---|
| 161 | { |
|---|
| 162 | return byte1; |
|---|
| 163 | } |
|---|
| 164 | |
|---|
| 165 | /// If the message is a control change message, GetControllerValue() returns the 7 bit controller value. |
|---|
| 166 | unsigned char GetControllerValue() const |
|---|
| 167 | { |
|---|
| 168 | return byte2; |
|---|
| 169 | } |
|---|
| 170 | |
|---|
| 171 | /// If the message is a bender message, GetBenderValue() returns the signed 14 bit bender value. |
|---|
| 172 | short GetBenderValue() const; |
|---|
| 173 | |
|---|
| 174 | /// If the message is a meta-message, GetMetaValue() returns the unsigned 14 bit value attached. |
|---|
| 175 | unsigned short GetMetaValue() const; |
|---|
| 176 | |
|---|
| 177 | /// If the message is a time signature meta-message, GetTimeSigNumerator() returns the numerator of the time signature. |
|---|
| 178 | unsigned char GetTimeSigNumerator() const; |
|---|
| 179 | |
|---|
| 180 | /// If the message is a time signature meta-message, GetTimeSigDenominator() returns the denominator of the time signature. |
|---|
| 181 | unsigned char GetTimeSigDenominator() const; |
|---|
| 182 | |
|---|
| 183 | /// If the message is a key signature meta-message, GetKeySigSharpFlats() returns to standard midi file form of the key. Negative values means that many flats, positive numbers means that many sharps. |
|---|
| 184 | signed char GetKeySigSharpFlats() const; |
|---|
| 185 | |
|---|
| 186 | /// If the message is a key signature meta-message, GetKeySigMajorMinor() returns to standard midi file form of the key major/minor flag. 0 means a major key, 1 means a minor key. |
|---|
| 187 | unsigned char GetKeySigMajorMinor() const; |
|---|
| 188 | |
|---|
| 189 | /// If the message is some sort of real time channel message, IsChannelMsg() will return true. You can then call GetChannel() for more information. |
|---|
| 190 | bool IsChannelMsg() const; |
|---|
| 191 | |
|---|
| 192 | /// If the message is a note on message (but not a note on message with velocity>0), IsNoteOn() will return true. You can then call GetChannel(), GetNote() and GetVelocity() for further information. |
|---|
| 193 | bool IsNoteOn() const; |
|---|
| 194 | |
|---|
| 195 | /// If the message is a note off message or a note on message with velocity == 0, IsNoteOff() will return true. You can then call GetChannel(), GetNote() and GetVelocity() for further information. |
|---|
| 196 | bool IsNoteOff() const; |
|---|
| 197 | |
|---|
| 198 | /// If the message is a polyphonic pressure chanel message, IsPolyPressure() will return true. You can then call GetChannel(), GetNote() and GetVelocity() for further informtion. |
|---|
| 199 | bool IsPolyPressure() const; |
|---|
| 200 | |
|---|
| 201 | /// If the message is a control change message, IsControlChange() will return true. You can then call GetChannel(), GetController() and GetControllerValue() for further information. |
|---|
| 202 | bool IsControlChange() const; |
|---|
| 203 | |
|---|
| 204 | /// If the message is a program change message, IsProgramChange() will return true. You can then call GetChannel() and GetPGValue() for further information. |
|---|
| 205 | bool IsProgramChange() const; |
|---|
| 206 | |
|---|
| 207 | /// If the message is a channel pressure change message, IsChannelPressure() will return true. You can then call GetChannel() and GetChannelPressure() for further information. |
|---|
| 208 | bool IsChannelPressure() const; |
|---|
| 209 | |
|---|
| 210 | /// If the message is a bender message, IsPitchBend() will return true. You can then call GetChannel() and GetBenderValue() for further information |
|---|
| 211 | bool IsPitchBend() const; |
|---|
| 212 | |
|---|
| 213 | /// If the message is a system message (the status byte is 0xf0 or higher), IsSystemMessage() will return true. |
|---|
| 214 | bool IsSystemMessage() const; |
|---|
| 215 | |
|---|
| 216 | /// If the message is a system exclusive marker, IsSysEx() will return true. You can then call GetSysExNum() to extract a sysex id code which must be managed separately. |
|---|
| 217 | /// \note Sysex messages are not stored in the MIDIMessage object. \see MIDIBigMessage |
|---|
| 218 | bool IsSysEx() const; |
|---|
| 219 | |
|---|
| 220 | short GetSysExNum() const; |
|---|
| 221 | |
|---|
| 222 | bool IsMTC() const; |
|---|
| 223 | |
|---|
| 224 | bool IsSongPosition() const; |
|---|
| 225 | |
|---|
| 226 | bool IsSongSelect() const; |
|---|
| 227 | |
|---|
| 228 | bool IsTuneRequest() const; |
|---|
| 229 | |
|---|
| 230 | bool IsMetaEvent() const; |
|---|
| 231 | |
|---|
| 232 | bool IsTextEvent() const; |
|---|
| 233 | |
|---|
| 234 | bool IsAllNotesOff() const; |
|---|
| 235 | |
|---|
| 236 | |
|---|
| 237 | bool IsNoOp() const; |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | bool IsTempo() const; |
|---|
| 241 | |
|---|
| 242 | |
|---|
| 243 | bool IsDataEnd() const; |
|---|
| 244 | |
|---|
| 245 | |
|---|
| 246 | bool IsTimeSig() const; |
|---|
| 247 | |
|---|
| 248 | bool IsKeySig() const; |
|---|
| 249 | |
|---|
| 250 | bool IsBeatMarker() const; |
|---|
| 251 | |
|---|
| 252 | /// |
|---|
| 253 | /// GetTempo() returns the tempo value in 1/32 bpm |
|---|
| 254 | /// |
|---|
| 255 | unsigned short GetTempo32() const; |
|---|
| 256 | |
|---|
| 257 | unsigned short GetLoopNumber() const; |
|---|
| 258 | |
|---|
| 259 | //@} |
|---|
| 260 | |
|---|
| 261 | ///@name The 'Set' methods |
|---|
| 262 | //@{ |
|---|
| 263 | |
|---|
| 264 | /// Set all bits of the status byte |
|---|
| 265 | void SetStatus ( unsigned char s ) |
|---|
| 266 | { |
|---|
| 267 | status=s; |
|---|
| 268 | } |
|---|
| 269 | |
|---|
| 270 | /// set just the lower 4 bits of the status byte without changing the upper 4 bits |
|---|
| 271 | void SetChannel ( unsigned char s ) |
|---|
| 272 | { |
|---|
| 273 | status= ( unsigned char ) ( ( status&0xf0 ) |s ); |
|---|
| 274 | } |
|---|
| 275 | |
|---|
| 276 | /// set just the upper 4 bits of the status byte without changing the lower 4 bits |
|---|
| 277 | void SetType ( unsigned char s ) |
|---|
| 278 | { |
|---|
| 279 | status= ( unsigned char ) ( ( status&0x0f ) |s ); |
|---|
| 280 | } |
|---|
| 281 | |
|---|
| 282 | /// Set the value of the data byte 1 |
|---|
| 283 | void SetByte1 ( unsigned char b ) |
|---|
| 284 | { |
|---|
| 285 | byte1=b; |
|---|
| 286 | } |
|---|
| 287 | |
|---|
| 288 | /// Set the value of the data byte 2 |
|---|
| 289 | void SetByte2 ( unsigned char b ) |
|---|
| 290 | { |
|---|
| 291 | byte2=b; |
|---|
| 292 | } |
|---|
| 293 | |
|---|
| 294 | /// Set the value of the data byte 3 |
|---|
| 295 | void SetByte3 ( unsigned char b ) |
|---|
| 296 | { |
|---|
| 297 | byte3=b; |
|---|
| 298 | } |
|---|
| 299 | |
|---|
| 300 | /// Set the note number for note on, note off, and polyphonic aftertouch messages |
|---|
| 301 | void SetNote ( unsigned char n ) |
|---|
| 302 | { |
|---|
| 303 | byte1=n; |
|---|
| 304 | } |
|---|
| 305 | |
|---|
| 306 | /// Set the velocity of a note on or note off message |
|---|
| 307 | void SetVelocity ( unsigned char v ) |
|---|
| 308 | { |
|---|
| 309 | byte2=v; |
|---|
| 310 | } |
|---|
| 311 | |
|---|
| 312 | /// Set the program number of a program change message |
|---|
| 313 | void SetPGValue ( unsigned char v ) |
|---|
| 314 | { |
|---|
| 315 | byte1=v; |
|---|
| 316 | } |
|---|
| 317 | |
|---|
| 318 | /// Set the controller number of a control change message |
|---|
| 319 | void SetController ( unsigned char c ) |
|---|
| 320 | { |
|---|
| 321 | byte1=c; |
|---|
| 322 | } |
|---|
| 323 | |
|---|
| 324 | /// Set the 7 bit controller value of a control change message |
|---|
| 325 | void SetControllerValue ( unsigned char v ) |
|---|
| 326 | { |
|---|
| 327 | byte2=v; |
|---|
| 328 | } |
|---|
| 329 | |
|---|
| 330 | /// Set the signed 14 bit bender value of a pitch bend message |
|---|
| 331 | void SetBenderValue ( short v ); |
|---|
| 332 | |
|---|
| 333 | void SetMetaType ( unsigned char t ) ; |
|---|
| 334 | |
|---|
| 335 | void SetMetaValue ( unsigned short v ); |
|---|
| 336 | |
|---|
| 337 | void SetNoteOn ( unsigned char chan, unsigned char note, unsigned char vel ); |
|---|
| 338 | |
|---|
| 339 | void SetNoteOff ( unsigned char chan, unsigned char note, unsigned char vel ); |
|---|
| 340 | |
|---|
| 341 | void SetPolyPressure ( unsigned char chan, unsigned char note, unsigned char pres ); |
|---|
| 342 | |
|---|
| 343 | void SetControlChange ( unsigned char chan, unsigned char ctrl, unsigned char val ); |
|---|
| 344 | |
|---|
| 345 | void SetProgramChange ( unsigned char chan, unsigned char val ); |
|---|
| 346 | |
|---|
| 347 | void SetChannelPressure ( unsigned char chan, unsigned char val ); |
|---|
| 348 | |
|---|
| 349 | void SetPitchBend ( unsigned char chan, short val ); |
|---|
| 350 | |
|---|
| 351 | void SetPitchBend ( unsigned char chan, unsigned char low, unsigned char high ); |
|---|
| 352 | |
|---|
| 353 | void SetSysEx(); |
|---|
| 354 | |
|---|
| 355 | void SetMTC ( unsigned char field, unsigned char v ); |
|---|
| 356 | |
|---|
| 357 | void SetSongPosition ( short pos ); |
|---|
| 358 | |
|---|
| 359 | void SetSongSelect ( unsigned char sng ); |
|---|
| 360 | |
|---|
| 361 | void SetTuneRequest(); |
|---|
| 362 | |
|---|
| 363 | void SetMetaEvent ( unsigned char type, unsigned char v1, unsigned char v2 ); |
|---|
| 364 | |
|---|
| 365 | void SetMetaEvent ( unsigned char type, unsigned short v ); |
|---|
| 366 | |
|---|
| 367 | void SetAllNotesOff ( unsigned char chan, unsigned char type=C_ALL_NOTES_OFF ); |
|---|
| 368 | |
|---|
| 369 | void SetLocal ( unsigned char chan, unsigned char v ); |
|---|
| 370 | |
|---|
| 371 | void SetNoOp(); |
|---|
| 372 | |
|---|
| 373 | void SetTempo32 ( unsigned short tempo_times_32 ); |
|---|
| 374 | |
|---|
| 375 | void SetText ( unsigned short text_num, unsigned char type=META_GENERIC_TEXT ); |
|---|
| 376 | |
|---|
| 377 | void SetDataEnd(); |
|---|
| 378 | |
|---|
| 379 | void SetTimeSig ( unsigned char numerator, unsigned char denominator ); |
|---|
| 380 | |
|---|
| 381 | void SetKeySig ( signed char sharp_flats, unsigned char major_minor ); |
|---|
| 382 | |
|---|
| 383 | void SetBeatMarker(); |
|---|
| 384 | |
|---|
| 385 | //@} |
|---|
| 386 | |
|---|
| 387 | protected: |
|---|
| 388 | |
|---|
| 389 | static const char * chan_msg_name[16]; ///< Simple ascii text strings describing each channel message type (0x8X to 0xeX) |
|---|
| 390 | static const char * sys_msg_name[16]; ///< Simple ascii text strings describing each system message type (0xf0 to 0xff) |
|---|
| 391 | |
|---|
| 392 | unsigned char status; |
|---|
| 393 | unsigned char byte1; |
|---|
| 394 | unsigned char byte2; |
|---|
| 395 | unsigned char byte3; ///< byte 3 is only used for meta-events and to round out the structure size to 32 bits |
|---|
| 396 | |
|---|
| 397 | }; |
|---|
| 398 | |
|---|
| 399 | |
|---|
| 400 | /// |
|---|
| 401 | /// The MIDIBigMessage inherits from a MIDIMessage and adds the capability of storing |
|---|
| 402 | /// a dynamically allocated MIDISystemExclusive message inside in case the the message needs to |
|---|
| 403 | /// store a sysex. If it does not need to store a sysex, typically the MIDISysexExclusive is not |
|---|
| 404 | /// allocated |
|---|
| 405 | /// |
|---|
| 406 | |
|---|
| 407 | class MIDIBigMessage : public MIDIMessage |
|---|
| 408 | { |
|---|
| 409 | public: |
|---|
| 410 | |
|---|
| 411 | ///@name Constructors/assignment operators/Copiers |
|---|
| 412 | //@{ |
|---|
| 413 | |
|---|
| 414 | MIDIBigMessage(); |
|---|
| 415 | |
|---|
| 416 | MIDIBigMessage ( const MIDIBigMessage &m ); |
|---|
| 417 | |
|---|
| 418 | MIDIBigMessage ( const MIDIMessage &m ); |
|---|
| 419 | |
|---|
| 420 | const MIDIBigMessage &operator = ( const MIDIBigMessage &m ); |
|---|
| 421 | |
|---|
| 422 | const MIDIBigMessage &operator = ( const MIDIMessage &m ); |
|---|
| 423 | |
|---|
| 424 | |
|---|
| 425 | void Copy ( const MIDIBigMessage &m ); |
|---|
| 426 | |
|---|
| 427 | void Copy ( const MIDIMessage &m ); |
|---|
| 428 | |
|---|
| 429 | void CopySysEx ( const MIDISystemExclusive *e ); |
|---|
| 430 | |
|---|
| 431 | //@} |
|---|
| 432 | |
|---|
| 433 | |
|---|
| 434 | void Clear(); |
|---|
| 435 | |
|---|
| 436 | void ClearSysEx(); |
|---|
| 437 | |
|---|
| 438 | |
|---|
| 439 | /// |
|---|
| 440 | /// destructor |
|---|
| 441 | /// |
|---|
| 442 | |
|---|
| 443 | ~MIDIBigMessage(); |
|---|
| 444 | |
|---|
| 445 | |
|---|
| 446 | MIDISystemExclusive *GetSysEx(); |
|---|
| 447 | |
|---|
| 448 | const MIDISystemExclusive *GetSysEx() const; |
|---|
| 449 | |
|---|
| 450 | |
|---|
| 451 | MIDISystemExclusive *sysex; |
|---|
| 452 | }; |
|---|
| 453 | |
|---|
| 454 | |
|---|
| 455 | |
|---|
| 456 | class MIDITimedMessage : public MIDIMessage |
|---|
| 457 | { |
|---|
| 458 | public: |
|---|
| 459 | |
|---|
| 460 | // |
|---|
| 461 | // Constructors |
|---|
| 462 | // |
|---|
| 463 | |
|---|
| 464 | MIDITimedMessage(); |
|---|
| 465 | |
|---|
| 466 | MIDITimedMessage ( const MIDITimedMessage &m ); |
|---|
| 467 | |
|---|
| 468 | MIDITimedMessage ( const MIDIMessage &m ); |
|---|
| 469 | |
|---|
| 470 | void Clear(); |
|---|
| 471 | |
|---|
| 472 | void Copy ( const MIDITimedMessage &m ); |
|---|
| 473 | |
|---|
| 474 | // |
|---|
| 475 | // operator = |
|---|
| 476 | // |
|---|
| 477 | |
|---|
| 478 | const MIDITimedMessage &operator = ( const MIDITimedMessage & m ); |
|---|
| 479 | |
|---|
| 480 | const MIDITimedMessage &operator = ( const MIDIMessage & m ); |
|---|
| 481 | |
|---|
| 482 | // |
|---|
| 483 | // 'Get' methods |
|---|
| 484 | // |
|---|
| 485 | |
|---|
| 486 | MIDIClockTime GetTime() const; |
|---|
| 487 | |
|---|
| 488 | // |
|---|
| 489 | // 'Set' methods |
|---|
| 490 | // |
|---|
| 491 | |
|---|
| 492 | void SetTime ( MIDIClockTime t ); |
|---|
| 493 | |
|---|
| 494 | |
|---|
| 495 | // |
|---|
| 496 | // Compare method for sorting. Not just comparing time. |
|---|
| 497 | // |
|---|
| 498 | |
|---|
| 499 | static int CompareEvents ( |
|---|
| 500 | const MIDITimedMessage &a, |
|---|
| 501 | const MIDITimedMessage &b |
|---|
| 502 | ); |
|---|
| 503 | |
|---|
| 504 | protected: |
|---|
| 505 | |
|---|
| 506 | |
|---|
| 507 | MIDIClockTime time; |
|---|
| 508 | }; |
|---|
| 509 | |
|---|
| 510 | |
|---|
| 511 | |
|---|
| 512 | class MIDIDeltaTimedMessage : public MIDIMessage |
|---|
| 513 | { |
|---|
| 514 | public: |
|---|
| 515 | |
|---|
| 516 | // |
|---|
| 517 | // Constructors |
|---|
| 518 | // |
|---|
| 519 | |
|---|
| 520 | MIDIDeltaTimedMessage(); |
|---|
| 521 | |
|---|
| 522 | MIDIDeltaTimedMessage ( const MIDIDeltaTimedMessage &m ); |
|---|
| 523 | |
|---|
| 524 | MIDIDeltaTimedMessage ( const MIDIMessage &m ); |
|---|
| 525 | |
|---|
| 526 | void Clear(); |
|---|
| 527 | |
|---|
| 528 | void Copy ( const MIDIDeltaTimedMessage &m ); |
|---|
| 529 | |
|---|
| 530 | // |
|---|
| 531 | // operator = |
|---|
| 532 | // |
|---|
| 533 | |
|---|
| 534 | const MIDIDeltaTimedMessage &operator = ( const MIDIDeltaTimedMessage &m ); |
|---|
| 535 | |
|---|
| 536 | const MIDIDeltaTimedMessage &operator = ( const MIDIMessage &m ); |
|---|
| 537 | |
|---|
| 538 | // |
|---|
| 539 | // 'Get' methods |
|---|
| 540 | // |
|---|
| 541 | |
|---|
| 542 | MIDIClockTime GetDeltaTime() const; |
|---|
| 543 | |
|---|
| 544 | // |
|---|
| 545 | // 'Set' methods |
|---|
| 546 | // |
|---|
| 547 | |
|---|
| 548 | void SetDeltaTime ( MIDIClockTime t ); |
|---|
| 549 | |
|---|
| 550 | |
|---|
| 551 | protected: |
|---|
| 552 | MIDIClockTime dtime; |
|---|
| 553 | }; |
|---|
| 554 | |
|---|
| 555 | |
|---|
| 556 | |
|---|
| 557 | class MIDITimedBigMessage : public MIDIBigMessage |
|---|
| 558 | { |
|---|
| 559 | public: |
|---|
| 560 | |
|---|
| 561 | // |
|---|
| 562 | // Constructors |
|---|
| 563 | // |
|---|
| 564 | |
|---|
| 565 | MIDITimedBigMessage(); |
|---|
| 566 | |
|---|
| 567 | MIDITimedBigMessage ( const MIDITimedBigMessage &m ); |
|---|
| 568 | |
|---|
| 569 | MIDITimedBigMessage ( const MIDIBigMessage &m ); |
|---|
| 570 | |
|---|
| 571 | MIDITimedBigMessage ( const MIDITimedMessage &m ); |
|---|
| 572 | |
|---|
| 573 | MIDITimedBigMessage ( const MIDIMessage &m ); |
|---|
| 574 | |
|---|
| 575 | void Clear(); |
|---|
| 576 | |
|---|
| 577 | void Copy ( const MIDITimedBigMessage &m ); |
|---|
| 578 | |
|---|
| 579 | void Copy ( const MIDITimedMessage &m ); |
|---|
| 580 | |
|---|
| 581 | // |
|---|
| 582 | // operator = |
|---|
| 583 | // |
|---|
| 584 | |
|---|
| 585 | const MIDITimedBigMessage &operator = ( const MIDITimedBigMessage & m ); |
|---|
| 586 | |
|---|
| 587 | const MIDITimedBigMessage &operator = ( const MIDITimedMessage & m ); |
|---|
| 588 | |
|---|
| 589 | const MIDITimedBigMessage &operator = ( const MIDIMessage & m ); |
|---|
| 590 | |
|---|
| 591 | // |
|---|
| 592 | // 'Get' methods |
|---|
| 593 | // |
|---|
| 594 | |
|---|
| 595 | MIDIClockTime GetTime() const; |
|---|
| 596 | |
|---|
| 597 | // |
|---|
| 598 | // 'Set' methods |
|---|
| 599 | // |
|---|
| 600 | |
|---|
| 601 | void SetTime ( MIDIClockTime t ); |
|---|
| 602 | |
|---|
| 603 | // |
|---|
| 604 | // Compare method, for sorting. Not just comparing time. |
|---|
| 605 | // |
|---|
| 606 | |
|---|
| 607 | static int CompareEvents ( |
|---|
| 608 | const MIDITimedBigMessage &a, |
|---|
| 609 | const MIDITimedBigMessage &b |
|---|
| 610 | ); |
|---|
| 611 | |
|---|
| 612 | protected: |
|---|
| 613 | MIDIClockTime time; |
|---|
| 614 | }; |
|---|
| 615 | |
|---|
| 616 | |
|---|
| 617 | |
|---|
| 618 | class MIDIDeltaTimedBigMessage : public MIDIBigMessage |
|---|
| 619 | { |
|---|
| 620 | public: |
|---|
| 621 | // |
|---|
| 622 | // Constructors |
|---|
| 623 | // |
|---|
| 624 | |
|---|
| 625 | MIDIDeltaTimedBigMessage(); |
|---|
| 626 | |
|---|
| 627 | MIDIDeltaTimedBigMessage ( const MIDIDeltaTimedBigMessage &m ); |
|---|
| 628 | |
|---|
| 629 | MIDIDeltaTimedBigMessage ( const MIDIBigMessage &m ); |
|---|
| 630 | |
|---|
| 631 | MIDIDeltaTimedBigMessage ( const MIDIMessage &m ); |
|---|
| 632 | |
|---|
| 633 | MIDIDeltaTimedBigMessage ( const MIDIDeltaTimedMessage &m ); |
|---|
| 634 | |
|---|
| 635 | void Clear(); |
|---|
| 636 | |
|---|
| 637 | void Copy ( const MIDIDeltaTimedBigMessage &m ); |
|---|
| 638 | |
|---|
| 639 | void Copy ( const MIDIDeltaTimedMessage &m ); |
|---|
| 640 | |
|---|
| 641 | // |
|---|
| 642 | // operator = |
|---|
| 643 | // |
|---|
| 644 | |
|---|
| 645 | const MIDIDeltaTimedBigMessage &operator = ( const MIDIDeltaTimedBigMessage &m ); |
|---|
| 646 | |
|---|
| 647 | const MIDIDeltaTimedBigMessage &operator = ( const MIDIDeltaTimedMessage &m ); |
|---|
| 648 | |
|---|
| 649 | const MIDIDeltaTimedBigMessage &operator = ( const MIDIMessage &m ); |
|---|
| 650 | |
|---|
| 651 | // |
|---|
| 652 | // 'Get' methods |
|---|
| 653 | // |
|---|
| 654 | |
|---|
| 655 | MIDIClockTime GetDeltaTime() const; |
|---|
| 656 | |
|---|
| 657 | // |
|---|
| 658 | // 'Set' methods |
|---|
| 659 | // |
|---|
| 660 | |
|---|
| 661 | void SetDeltaTime ( MIDIClockTime t ); |
|---|
| 662 | |
|---|
| 663 | |
|---|
| 664 | protected: |
|---|
| 665 | MIDIClockTime dtime; |
|---|
| 666 | }; |
|---|
| 667 | |
|---|
| 668 | } |
|---|
| 669 | |
|---|
| 670 | |
|---|
| 671 | #endif |
|---|