|
Canorus
0.7
|
00001 00008 #ifndef DIATONICKEY_H_ 00009 #define DIATONICKEY_H_ 00010 00011 #include "core/diatonicpitch.h" 00012 #include <QString> 00013 #include <QList> 00014 00015 class CADiatonicKey { 00016 public: 00017 enum CAGender { 00018 Major, 00019 Minor 00020 }; 00021 00022 enum CAShape { 00023 Natural, 00024 Harmonic, 00025 Melodic 00026 }; 00027 00028 CADiatonicKey(); 00029 CADiatonicKey( const QString& key ); 00030 CADiatonicKey( const int& numberOfAccs, const CAGender& gender ); 00031 CADiatonicKey( const CADiatonicPitch& pitch, const CAGender& gender ); 00032 CADiatonicKey( const CADiatonicPitch& pitch, const CAGender& gender, const CAShape& shape ); 00033 00034 bool operator==(CADiatonicKey); 00035 inline bool operator!=(CADiatonicKey p) { return !operator==(p); } 00036 #ifndef SWIG 00037 void operator=(const QString& key); 00038 #endif 00039 00040 CADiatonicKey operator+(CAInterval); 00041 00042 inline CADiatonicPitch diatonicPitch() { return _diatonicPitch; } 00043 inline const CAGender gender() { return _gender; } 00044 inline const CAShape shape() { return _shape; } 00045 00046 inline void setDiatonicPitch( const CADiatonicPitch p ) { _diatonicPitch = p; } 00047 inline void setGender( const CAGender g ) { _gender = g; } 00048 inline void setShape( const CAShape s ) { _shape = s; } 00049 00050 static const QString shapeToString( CAShape ); 00051 static CAShape shapeFromString( const QString ); 00052 static const QString genderToString( CAGender ); 00053 static CAGender genderFromString( const QString ); 00054 00055 static const QString diatonicKeyToString( CADiatonicKey k ); 00056 static CADiatonicKey diatonicKeyFromString( const QString ); 00057 00058 int numberOfAccs(); 00059 QList<int> accsMatrix(); 00060 int noteAccs( int noteName ); 00061 00062 private: 00063 CADiatonicPitch _diatonicPitch; // pitch of the key 00064 CAGender _gender; // major, minor 00065 CAShape _shape; // natural, harmonic, melodic 00066 }; 00067 #endif /* DIATONICKEY_H_ */
1.8.0