Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

/home/pete/Work/TSE3.svn/tse3/src/tse3/KeySigTrack.h

Go to the documentation of this file.
00001 /*
00002  * @(#)KeySigTrack.h 3.00 30 May 2000
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_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, // Cb major, 7 flats
00075                 Gb  = -6, // Gb major, 6 flats
00076                 Db  = -5, // Dd major, 5 flats
00077                 Ab  = -4, // Ab major, 4 flats
00078                 Eb  = -3, // Eb major, 3 flats
00079                 Bb  = -2, // Bb major, 2 flats
00080                 F   = -1, // F major,  1 flat
00081                 C   =  0, // C major,  0 sharps
00082                 G   =  1, // G major,  1 sharp
00083                 D   =  2, // D major,  2 sharps
00084                 A   =  3, // A major,  3 sharps
00085                 E   =  4, // E major,  4 sharps
00086                 B   =  5, // B major,  5 sharps
00087                 Fs  =  6, // F# major, 6 sharps
00088                 Cs  =  7  // C# major, 7 sharps
00089             };
00090 
00096             enum KeySigIncidentalsMinor
00097             {
00098                 Abm = -7, // Cb minor, 7 flats
00099                 Fbbm= -6, // Fbb minor, 6 flats
00100                 Bbm = -5, // Dd minor, 5 flats
00101                 Gbm = -4, // Ab minor, 4 flats
00102                 Cm  = -3, // Eb minor, 3 flats
00103                 Dm  = -2, // Bb minor, 2 flats
00104                 Fm  = -1, // F minor,  1 flat
00105                 Am  =  0, // A minor,  0 sharps
00106                 Em  =  1, // G minor,  1 sharp
00107                 Bm  =  2, // D minor,  2 sharps
00108                 Fsm =  3, // A minor,  3 sharps
00109                 Csm =  4, // E minor,  4 sharps
00110                 Gsm =  5, // B minor,  5 sharps
00111                 Dsm =  6, // F# minor, 6 sharps
00112                 Asm =  7  // C# minor, 7 sharps
00113             };
00114 
00124             enum KeySigType
00125             {
00126                 Major = 0, // Represents a major key
00127                 Minor = 1  // Represents a minor key
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

Generated on Wed May 25 14:45:06 2005 for TSE3 by doxygen 1.3.2