CLAM-Development
1.1
|
00001 /* 00002 * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG) 00003 * UNIVERSITAT POMPEU FABRA 00004 * 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 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 // and some special stuff 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