#include <msg.h>
Inheritance diagram for jdkmidi::MIDIMessage:

Public Member Functions | |
| MIDIMessage () | |
| MIDIMessage (const MIDIMessage &m) | |
| void | Clear () |
| void | Copy (const MIDIMessage &m) |
| char * | MsgToText (char *txt) const |
| const MIDIMessage & | operator= (const MIDIMessage &m) |
| char | GetLength () const |
| unsigned char | GetStatus () const |
| unsigned char | GetChannel () const |
| unsigned char | GetType () const |
| unsigned char | GetMetaType () const |
| unsigned char | GetByte1 () const |
| unsigned char | GetByte2 () const |
| unsigned char | GetByte3 () const |
| unsigned char | GetNote () const |
| unsigned char | GetVelocity () const |
| unsigned char | GetPGValue () const |
| unsigned char | GetController () const |
| unsigned char | GetControllerValue () const |
| short | GetBenderValue () const |
| unsigned short | GetMetaValue () const |
| unsigned char | GetTimeSigNumerator () const |
| unsigned char | GetTimeSigDenominator () const |
| signed char | GetKeySigSharpFlats () const |
| unsigned char | GetKeySigMajorMinor () const |
| bool | IsChannelMsg () const |
| bool | IsNoteOn () const |
| bool | IsNoteOff () const |
| bool | IsPolyPressure () const |
| bool | IsControlChange () const |
| bool | IsProgramChange () const |
| bool | IsChannelPressure () const |
| bool | IsPitchBend () const |
| bool | IsSystemMessage () const |
| bool | IsSysEx () const |
| short | GetSysExNum () const |
| bool | IsMTC () const |
| bool | IsSongPosition () const |
| bool | IsSongSelect () const |
| bool | IsTuneRequest () const |
| bool | IsMetaEvent () const |
| bool | IsTextEvent () const |
| bool | IsAllNotesOff () const |
| bool | IsNoOp () const |
| bool | IsTempo () const |
| bool | IsDataEnd () const |
| bool | IsTimeSig () const |
| bool | IsKeySig () const |
| bool | IsBeatMarker () const |
| unsigned short | GetTempo32 () const |
| unsigned short | GetLoopNumber () const |
| void | SetStatus (unsigned char s) |
| void | SetChannel (unsigned char s) |
| void | SetType (unsigned char s) |
| void | SetByte1 (unsigned char b) |
| void | SetByte2 (unsigned char b) |
| void | SetByte3 (unsigned char b) |
| void | SetNote (unsigned char n) |
| void | SetVelocity (unsigned char v) |
| void | SetPGValue (unsigned char v) |
| void | SetController (unsigned char c) |
| void | SetControllerValue (unsigned char v) |
| void | SetBenderValue (short v) |
| void | SetMetaType (unsigned char t) |
| void | SetMetaValue (unsigned short v) |
| void | SetNoteOn (unsigned char chan, unsigned char note, unsigned char vel) |
| void | SetNoteOff (unsigned char chan, unsigned char note, unsigned char vel) |
| void | SetPolyPressure (unsigned char chan, unsigned char note, unsigned char pres) |
| void | SetControlChange (unsigned char chan, unsigned char ctrl, unsigned char val) |
| void | SetProgramChange (unsigned char chan, unsigned char val) |
| void | SetChannelPressure (unsigned char chan, unsigned char val) |
| void | SetPitchBend (unsigned char chan, short val) |
| void | SetPitchBend (unsigned char chan, unsigned char low, unsigned char high) |
| void | SetSysEx () |
| void | SetMTC (unsigned char field, unsigned char v) |
| void | SetSongPosition (short pos) |
| void | SetSongSelect (unsigned char sng) |
| void | SetTuneRequest () |
| void | SetMetaEvent (unsigned char type, unsigned char v1, unsigned char v2) |
| void | SetMetaEvent (unsigned char type, unsigned short v) |
| void | SetAllNotesOff (unsigned char chan, unsigned char type=C_ALL_NOTES_OFF) |
| void | SetLocal (unsigned char chan, unsigned char v) |
| void | SetNoOp () |
| void | SetTempo32 (unsigned short tempo_times_32) |
| void | SetText (unsigned short text_num, unsigned char type=META_GENERIC_TEXT) |
| void | SetDataEnd () |
| void | SetTimeSig (unsigned char numerator, unsigned char denominator) |
| void | SetKeySig (signed char sharp_flats, unsigned char major_minor) |
| void | SetBeatMarker () |
Protected Attributes | |
| unsigned char | status |
| unsigned char | byte1 |
| unsigned char | byte2 |
| unsigned char | byte3 |
Static Protected Attributes | |
| char * | chan_msg_name [16] |
| char * | sys_msg_name [16] |
|
|
Definition at line 195 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, and status.
|
|
|
Definition at line 204 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, and status.
|
|
|
Reimplemented in jdkmidi::MIDIBigMessage, jdkmidi::MIDITimedMessage, jdkmidi::MIDIDeltaTimedMessage, jdkmidi::MIDITimedBigMessage, and jdkmidi::MIDIDeltaTimedBigMessage. Definition at line 213 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, and status.
|
|
|
Reimplemented in jdkmidi::MIDIBigMessage. Definition at line 222 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, and status.
|
|
|
Definition at line 260 of file jdkmidi_msg.cpp.
|
|
|
Definition at line 89 of file msg.h. References byte1.
00089 { return byte1; }
|
|
|
Definition at line 90 of file msg.h. References byte2.
00090 { return byte2; }
|
|
|
Definition at line 91 of file msg.h. References byte3.
00091 { return byte3; }
|
|
|
Definition at line 84 of file msg.h. References status.
00084 { return (unsigned char)(status&0x0f); }
|
|
|
Definition at line 96 of file msg.h. References byte1.
00096 { return byte1; }
|
|
|
Definition at line 97 of file msg.h. References byte2.
00097 { return byte2; }
|
|
|
Definition at line 288 of file jdkmidi_msg.cpp. References byte3.
00289 {
00290 return byte3;
00291 }
|
|
|
Definition at line 283 of file jdkmidi_msg.cpp. References byte2.
00284 {
00285 return (signed char)byte2;
00286 }
|
|
|
Definition at line 246 of file jdkmidi_msg.cpp. References jdkmidi::GetMessageLength(), jdkmidi::GetSystemMessageLength(), and status.
00247 {
00248 if( (status&0xf0)==0xf0 )
00249 {
00250 return GetSystemMessageLength( status );
00251 }
00252 else
00253 {
00254 return GetMessageLength( status );
00255 }
00256 }
|
|
|
Definition at line 451 of file jdkmidi_msg.cpp. References GetMetaValue().
00452 {
00453 return GetMetaValue();
00454 }
|
|
|
Definition at line 87 of file msg.h. References byte1.
00087 { return byte1; }
|
|
|
Definition at line 266 of file jdkmidi_msg.cpp.
|
|
|
Definition at line 93 of file msg.h. References byte1.
00093 { return byte1; }
|
|
|
Definition at line 95 of file msg.h. References byte1.
00095 { return byte1; }
|
|
|
Definition at line 83 of file msg.h. References status.
00083 { return (unsigned char)status; }
|
|
|
Definition at line 355 of file jdkmidi_msg.cpp.
|
|
|
Definition at line 445 of file jdkmidi_msg.cpp. References GetMetaValue().
00446 {
00447 return GetMetaValue();
00448 }
|
|
|
Definition at line 277 of file jdkmidi_msg.cpp. References byte3.
00278 {
00279 return byte3;
00280 }
|
|
|
Definition at line 271 of file jdkmidi_msg.cpp. References byte2.
00272 {
00273 return byte2;
00274 }
|
|
|
Definition at line 85 of file msg.h. References status.
00085 { return (unsigned char)(status&0xf0); }
|
|
|
Definition at line 94 of file msg.h. References byte2.
00094 { return byte2; }
|
|
|
Definition at line 398 of file jdkmidi_msg.cpp. References byte1, jdkmidi::C_ALL_NOTES_OFF, jdkmidi::CONTROL_CHANGE, and status.
00399 {
00400 return ((status&0xf0)==CONTROL_CHANGE )
00401 && (byte1>=C_ALL_NOTES_OFF);
00402 }
|
|
|
Definition at line 437 of file jdkmidi_msg.cpp. References byte1, jdkmidi::META_BEAT_MARKER, jdkmidi::META_EVENT, and status.
00438 {
00439 return (status==META_EVENT)
00440 && (byte1==META_BEAT_MARKER);
00441 }
|
|
|
Definition at line 294 of file jdkmidi_msg.cpp. References status.
|
|
|
Definition at line 331 of file jdkmidi_msg.cpp. References jdkmidi::CHANNEL_PRESSURE, and status.
00332 {
00333 return ((status&0xf0)==CHANNEL_PRESSURE);
00334 }
|
|
|
Definition at line 319 of file jdkmidi_msg.cpp. References jdkmidi::CONTROL_CHANGE, and status.
00320 {
00321 return ((status&0xf0)==CONTROL_CHANGE);
00322 }
|
|
|
Definition at line 419 of file jdkmidi_msg.cpp. References byte1, jdkmidi::META_DATA_END, jdkmidi::META_EVENT, and status.
00420 {
00421 return (status==META_EVENT)
00422 && (byte1==META_DATA_END );
00423 }
|
|
|
Definition at line 431 of file jdkmidi_msg.cpp. References byte1, jdkmidi::META_EVENT, jdkmidi::META_KEYSIG, and status.
00432 {
00433 return (status==META_EVENT)
00434 && (byte1==META_KEYSIG );
00435 }
|
|
|
Definition at line 385 of file jdkmidi_msg.cpp. References jdkmidi::META_EVENT, and status.
00386 {
00387 return (status==META_EVENT);
00388 }
|
|
|
Definition at line 361 of file jdkmidi_msg.cpp. References jdkmidi::MTC, and status.
|
|
|
Definition at line 405 of file jdkmidi_msg.cpp. References byte1, jdkmidi::META_EVENT, jdkmidi::META_NO_OPERATION, and status.
00406 {
00407 return (status==META_EVENT)
00408 && (byte1==META_NO_OPERATION);
00409 }
|
|
|
Definition at line 306 of file jdkmidi_msg.cpp. References byte2, jdkmidi::NOTE_OFF, jdkmidi::NOTE_ON, and status.
|
|
|
Definition at line 300 of file jdkmidi_msg.cpp. References byte2, jdkmidi::NOTE_ON, and status.
|
|
|
Definition at line 337 of file jdkmidi_msg.cpp. References jdkmidi::PITCH_BEND, and status.
00338 {
00339 return ((status&0xf0)==PITCH_BEND);
00340 }
|
|
|
Definition at line 313 of file jdkmidi_msg.cpp. References jdkmidi::POLY_PRESSURE, and status.
00314 {
00315 return ((status&0xf0)==POLY_PRESSURE );
00316 }
|
|
|
Definition at line 325 of file jdkmidi_msg.cpp. References jdkmidi::PROGRAM_CHANGE, and status.
00326 {
00327 return ((status&0xf0)==PROGRAM_CHANGE);
00328 }
|
|
|
Definition at line 367 of file jdkmidi_msg.cpp. References jdkmidi::SONG_POSITION, and status.
00368 {
00369 return (status==SONG_POSITION);
00370 }
|
|
|
Definition at line 373 of file jdkmidi_msg.cpp. References jdkmidi::SONG_SELECT, and status.
00374 {
00375 return (status==SONG_SELECT);
00376 }
|
|
|
Definition at line 349 of file jdkmidi_msg.cpp. References status, and jdkmidi::SYSEX_START.
00350 {
00351 return (status==SYSEX_START);
00352 }
|
|
|
Definition at line 343 of file jdkmidi_msg.cpp. References status.
00344 {
00345 return (status&0xf0)==0xf0;
00346 }
|
|
|
Definition at line 412 of file jdkmidi_msg.cpp. References byte1, jdkmidi::META_EVENT, jdkmidi::META_TEMPO, and status.
00413 {
00414 return (status==META_EVENT)
00415 && (byte1==META_TEMPO);
00416 }
|
|
|
Definition at line 391 of file jdkmidi_msg.cpp. References byte1, jdkmidi::META_EVENT, and status.
00392 {
00393 return (status==META_EVENT) &&
00394 (byte1>=0x1 && byte1<=0xf);
00395 }
|
|
|
Definition at line 425 of file jdkmidi_msg.cpp. References byte1, jdkmidi::META_EVENT, jdkmidi::META_TIMESIG, and status.
00426 {
00427 return (status==META_EVENT)
00428 && (byte1==META_TIMESIG );
00429 }
|
|
|
Definition at line 379 of file jdkmidi_msg.cpp. References status, and jdkmidi::TUNE_REQUEST.
00380 {
00381 return (status==TUNE_REQUEST);
00382 }
|
|
|
Definition at line 85 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, chan_msg_name, jdkmidi::CHANNEL_PRESSURE, jdkmidi::CONTROL_CHANGE, GetBenderValue(), GetChannel(), GetLength(), IsAllNotesOff(), jdkmidi::NOTE_OFF, jdkmidi::NOTE_ON, jdkmidi::PITCH_BEND, jdkmidi::POLY_PRESSURE, jdkmidi::PROGRAM_CHANGE, status, and sys_msg_name.
00086 {
00087 char buf[64];
00088 int len=GetLength();
00089
00090 *txt=0;
00091
00092 if( IsAllNotesOff() )
00093 {
00094 sprintf( buf, "Ch %2d All Notes Off (ctrl=%3d)", (int)GetChannel()+1, (int)byte1 );
00095
00096 strcat( txt, buf );
00097 }
00098 else
00099 {
00100 int type=(status&0xf0)>>4;
00101
00102 //
00103 // if it is a note on with vel=0, call it a NOTE OFF
00104 //
00105
00106 if( type==9 && byte2==0 )
00107 type=8;
00108
00109 if( type!=0xf )
00110 {
00111 sprintf( buf, "Ch %2d ", (int)GetChannel()+1 );
00112 strcat( txt, buf );
00113 }
00114
00115
00116 strcat( txt, chan_msg_name[type] );
00117
00118 if( status>=0xf0 )
00119 {
00120 strcat( txt, sys_msg_name[status-0xf0] );
00121
00122 if( len>1 )
00123 {
00124 sprintf( buf,"%02x", (int)byte1 );
00125 strcat( txt, buf );
00126 }
00127
00128 if( len>2 )
00129 {
00130 sprintf( buf,",%02x", (int)byte2 );
00131 strcat( txt, buf );
00132 }
00133
00134 if( len>3 )
00135 {
00136 sprintf( buf,",%02x", (int)byte3 );
00137 strcat( txt, buf );
00138 }
00139
00140 }
00141 else
00142 {
00143 char *endtxt = txt+strlen(txt);
00144
00145 switch( status&0xf0 )
00146 {
00147 case NOTE_ON:
00148 if( byte2==0 )
00149 sprintf( endtxt, "Note %3d", (int)byte1 );
00150 else
00151 sprintf( endtxt, "Note %3d Vel %3d ", (int)byte1, (int)byte2 );
00152 break;
00153 case NOTE_OFF:
00154 sprintf( endtxt, "Note %3d Vel %3d ", (int)byte1, (int)byte2 );
00155 break;
00156 case POLY_PRESSURE:
00157 sprintf( endtxt, "Note %3d Pres %3d ", (int)byte1, (int)byte2 );
00158 break;
00159 case CONTROL_CHANGE:
00160 sprintf( endtxt, "Ctrl %3d Val %3d ", (int)byte1, (int)byte2 );
00161 break;
00162 case PROGRAM_CHANGE:
00163 sprintf( endtxt, "PG %3d ", (int)byte1 );
00164 break;
00165 case CHANNEL_PRESSURE:
00166 sprintf( endtxt, "Pres %3d ", (int)byte1 );
00167 break;
00168 case PITCH_BEND:
00169 sprintf( endtxt, "Val %5d", (int)GetBenderValue() );
00170 break;
00171 }
00172 }
00173 }
00174
00175 //
00176 // pad the rest with spaces
00177 //
00178
00179 {
00180 int len=strlen(txt);
00181 char *p=txt+len;
00182
00183 while( len<45 )
00184 {
00185 *p++=' ';
00186 ++len;
00187 }
00188 *p++='\0';
00189 }
00190
00191 return txt;
00192 }
|
|
|
Reimplemented in jdkmidi::MIDIBigMessage, jdkmidi::MIDITimedMessage, jdkmidi::MIDIDeltaTimedMessage, jdkmidi::MIDITimedBigMessage, and jdkmidi::MIDIDeltaTimedBigMessage. Definition at line 236 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, and status.
|
|
||||||||||||
|
Definition at line 617 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, jdkmidi::CONTROL_CHANGE, and status.
00621 {
00622 status=(unsigned char)(chan|CONTROL_CHANGE);
00623 byte1=type;
00624 byte2=0x7f;
00625 byte3=0;
00626 }
|
|
|
Definition at line 675 of file jdkmidi_msg.cpp. References jdkmidi::META_BEAT_MARKER, and SetMetaEvent().
00676 {
00677 SetMetaEvent( META_BEAT_MARKER,0,0 );
00678 }
|
|
|
Definition at line 457 of file jdkmidi_msg.cpp.
|
|
|
Definition at line 176 of file msg.h. References byte1.
00176 { byte1=b; }
|
|
|
Definition at line 177 of file msg.h. References byte2.
00177 { byte2=b; }
|
|
|
Definition at line 178 of file msg.h. References byte3.
00178 { byte3=b; }
|
|
|
Definition at line 173 of file msg.h. References status.
|
|
||||||||||||
|
Definition at line 524 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, jdkmidi::CHANNEL_PRESSURE, and status.
00525 {
00526 status=(unsigned char)(chan | CHANNEL_PRESSURE);
00527 byte1=val;
00528 byte2=0;
00529 byte3=0;
00530 }
|
|
||||||||||||||||
|
Definition at line 506 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, jdkmidi::CONTROL_CHANGE, and status.
00507 {
00508 status=(unsigned char)(chan | CONTROL_CHANGE);
00509 byte1=ctrl;
00510 byte2=val;
00511 byte3=0;
00512 }
|
|
|
Definition at line 183 of file msg.h. References byte1.
00183 { byte1=c; }
|
|
|
Definition at line 184 of file msg.h. References byte2.
00184 { byte2=v; }
|
|
|
Definition at line 659 of file jdkmidi_msg.cpp. References jdkmidi::META_DATA_END, and SetMetaEvent().
00660 {
00661 SetMetaEvent( META_DATA_END,0 );
00662 }
|
|
||||||||||||
|
Definition at line 669 of file jdkmidi_msg.cpp. References jdkmidi::META_KEYSIG, and SetMetaEvent().
00670 {
00671 SetMetaEvent( META_KEYSIG,sharp_flats,major_minor);
00672 }
|
|
||||||||||||
|
Definition at line 629 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, jdkmidi::C_LOCAL, jdkmidi::CONTROL_CHANGE, and status.
|
|
||||||||||||
|
Definition at line 608 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, jdkmidi::META_EVENT, and status.
00609 {
00610 status=META_EVENT;
00611 byte1=type;
00612 byte2=(unsigned char)(v&0xff);
00613 byte3=(unsigned char)((v>>8)&0xff);
00614 }
|
|
||||||||||||||||
|
Definition at line 599 of file jdkmidi_msg.cpp. References byte1, byte2, byte3, jdkmidi::META_EVENT, and status.
00600 {
00601 status=META_EVENT;
00602 byte1=type;
00603 byte2=v1;
00604 byte3=v2;
00605 }
|
|
|
Definition at line 465 of file jdkmidi_msg.cpp. References byte1.
00466 {
00467 byte1=t;
00468 }
|
|
|
Definition at line 472 of file jdkmidi_msg.cpp.
|