jdkmidi class library documentation

Copyright © 2004 J.D. Koftinoff Software, Ltd.

Released under the GNU General Public License (GPL)




Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

jdkmidi::MIDIMessage Class Reference

#include <msg.h>

Inheritance diagram for jdkmidi::MIDIMessage:

jdkmidi::MIDIBigMessage jdkmidi::MIDIDeltaTimedMessage jdkmidi::MIDITimedMessage jdkmidi::MIDIDeltaTimedBigMessage jdkmidi::MIDITimedBigMessage List of all members.

Public Member Functions

 MIDIMessage ()
 MIDIMessage (const MIDIMessage &m)
void Clear ()
void Copy (const MIDIMessage &m)
char * MsgToText (char *txt) const
const MIDIMessageoperator= (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]

Constructor & Destructor Documentation

jdkmidi::MIDIMessage::MIDIMessage  ) 
 

Definition at line 195 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, and status.

00196   { 
00197     status=0;
00198     byte1=0; 
00199     byte2=0;
00200     byte3=0;  
00201   } 

jdkmidi::MIDIMessage::MIDIMessage const MIDIMessage m  ) 
 

Definition at line 204 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, and status.

00205   {
00206     status=m.status;
00207     byte1=m.byte1;
00208     byte2=m.byte2;
00209     byte3=m.byte3;
00210   } 


Member Function Documentation

void jdkmidi::MIDIMessage::Clear  ) 
 

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.

00214   {
00215     status=0;
00216     byte1=0;
00217     byte2=0;
00218     byte3=0;
00219   } 

void jdkmidi::MIDIMessage::Copy const MIDIMessage m  ) 
 

Reimplemented in jdkmidi::MIDIBigMessage.

Definition at line 222 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, and status.

00223   {
00224     status=m.status;
00225     byte1=m.byte1;
00226     byte2=m.byte2;
00227     byte3=m.byte3;
00228   } 

short jdkmidi::MIDIMessage::GetBenderValue  )  const
 

Definition at line 260 of file jdkmidi_msg.cpp.

References byte1, and byte2.

00261   { 
00262     return (short)(((byte2<<7) | byte1)-8192);  
00263   } 

unsigned char jdkmidi::MIDIMessage::GetByte1  )  const [inline]
 

Definition at line 89 of file msg.h.

References byte1.

00089 { return byte1;   }

unsigned char jdkmidi::MIDIMessage::GetByte2  )  const [inline]
 

Definition at line 90 of file msg.h.

References byte2.

00090 { return byte2;   }

unsigned char jdkmidi::MIDIMessage::GetByte3  )  const [inline]
 

Definition at line 91 of file msg.h.

References byte3.

00091 { return byte3;   }

unsigned char jdkmidi::MIDIMessage::GetChannel  )  const [inline]
 

Definition at line 84 of file msg.h.

References status.

00084 { return (unsigned char)(status&0x0f);  }

unsigned char jdkmidi::MIDIMessage::GetController  )  const [inline]
 

Definition at line 96 of file msg.h.

References byte1.

00096 { return byte1;   }

unsigned char jdkmidi::MIDIMessage::GetControllerValue  )  const [inline]
 

Definition at line 97 of file msg.h.

References byte2.

00097 { return byte2; }

unsigned char jdkmidi::MIDIMessage::GetKeySigMajorMinor  )  const
 

Definition at line 288 of file jdkmidi_msg.cpp.

References byte3.

00289   {
00290     return byte3;
00291   }

signed char jdkmidi::MIDIMessage::GetKeySigSharpFlats  )  const
 

Definition at line 283 of file jdkmidi_msg.cpp.

References byte2.

00284   {
00285     return (signed char)byte2;
00286   }

char jdkmidi::MIDIMessage::GetLength  )  const
 

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   } 

unsigned short jdkmidi::MIDIMessage::GetLoopNumber  )  const
 

Definition at line 451 of file jdkmidi_msg.cpp.

References GetMetaValue().

00452   {
00453     return GetMetaValue();
00454   } 

unsigned char jdkmidi::MIDIMessage::GetMetaType  )  const [inline]
 

Definition at line 87 of file msg.h.

References byte1.

00087 { return byte1;   }

unsigned short jdkmidi::MIDIMessage::GetMetaValue  )  const
 

Definition at line 266 of file jdkmidi_msg.cpp.

References byte2, and byte3.

00267   { 
00268     return (unsigned short)((byte3<<8) | byte2);  
00269   } 

unsigned char jdkmidi::MIDIMessage::GetNote  )  const [inline]
 

Definition at line 93 of file msg.h.

References byte1.

00093 { return byte1;   }

unsigned char jdkmidi::MIDIMessage::GetPGValue  )  const [inline]
 

Definition at line 95 of file msg.h.

References byte1.

00095 { return byte1;   }

unsigned char jdkmidi::MIDIMessage::GetStatus  )  const [inline]
 

Definition at line 83 of file msg.h.

References status.

00083 { return (unsigned char)status; }

short jdkmidi::MIDIMessage::GetSysExNum  )  const
 

Definition at line 355 of file jdkmidi_msg.cpp.

References byte2, and byte3.

00356   {
00357     return (short)((byte3<<8) | byte2);
00358   } 

unsigned short jdkmidi::MIDIMessage::GetTempo32  )  const
 

Definition at line 445 of file jdkmidi_msg.cpp.

References GetMetaValue().

00446   {
00447     return GetMetaValue();
00448   } 

unsigned char jdkmidi::MIDIMessage::GetTimeSigDenominator  )  const
 

Definition at line 277 of file jdkmidi_msg.cpp.

References byte3.

00278   {
00279     return byte3;
00280   } 

unsigned char jdkmidi::MIDIMessage::GetTimeSigNumerator  )  const
 

Definition at line 271 of file jdkmidi_msg.cpp.

References byte2.

00272   {
00273     return byte2; 
00274   } 

unsigned char jdkmidi::MIDIMessage::GetType  )  const [inline]
 

Definition at line 85 of file msg.h.

References status.

00085 { return (unsigned char)(status&0xf0);  }

unsigned char jdkmidi::MIDIMessage::GetVelocity  )  const [inline]
 

Definition at line 94 of file msg.h.

References byte2.

00094 { return byte2;   }

bool jdkmidi::MIDIMessage::IsAllNotesOff  )  const
 

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   } 

bool jdkmidi::MIDIMessage::IsBeatMarker  )  const
 

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   }

bool jdkmidi::MIDIMessage::IsChannelMsg  )  const
 

Definition at line 294 of file jdkmidi_msg.cpp.

References status.

00295   {
00296     return (status>=0x80) && (status<0xf0);
00297   } 

bool jdkmidi::MIDIMessage::IsChannelPressure  )  const
 

Definition at line 331 of file jdkmidi_msg.cpp.

References jdkmidi::CHANNEL_PRESSURE, and status.

00332   {
00333     return ((status&0xf0)==CHANNEL_PRESSURE);
00334   } 

bool jdkmidi::MIDIMessage::IsControlChange  )  const
 

Definition at line 319 of file jdkmidi_msg.cpp.

References jdkmidi::CONTROL_CHANGE, and status.

00320   {
00321     return ((status&0xf0)==CONTROL_CHANGE);
00322   } 

bool jdkmidi::MIDIMessage::IsDataEnd  )  const
 

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   } 

bool jdkmidi::MIDIMessage::IsKeySig  )  const
 

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   }

bool jdkmidi::MIDIMessage::IsMetaEvent  )  const
 

Definition at line 385 of file jdkmidi_msg.cpp.

References jdkmidi::META_EVENT, and status.

00386   {
00387     return (status==META_EVENT);
00388   } 

bool jdkmidi::MIDIMessage::IsMTC  )  const
 

Definition at line 361 of file jdkmidi_msg.cpp.

References jdkmidi::MTC, and status.

00362   {
00363     return (status==MTC);
00364   } 

bool jdkmidi::MIDIMessage::IsNoOp  )  const
 

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   } 

bool jdkmidi::MIDIMessage::IsNoteOff  )  const
 

Definition at line 306 of file jdkmidi_msg.cpp.

References byte2, jdkmidi::NOTE_OFF, jdkmidi::NOTE_ON, and status.

00307   {
00308     return ((status&0xf0)==NOTE_OFF) ||
00309       (((status&0xf0)==NOTE_ON) && byte2==0 );
00310   } 

bool jdkmidi::MIDIMessage::IsNoteOn  )  const
 

Definition at line 300 of file jdkmidi_msg.cpp.

References byte2, jdkmidi::NOTE_ON, and status.

00301   {
00302     return ((status&0xf0)==NOTE_ON) && byte2;
00303   } 

bool jdkmidi::MIDIMessage::IsPitchBend  )  const
 

Definition at line 337 of file jdkmidi_msg.cpp.

References jdkmidi::PITCH_BEND, and status.

00338   {
00339     return ((status&0xf0)==PITCH_BEND);
00340   } 

bool jdkmidi::MIDIMessage::IsPolyPressure  )  const
 

Definition at line 313 of file jdkmidi_msg.cpp.

References jdkmidi::POLY_PRESSURE, and status.

00314   {
00315     return ((status&0xf0)==POLY_PRESSURE );
00316   } 

bool jdkmidi::MIDIMessage::IsProgramChange  )  const
 

Definition at line 325 of file jdkmidi_msg.cpp.

References jdkmidi::PROGRAM_CHANGE, and status.

00326   {
00327     return ((status&0xf0)==PROGRAM_CHANGE);
00328   } 

bool jdkmidi::MIDIMessage::IsSongPosition  )  const
 

Definition at line 367 of file jdkmidi_msg.cpp.

References jdkmidi::SONG_POSITION, and status.

00368   {
00369     return (status==SONG_POSITION);
00370   } 

bool jdkmidi::MIDIMessage::IsSongSelect  )  const
 

Definition at line 373 of file jdkmidi_msg.cpp.

References jdkmidi::SONG_SELECT, and status.

00374   {
00375     return (status==SONG_SELECT);
00376   } 

bool jdkmidi::MIDIMessage::IsSysEx  )  const
 

Definition at line 349 of file jdkmidi_msg.cpp.

References status, and jdkmidi::SYSEX_START.

00350   {
00351     return (status==SYSEX_START);
00352   } 

bool jdkmidi::MIDIMessage::IsSystemMessage  )  const
 

Definition at line 343 of file jdkmidi_msg.cpp.

References status.

00344   {
00345     return (status&0xf0)==0xf0;
00346   } 

bool jdkmidi::MIDIMessage::IsTempo  )  const
 

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   } 

bool jdkmidi::MIDIMessage::IsTextEvent  )  const
 

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   } 

bool jdkmidi::MIDIMessage::IsTimeSig  )  const
 

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   }

bool jdkmidi::MIDIMessage::IsTuneRequest  )  const
 

Definition at line 379 of file jdkmidi_msg.cpp.

References status, and jdkmidi::TUNE_REQUEST.

00380   {
00381     return (status==TUNE_REQUEST);
00382   } 

char * jdkmidi::MIDIMessage::MsgToText char *  txt  )  const
 

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   } 

const MIDIMessage & jdkmidi::MIDIMessage::operator= const MIDIMessage m  ) 
 

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.

00237   {
00238     status=m.status;
00239     byte1=m.byte1;
00240     byte2=m.byte2;
00241     byte3=m.byte3;
00242     return *this;
00243   } 

void jdkmidi::MIDIMessage::SetAllNotesOff unsigned char  chan,
unsigned char  type = C_ALL_NOTES_OFF
 

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   } 

void jdkmidi::MIDIMessage::SetBeatMarker  ) 
 

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   } 

void jdkmidi::MIDIMessage::SetBenderValue short  v  ) 
 

Definition at line 457 of file jdkmidi_msg.cpp.

References byte1, and byte2.

00458   {
00459     short x=(short)(v+8192);
00460     byte1=(unsigned char)(x&0x7f);
00461     byte2=(unsigned char)((x>>7)&0x7f);
00462   } 

void jdkmidi::MIDIMessage::SetByte1 unsigned char  b  )  [inline]
 

Definition at line 176 of file msg.h.

References byte1.

00176 { byte1=b;    }

void jdkmidi::MIDIMessage::SetByte2 unsigned char  b  )  [inline]
 

Definition at line 177 of file msg.h.

References byte2.

00177 { byte2=b;    }

void jdkmidi::MIDIMessage::SetByte3 unsigned char  b  )  [inline]
 

Definition at line 178 of file msg.h.

References byte3.

00178 { byte3=b;    }

void jdkmidi::MIDIMessage::SetChannel unsigned char  s  )  [inline]
 

Definition at line 173 of file msg.h.

References status.

00173 {status=(unsigned char)((status&0xf0)|s);}

void jdkmidi::MIDIMessage::SetChannelPressure unsigned char  chan,
unsigned char  val
 

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   } 

void jdkmidi::MIDIMessage::SetControlChange unsigned char  chan,
unsigned char  ctrl,
unsigned char  val
 

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   } 

void jdkmidi::MIDIMessage::SetController unsigned char  c  )  [inline]
 

Definition at line 183 of file msg.h.

References byte1.

00183 { byte1=c;    }

void jdkmidi::MIDIMessage::SetControllerValue unsigned char  v  )  [inline]
 

Definition at line 184 of file msg.h.

References byte2.

00184 { byte2=v;    }

void jdkmidi::MIDIMessage::SetDataEnd  ) 
 

Definition at line 659 of file jdkmidi_msg.cpp.

References jdkmidi::META_DATA_END, and SetMetaEvent().

00660   {
00661     SetMetaEvent( META_DATA_END,0 );
00662   } 

void jdkmidi::MIDIMessage::SetKeySig signed char  sharp_flats,
unsigned char  major_minor
 

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   }   

void jdkmidi::MIDIMessage::SetLocal unsigned char  chan,
unsigned char  v
 

Definition at line 629 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, jdkmidi::C_LOCAL, jdkmidi::CONTROL_CHANGE, and status.

00630   {
00631     status=(unsigned char)(chan|CONTROL_CHANGE);
00632     byte1=C_LOCAL;
00633     byte2=v;
00634     byte3=0;
00635   } 

void jdkmidi::MIDIMessage::SetMetaEvent unsigned char  type,
unsigned short  v
 

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   } 

void jdkmidi::MIDIMessage::SetMetaEvent unsigned char  type,
unsigned char  v1,
unsigned char  v2
 

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   } 

void jdkmidi::MIDIMessage::SetMetaType unsigned char  t  ) 
 

Definition at line 465 of file jdkmidi_msg.cpp.

References byte1.

00466   { 
00467     byte1=t;    
00468   } 

void jdkmidi::MIDIMessage::SetMetaValue unsigned short  v  ) 
 

Definition at line 472 of file jdkmidi_msg.cpp.

References byte2, and byte3.

00473   {
00474     byte2=(unsigned char)(v&0xff);
00475     byte3=(unsigned char)((v>>8)&0xff);
00476   } 

void jdkmidi::MIDIMessage::SetMTC unsigned char  field,
unsigned char  v
 

Definition at line 563 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, jdkmidi::MTC, and status.

00564   {
00565     status=MTC;
00566     byte1=(unsigned char)((field<<4) | v);
00567     byte2=0;
00568     byte3=0;
00569   } 

void jdkmidi::MIDIMessage::SetNoOp  ) 
 

Definition at line 638 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, jdkmidi::META_EVENT, jdkmidi::META_NO_OPERATION, and status.

00639   {
00640     status=META_EVENT;
00641     byte1=META_NO_OPERATION;
00642     byte2=0;
00643     byte3=0;
00644   } 

void jdkmidi::MIDIMessage::SetNote unsigned char  n  )  [inline]
 

Definition at line 180 of file msg.h.

References byte1.

00180 { byte1=n;    }

void jdkmidi::MIDIMessage::SetNoteOff unsigned char  chan,
unsigned char  note,
unsigned char  vel
 

Definition at line 488 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, jdkmidi::NOTE_OFF, and status.

00489   {
00490     status=(unsigned char)(chan | NOTE_OFF);
00491     byte1=note;
00492     byte2=vel;
00493     byte3=0;
00494   } 

void jdkmidi::MIDIMessage::SetNoteOn unsigned char  chan,
unsigned char  note,
unsigned char  vel
 

Definition at line 479 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, jdkmidi::NOTE_ON, and status.

00480   {
00481     status=(unsigned char)(chan | NOTE_ON);
00482     byte1=note;
00483     byte2=vel;
00484     byte3=0;
00485   } 

void jdkmidi::MIDIMessage::SetPGValue unsigned char  v  )  [inline]
 

Definition at line 182 of file msg.h.

References byte1.

00182 { byte1=v;    }

void jdkmidi::MIDIMessage::SetPitchBend unsigned char  chan,
unsigned char  low,
unsigned char  high
 

Definition at line 543 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, jdkmidi::PITCH_BEND, and status.

00544   {
00545     status=(unsigned char)(chan | PITCH_BEND);
00546     byte1=(unsigned char)(low);
00547     byte2=(unsigned char)(high);
00548     byte3=0;
00549   } 

void jdkmidi::MIDIMessage::SetPitchBend unsigned char  chan,
short  val
 

Definition at line 533 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, jdkmidi::PITCH_BEND, and status.

00534   {
00535     status=(unsigned char)(chan | PITCH_BEND);
00536     val+=(short)0x2000; // center value
00537     byte1=(unsigned char)(val&0x7f); // 7 bit bytes
00538     byte2=(unsigned char)((val>>7)&0x7f);
00539     byte3=0;
00540   } 

void jdkmidi::MIDIMessage::SetPolyPressure unsigned char  chan,
unsigned char  note,
unsigned char  pres
 

Definition at line 497 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, jdkmidi::POLY_PRESSURE, and status.

00498   {
00499     status=(unsigned char)(chan | POLY_PRESSURE);
00500     byte1=note;
00501     byte2=pres;
00502     byte3=0;
00503   } 

void jdkmidi::MIDIMessage::SetProgramChange unsigned char  chan,
unsigned char  val
 

Definition at line 515 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, jdkmidi::PROGRAM_CHANGE, and status.

00516   {
00517     status=(unsigned char)(chan | PROGRAM_CHANGE);
00518     byte1=val;
00519     byte2=0;
00520     byte3=0;
00521   } 

void jdkmidi::MIDIMessage::SetSongPosition short  pos  ) 
 

Definition at line 572 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, jdkmidi::SONG_POSITION, and status.

00573   {
00574     status=SONG_POSITION;
00575     byte1=(unsigned char)(pos&0x7f);
00576     byte2=(unsigned char)((pos>>7)&0x7f);
00577     byte3=0;
00578   } 

void jdkmidi::MIDIMessage::SetSongSelect unsigned char  sng  ) 
 

Definition at line 581 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, jdkmidi::SONG_SELECT, and status.

00582   {
00583     status=SONG_SELECT;
00584     byte1=sng;
00585     byte2=0;
00586     byte3=0;
00587   } 

void jdkmidi::MIDIMessage::SetStatus unsigned char  s  )  [inline]
 

Definition at line 172 of file msg.h.

References status.

00172 { status=s;   }

void jdkmidi::MIDIMessage::SetSysEx  ) 
 

Definition at line 552 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, status, and jdkmidi::SYSEX_START.

00553   {
00554     status=SYSEX_START;
00555     byte1=0;
00556     
00557     int num=0;
00558     byte2=(unsigned char)(num&0xff);
00559     byte3=(unsigned char)((num>>8)&0xff);
00560   } 

void jdkmidi::MIDIMessage::SetTempo32 unsigned short  tempo_times_32  ) 
 

Definition at line 647 of file jdkmidi_msg.cpp.

References jdkmidi::META_TEMPO, and SetMetaEvent().

00648   {
00649     SetMetaEvent( META_TEMPO, tempo_times_32 );
00650   } 

void jdkmidi::MIDIMessage::SetText unsigned short  text_num,
unsigned char  type = META_GENERIC_TEXT
 

Definition at line 653 of file jdkmidi_msg.cpp.

References SetMetaEvent().

00654   {
00655     SetMetaEvent( type, text_num );
00656   } 

void jdkmidi::MIDIMessage::SetTimeSig unsigned char  numerator,
unsigned char  denominator
 

Definition at line 664 of file jdkmidi_msg.cpp.

References jdkmidi::META_TIMESIG, and SetMetaEvent().

00665   {
00666     SetMetaEvent( META_TIMESIG,num,den );
00667   } 

void jdkmidi::MIDIMessage::SetTuneRequest  ) 
 

Definition at line 590 of file jdkmidi_msg.cpp.

References byte1, byte2, byte3, status, and jdkmidi::TUNE_REQUEST.

00591   {
00592     status=TUNE_REQUEST;
00593     byte1=0;
00594     byte2=0;
00595     byte3=0;
00596   } 

void jdkmidi::MIDIMessage::SetType unsigned char  s  )  [inline]
 

Definition at line 174 of file msg.h.

References status.

00174 {status=(unsigned char)((status&0x0f)|s);}

void jdkmidi::MIDIMessage::SetVelocity unsigned char  v  )  [inline]
 

Definition at line 181 of file msg.h.

References byte2.

00181 { byte2=v;    }


Member Data Documentation

unsigned char jdkmidi::MIDIMessage::byte1 [protected]
 

Definition at line 246 of file msg.h.

unsigned char jdkmidi::MIDIMessage::byte2 [protected]
 

Definition at line 247 of file msg.h.

unsigned char jdkmidi::MIDIMessage::byte3 [protected]
 

Definition at line 248 of file msg.h.

char * jdkmidi::MIDIMessage::chan_msg_name [static, protected]
 

Initial value:

 
  {
    "ERROR 00    ",   
    "ERROR 10    ",   
    "ERROR 20    ",   
    "ERROR 30    ",       
    "ERROR 40    ",       
    "ERROR 50    ",       
    "ERROR 60    ",       
    "ERROR 70    ",       
    "NOTE OFF    ",   
    "NOTE ON     ",   
    "POLY PRES.  ",   
    "CTRL CHANGE ",   
    "PG CHANGE   ",   
    "CHAN PRES.  ",   
    "BENDER      ",   
    "SYSTEM      "    
  }

Definition at line 44 of file jdkmidi_msg.cpp.

unsigned char jdkmidi::MIDIMessage::status [protected]
 

Definition at line 245 of file msg.h.

char * jdkmidi::MIDIMessage::sys_msg_name [static, protected]
 

Initial value:

 
  {
    "SYSEX       ",   
    "MTC         ",   
    "SONG POS    ",   
    "SONG SELECT ",   
    "ERR - F4    ",   
    "ERR - F5    ",   
    "TUNE REQ.   ",   
    "SYSEX END   ",   
    "CLOCK       ",   
    "MEASURE END ",   
    "START       ",   
    "CONTINUE    ",   
    "STOP        ",         
    "ERR - FD    ",         
    "SENSE       ",   
    "META-EVENT  "    
  }

Definition at line 64 of file jdkmidi_msg.cpp.


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