00001 /* 00002 * @(#)TimeSigTrack.h 3.00 24 May 1999 00003 * 00004 * Copyright (c) 2000 Pete Goodliffe (pete@cthree.org) 00005 * 00006 * This file is part of TSE3 - the Trax Sequencer Engine version 3.00. 00007 * 00008 * This library is modifiable/redistributable under the terms of the GNU 00009 * General Public License. 00010 * 00011 * You should have received a copy of the GNU General Public License along 00012 * with this program; see the file COPYING. If not, write to the Free Software 00013 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00014 * 00015 */ 00016 00017 #ifndef TSE3_TIMESIGTRACK_H 00018 #define TSE3_TIMESIGTRACK_H 00019 00020 #include "tse3/listen/TimeSigTrack.h" 00021 00022 #include "tse3/Notifier.h" 00023 #include "tse3/Playable.h" 00024 #include "tse3/Serializable.h" 00025 #include "tse3/EventTrack.h" 00026 00027 namespace TSE3 00028 { 00049 class TimeSig 00050 { 00051 public: 00052 00059 TimeSig(int top = 4, int bottom = 4) : top(top), bottom(bottom) {} 00060 00064 int top; 00065 00069 int bottom; 00070 00071 int operator==(const TimeSig &t) const 00072 { 00073 return (top == t.top) && (bottom == t.bottom); 00074 } 00075 }; 00076 00089 class TimeSigTrack : public EventTrack<TimeSig>, 00090 public Serializable 00091 { 00092 public: 00093 00097 TimeSigTrack(); 00098 virtual ~TimeSigTrack(); 00099 00109 bool status() const { return _status; } 00110 00117 void setStatus(bool s) { _status = s; } 00118 00128 void barBeatPulse(Clock time, int &bar, int &beat, int &pulse); 00129 00133 virtual PlayableIterator *iterator(Clock index); 00134 00138 virtual Clock lastClock() const; 00139 00143 virtual void save(std::ostream &o, int i) const; 00144 00148 virtual void load(std::istream &i, SerializableLoadInfo &info); 00149 00150 private: 00151 00152 TimeSigTrack &operator=(const TimeSigTrack &); 00153 TimeSigTrack(const TimeSigTrack &); 00154 00158 void loadEvents(std::istream &i, int filePPQN); 00159 00160 bool _status; 00161 }; 00162 } 00163 00164 #endif