00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef TSE3_KEYSIGTRACK_H
00018 #define TSE3_KEYSIGTRACK_H
00019
00020 #include "tse3/listen/KeySigTrack.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 KeySig
00050 {
00051 public:
00052
00072 enum KeySigIncidentals
00073 {
00074 Cb = -7,
00075 Gb = -6,
00076 Db = -5,
00077 Ab = -4,
00078 Eb = -3,
00079 Bb = -2,
00080 F = -1,
00081 C = 0,
00082 G = 1,
00083 D = 2,
00084 A = 3,
00085 E = 4,
00086 B = 5,
00087 Fs = 6,
00088 Cs = 7
00089 };
00090
00096 enum KeySigIncidentalsMinor
00097 {
00098 Abm = -7,
00099 Fbbm= -6,
00100 Bbm = -5,
00101 Gbm = -4,
00102 Cm = -3,
00103 Dm = -2,
00104 Fm = -1,
00105 Am = 0,
00106 Em = 1,
00107 Bm = 2,
00108 Fsm = 3,
00109 Csm = 4,
00110 Gsm = 5,
00111 Dsm = 6,
00112 Asm = 7
00113 };
00114
00124 enum KeySigType
00125 {
00126 Major = 0,
00127 Minor = 1
00128 };
00129
00136 KeySig(int incidentals = C, int type = Major)
00137 : incidentals(incidentals), type(type) {}
00138
00142 int incidentals;
00143
00147 int type;
00148
00149 int operator==(const KeySig &k) const
00150 {
00151 return (incidentals == k.incidentals) && (type == k.type);
00152 }
00153 };
00154
00167 class KeySigTrack : public EventTrack<KeySig>,
00168 public Serializable
00169 {
00170 public:
00171
00175 KeySigTrack();
00176 virtual ~KeySigTrack();
00177
00187 bool status() const { return _status; }
00188
00195 void setStatus(bool s) { _status = s; }
00196
00200 virtual PlayableIterator *iterator(Clock index);
00201
00205 virtual Clock lastClock() const;
00206
00210 virtual void save(std::ostream &o, int i) const;
00211
00215 virtual void load(std::istream &i, SerializableLoadInfo &info);
00216
00217 private:
00218
00219 KeySigTrack &operator=(const KeySigTrack &);
00220 KeySigTrack(const KeySigTrack &);
00221
00225 void loadEvents(std::istream &i, int filePPQN);
00226
00227 bool _status;
00228 };
00229 }
00230
00231 #endif