00001 /* 00002 * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG) 00003 * UNIVERSITAT POMPEU FABRA 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * MIDIFileReader C++ classes 00020 * This code is part of the CLAM library, but also usable stand-alone. 00021 * Maarten de Boer <mdeboer@iua.upf.es> 00022 * 00023 */ 00024 #ifndef __MIDIEvent__ 00025 #define __MIDIEvent__ 00026 00027 #include <CLAM/MIDIMessage.hxx> 00028 00029 namespace MIDI 00030 { 00031 00032 class Event 00033 /* a midi event is a time-stamped midi message */ 00034 { 00035 private: 00036 Message mMessage; 00037 Ticks mTicks; 00038 public: 00039 Event() 00040 { 00041 mTicks = 0; 00042 } 00043 00044 Event(const Message& m,const Ticks& t):mMessage(m),mTicks(t) 00045 { 00046 } 00047 00048 Byte operator [] (int i) const { return mMessage[i]; } 00049 00050 Ticks GetTicks(void) const { return mTicks; } 00051 }; 00052 00053 00054 /* meta and sysex events are really different, can be any length, etc 00055 ** so we subclass Event for them 00056 */ 00057 00058 class MetaEvent:public Event 00059 { 00060 public: 00061 Byte *mData; 00062 MetaEvent(const Message& m,const Ticks& t,int datasize):Event(m,t) 00063 { 00064 mData = new Byte[datasize]; 00065 } 00066 }; 00067 00068 class SysExEvent:public Event 00069 { 00070 public: 00071 Byte *mData; 00072 SysExEvent(const Message& m,const Ticks& t,int datasize):Event(m,t) 00073 { 00074 mData = new Byte[datasize]; 00075 } 00076 }; 00077 00078 } 00079 00080 #endif 00081