MIDIEnums.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __MIDIEnums__
00023 #define __MIDIEnums__
00024
00025 namespace CLAM {
00026
00027 class MIDI
00028 {
00029 public:
00034 enum Message {
00035 eNoteOff = 0,
00036 eNoteOn = 1,
00037 ePolyAftertouch = 2,
00038 eControlChange = 3,
00039 eProgramChange = 4,
00040 eAftertouch = 5,
00041 ePitchbend = 6,
00042 eSystem = 7,
00043
00044 eNoteOnOff = 8
00045 };
00046
00047 struct MessageInfo
00048 {
00049 int length;
00050 const char* name;
00051 const char* field[3];
00052 };
00053
00058 enum SysMsg {
00059 eExclusiveStart = 0,
00060 eQuarterFrams = 1,
00061 eSongPosition = 2,
00062 eSongSelect = 3,
00063 eUndefined1 = 4,
00064 eUndefined2 = 5,
00065 eTuneRequest = 6,
00066 eExclusiveEnd = 7,
00067 eTimingCloce = 8,
00068 eTimingTice = 9,
00069 eStart = 10,
00070 eContinue = 11,
00071 eStop = 12,
00072 eUndefined3 = 13,
00073 eActiveSensing = 14,
00074 eSystemReset = 15
00075 };
00076
00081 static Message StatusByteToMessage(const unsigned char& byte)
00082 {
00083 return (Message)((byte >> 4)&7);
00084 }
00085
00090 static SysMsg StatusByteToSysMsg(const unsigned char& b)
00091 {
00092 return (SysMsg)(b&15);
00093 }
00094
00095 static const MessageInfo& GetMessageInfo(Message msg)
00096 {
00097 return sMessageInfo[int(msg)];
00098 }
00099
00100 static const MessageInfo& GetMessageInfo(int msg)
00101 {
00102 return sMessageInfo[msg];
00103 }
00104 private:
00105 static const MessageInfo sMessageInfo[9];
00106
00107 friend class MIDIDevice;
00108
00109 static const int sNBytesPerSysMsg[16];
00110
00111 };
00112
00113 }
00114
00115 #endif
00116