00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef XMIDIEVENT_H_INCLUDED
00020 #define XMIDIEVENT_H_INCLUDED
00021
00022
00023 #define MIDI_STATUS_NOTE_OFF 0x8
00024 #define MIDI_STATUS_NOTE_ON 0x9
00025 #define MIDI_STATUS_AFTERTOUCH 0xA
00026 #define MIDI_STATUS_CONTROLLER 0xB
00027 #define MIDI_STATUS_PROG_CHANGE 0xC
00028 #define MIDI_STATUS_PRESSURE 0xD
00029 #define MIDI_STATUS_PITCH_WHEEL 0xE
00030 #define MIDI_STATUS_SYSEX 0xF
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #define XMIDI_CONTROLLER_CHAN_LOCK 0x6e
00048
00049 #define XMIDI_CONTROLLER_CHAN_LOCK_PROT 0x6f // Channel Lock Protect
00050 #define XMIDI_CONTROLLER_VOICE_PROT 0x70 // Voice Protect
00051 #define XMIDI_CONTROLLER_TIMBRE_PROT 0x71 // Timbre Protect
00052 #define XMIDI_CONTROLLER_BANK_CHANGE 0x72 // Bank Change
00053 #define XMIDI_CONTROLLER_IND_CTRL_PREFIX 0x73 // Indirect Controller Prefix
00054 #define XMIDI_CONTROLLER_FOR_LOOP 0x74 // For Loop
00055 #define XMIDI_CONTROLLER_NEXT_BREAK 0x75 // Next/Break
00056 #define XMIDI_CONTROLLER_CLEAR_BB_COUNT 0x76 // Clear Beat/Bar Count
00057 #define XMIDI_CONTROLLER_CALLBACK_TRIG 0x77 // Callback Trigger
00058 #define XMIDI_CONTROLLER_SEQ_BRANCH_INDEX 0x78 // Sequence Branch Index
00059
00060
00061
00062
00063 #define XMIDI_MAX_FOR_LOOP_COUNT 4
00064
00065 struct XMidiEvent
00066 {
00067 int time;
00068 unsigned char status;
00069
00070 unsigned char data[2];
00071
00072 union
00073 {
00074 struct {
00075 uint32 len;
00076 unsigned char *buffer;
00077 } sysex_data;
00078
00079 struct {
00080 int duration;
00081 XMidiEvent *next_note;
00082 uint32 note_time;
00083 uint8 actualvel;
00084 } note_on;
00085
00086 struct {
00087 XMidiEvent *next_branch;
00088 } branch_index;
00089
00090 } ex;
00091
00092 XMidiEvent *next;
00093
00094
00095
00096
00097
00098
00099
00100
00101 template<class T>
00102 static inline T* Malloc(size_t num=1)
00103 {
00104 #ifdef WIN32
00105 return static_cast<T*>(std::malloc(num));
00106 #else
00107 return static_cast<T*>(::operator new(num));
00108 #endif
00109 }
00110
00111 template<class T>
00112 static inline T* Calloc(size_t num=1,size_t sz=0)
00113 {
00114 if(!sz)
00115 sz=sizeof(T);
00116 #ifdef WIN32
00117 return static_cast<T*>(std::calloc(num,sz));
00118 #else
00119 size_t total=sz*num;
00120 T *tmp=Malloc<T>(total);
00121 std::memset(tmp,0,total);
00122 return tmp;
00123 #endif
00124 }
00125
00126 static inline void Free(void *ptr)
00127 {
00128 #ifdef WIN32
00129 std::free(ptr);
00130 #else
00131 ::operator delete(ptr);
00132 #endif
00133 }
00134 };
00135
00136 #endif //XMIDIEVENT_H_INCLUDED