00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __MIDITrack__
00025 #define __MIDITrack__
00026
00027 #include <list>
00028 #include "MIDIEvent.hxx"
00029
00030 namespace MIDI
00031 {
00032
00033 class Track
00034 {
00035 private:
00036
00037 std::list<Event*> mEventList;
00038
00039
00040 char* mName;
00041
00042 public:
00043 Track(void)
00044 :mName(0)
00045 {
00046 }
00047
00048 ~Track(void)
00049 {
00050 if (mName) delete mName;
00051 }
00052
00053 void Add(Event* e)
00054 {
00055 mEventList.push_back(e);
00056 }
00057
00058 void Name(const Byte* ptr, int len)
00059 {
00060 if (mName) delete mName;
00061 mName = new char[len+1];
00062 for (int i=0;i<len;i++) mName[i] = ptr[i];
00063 mName[len] = 0;
00064 }
00065
00066
00067
00068 typedef std::list<Event*>::const_iterator EventIterator;
00069
00070 EventIterator Begin(void) { return mEventList.begin(); }
00071 EventIterator End(void) { return mEventList.end(); }
00072
00073 bool HasTempoEvents(void)
00074 {
00075 EventIterator it = Begin();
00076
00077 while (it!=End())
00078 {
00079 const Event &ev = **it;
00080 if ( ev[0]==0xFF && ev[1]==0x51 ) return true;
00081 it++;
00082 }
00083 return false;
00084 }
00085
00086 };
00087
00088 }
00089
00090 #endif
00091