Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
functionmark.h
Go to the documentation of this file.
1 
8 #ifndef FUNCTIONMARK_H_
9 #define FUNCTIONMARK_H_
10 
11 #include <QList>
12 #include <QString>
13 
14 #include "core/muselement.h"
15 #include "core/diatonickey.h"
17 
18 class CAFunctionMark : public CAMusElement {
19 public:
21  Undefined=0,// no degree - extend the previous one
22  I=1, // 1st
23  II=2, // 2nd
24  III=3, // 3rd
25  IV=4, // 4th
26  V=5, // 5th
27  VI=6, // 6th
28  VII=7, // 7th
29  T=8, // Tonic
30  S=9, // Subdominant
31  D=10, // Dominant
32  F=11, // Phrygian (F for Frigio in Italian)
33  N=12, // Napolitan
34  L=13, // Lidian
35  K=14 // Cadenze chord (see http://en.wikipedia.org/wiki/Cadence_%28music%29)
36  };
37 
38  // addedDegrees and alteredDegrees are generated from alterations parameter
39  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);
41  void clear(); // same as in CASyllable
43  inline CAFunctionMarkContext *fmContext() { return static_cast<CAFunctionMarkContext*>(context()); }
44 
45  CAFunctionType function() { return _function; }
46  CADiatonicKey key() { return _key; }
49  QList<int> alteredDegrees() { return _alteredDegrees; }
50  QList<int> addedDegrees() { return _addedDegrees; }
51  void setFunction(CAFunctionType function) { _function = function; }
54  void setChordAreaMinor(bool minor) { _chordAreaMinor = minor; }
56  void setTonicDegreeMinor(bool minor) { _tonicDegreeMinor = minor; }
57  void setAlteredDegrees(QList<int> degrees) { _alteredDegrees = degrees; }
58  void setAddedDegrees(QList<int> degrees) { _addedDegrees = degrees; }
59  void setMinor(bool minor) { _minor = minor; }
60  void setEllipse(bool ellipse) { _ellipseSequence = ellipse; }
61  void setAlterations(const QString alterations);
62 
63  inline bool isEmpty() { return (function()==Undefined && chordArea()==Undefined && tonicDegree()==T && !alteredDegrees().size() && !addedDegrees().size()); }
64  bool isSideDegree();
65 
66  bool isMinor() { return _minor; }
67  bool isChordAreaMinor() { return _chordAreaMinor; }
69  bool isPartOfEllipse() { return _ellipseSequence; }
70 
71  int compare(CAMusElement *function);
72 
73  static const QString functionTypeToString(CAFunctionType);
74  static CAFunctionType functionTypeFromString(const QString);
75 
76 private:
77  CAFunctionType _function; // Function name
78  CADiatonicKey _key; // C for C-Major, g for g-minor, bes for b-flat-minor, Fis for F-sharp-Major etc.
79  CAFunctionType _chordArea; // Side degrees have undetermined chord locations (eg. 6th can be treated as chord of Subdominant or Tonic)
80  bool _chordAreaMinor; // Is chord area minor?
81  CAFunctionType _tonicDegree; // Used when doing tonicization (see http://en.wikipedia.org/wiki/Tonicization). This value is always set if the function name is set.
82  bool _tonicDegreeMinor; // Is tonic degree minor?
83  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
84  QList<int> _addedDegrees; // Degrees of the chord which are added to or substracted from the basic. eg. sixte ajoutée in cadence
85  bool _minor; // Should the function have a circle drawn?
86  bool _ellipseSequence; // Function is part of ellipse?
87 };
88 #endif /* FUNCTIONMARK_H_ */