|
Canorus
0.7
|
00001 00008 #ifndef FUNCTIONMARK_H_ 00009 #define FUNCTIONMARK_H_ 00010 00011 #include <QList> 00012 #include <QString> 00013 00014 #include "core/muselement.h" 00015 #include "core/diatonickey.h" 00016 #include "core/functionmarkcontext.h" 00017 00018 class CAFunctionMark : public CAMusElement { 00019 public: 00020 enum CAFunctionType { 00021 Undefined=0,// no degree - extend the previous one 00022 I=1, // 1st 00023 II=2, // 2nd 00024 III=3, // 3rd 00025 IV=4, // 4th 00026 V=5, // 5th 00027 VI=6, // 6th 00028 VII=7, // 7th 00029 T=8, // Tonic 00030 S=9, // Subdominant 00031 D=10, // Dominant 00032 F=11, // Phrygian (F for Frigio in Italian) 00033 N=12, // Napolitan 00034 L=13, // Lidian 00035 K=14 // Cadenze chord (see http://en.wikipedia.org/wiki/Cadence_%28music%29) 00036 }; 00037 00038 // addedDegrees and alteredDegrees are generated from alterations parameter 00039 CAFunctionMark(CAFunctionType function, bool minor, const CADiatonicKey key, CAFunctionMarkContext* context, int timeStart, int timeLength, CAFunctionType chordArea=Undefined, bool chordAreaMinor=false, CAFunctionType tonicDegree=T, bool tonicDegreeMinor=false, const QString alterations="", bool ellipseSequence=false); 00040 CAFunctionMark* clone(CAContext* context=0); 00041 void clear(); // same as in CASyllable 00042 ~CAFunctionMark(); 00043 inline CAFunctionMarkContext *fmContext() { return static_cast<CAFunctionMarkContext*>(context()); } 00044 00045 CAFunctionType function() { return _function; } 00046 CADiatonicKey key() { return _key; } 00047 CAFunctionType chordArea() { return _chordArea; } 00048 CAFunctionType tonicDegree() { return _tonicDegree; } 00049 QList<int> alteredDegrees() { return _alteredDegrees; } 00050 QList<int> addedDegrees() { return _addedDegrees; } 00051 void setFunction(CAFunctionType function) { _function = function; } 00052 void setKey(CADiatonicKey key) { _key = key; } 00053 void setChordArea(CAFunctionType chordArea) { _chordArea = chordArea; } 00054 void setChordAreaMinor(bool minor) { _chordAreaMinor = minor; } 00055 void setTonicDegree(CAFunctionType tonicDegree) { _tonicDegree = tonicDegree; } 00056 void setTonicDegreeMinor(bool minor) { _tonicDegreeMinor = minor; } 00057 void setAlteredDegrees(QList<int> degrees) { _alteredDegrees = degrees; } 00058 void setAddedDegrees(QList<int> degrees) { _addedDegrees = degrees; } 00059 void setMinor(bool minor) { _minor = minor; } 00060 void setEllipse(bool ellipse) { _ellipseSequence = ellipse; } 00061 void setAlterations(const QString alterations); 00062 00063 inline bool isEmpty() { return (function()==Undefined && chordArea()==Undefined && tonicDegree()==T && !alteredDegrees().size() && !addedDegrees().size()); } 00064 bool isSideDegree(); 00065 00066 bool isMinor() { return _minor; } 00067 bool isChordAreaMinor() { return _chordAreaMinor; } 00068 bool isTonicDegreeMinor() { return _tonicDegreeMinor; } 00069 bool isPartOfEllipse() { return _ellipseSequence; } 00070 00071 int compare(CAMusElement *function); 00072 00073 static const QString functionTypeToString(CAFunctionType); 00074 static CAFunctionType functionTypeFromString(const QString); 00075 00076 private: 00077 CAFunctionType _function; // Function name 00078 CADiatonicKey _key; // C for C-Major, g for g-minor, bes for b-flat-minor, Fis for F-sharp-Major etc. 00079 CAFunctionType _chordArea; // Side degrees have undetermined chord locations (eg. 6th can be treated as chord of Subdominant or Tonic) 00080 bool _chordAreaMinor; // Is chord area minor? 00081 CAFunctionType _tonicDegree; // Used when doing tonicization (see http://en.wikipedia.org/wiki/Tonicization). This value is always set if the function name is set. 00082 bool _tonicDegreeMinor; // Is tonic degree minor? 00083 QList<int> _alteredDegrees; // Degree of the chord which are altered according to the current key. These marks are usually written below the function name, eg. -3, -7 for German chord 00084 QList<int> _addedDegrees; // Degrees of the chord which are added to or substracted from the basic. eg. sixte ajoutée in cadence 00085 bool _minor; // Should the function have a circle drawn? 00086 bool _ellipseSequence; // Function is part of ellipse? 00087 }; 00088 #endif /* FUNCTIONMARK_H_ */
1.8.0