00001 /* 00002 * @(#)RepeatTrack.h 3.00 22 June 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_REPEATTRACK_H 00018 #define TSE3_REPEATTRACK_H 00019 00020 #include "tse3/listen/RepeatTrack.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 { 00048 class Repeat 00049 { 00050 public: 00051 00058 Repeat(Clock c = 0, bool s = true) : repeat(c), status(s) {} 00059 00063 Clock repeat; 00064 00068 bool status; 00069 00070 int operator==(const Repeat &r) const 00071 { 00072 return repeat == r.repeat && status == r.status; 00073 } 00074 }; 00075 00090 class RepeatTrack : public EventTrack<Repeat>, 00091 public Serializable 00092 { 00093 public: 00094 00098 RepeatTrack(); 00099 virtual ~RepeatTrack(); 00100 00110 bool status() const { return _status; } 00111 00118 void setStatus(bool s) { _status = s; } 00119 00123 virtual PlayableIterator *iterator(Clock index); 00124 00128 virtual Clock lastClock() const; 00129 00133 virtual void save(std::ostream &o, int i) const; 00134 00138 virtual void load(std::istream &i, SerializableLoadInfo &info); 00139 00140 private: 00141 00145 void loadEvents(std::istream &i, int filePPQN); 00146 00147 bool _status; 00148 }; 00149 } 00150 00151 #endif