Canorus  0.0
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 "score/muselement.h"
15 #include "score/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_ */
CAFunctionMark::VII
@ VII
Definition: functionmark.h:28
CAMusElement::context
CAContext * context()
Definition: muselement.h:48
CAFunctionMark::CAFunctionMark
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)
Definition: functionmark.cpp:25
CAFunctionMark::addedDegrees
QList< int > addedDegrees()
Definition: functionmark.h:50
CAFunctionMark::isChordAreaMinor
bool isChordAreaMinor()
Definition: functionmark.h:67
CAFunctionMark::setChordArea
void setChordArea(CAFunctionType chordArea)
Definition: functionmark.h:53
CAFunctionMark::isMinor
bool isMinor()
Definition: functionmark.h:66
CAFunctionMark::D
@ D
Definition: functionmark.h:31
CAFunctionMark::setAlteredDegrees
void setAlteredDegrees(QList< int > degrees)
Definition: functionmark.h:57
CAFunctionMark::_minor
bool _minor
Definition: functionmark.h:85
CAFunctionMark::isEmpty
bool isEmpty()
Definition: functionmark.h:63
CAFunctionMark::_ellipseSequence
bool _ellipseSequence
Definition: functionmark.h:86
CAFunctionMark::setTonicDegree
void setTonicDegree(CAFunctionType tonicDegree)
Definition: functionmark.h:55
CAMusElement::markList
const QList< CAMark * > markList()
Definition: muselement.h:70
CAFunctionMark::K
@ K
Definition: functionmark.h:35
functionmarkcontext.h
CAFunctionMark::_chordArea
CAFunctionType _chordArea
Definition: functionmark.h:79
CADiatonicKey
Musical key.
Definition: diatonickey.h:15
CAFunctionMark::Undefined
@ Undefined
Definition: functionmark.h:21
CAFunctionMark::compare
int compare(CAMusElement *function)
Definition: functionmark.cpp:77
CAFunctionMark
Represents a function mark in the score.
Definition: functionmark.h:18
CAFunctionMark::setChordAreaMinor
void setChordAreaMinor(bool minor)
Definition: functionmark.h:54
CAFunctionMark::_tonicDegree
CAFunctionType _tonicDegree
Definition: functionmark.h:81
CAFunctionMark::II
@ II
Definition: functionmark.h:23
functionmark.h
CAFunctionMark::chordArea
CAFunctionType chordArea()
Definition: functionmark.h:47
CAFunctionMarkContext
Context for function marks.
Definition: functionmarkcontext.h:19
CAMusElement::timeLength
virtual int timeLength() const
Definition: muselement.h:53
CAFunctionMark::N
@ N
Definition: functionmark.h:33
CAFunctionMark::L
@ L
Definition: functionmark.h:34
CAFunctionMark::_alteredDegrees
QList< int > _alteredDegrees
Definition: functionmark.h:83
CAFunctionMark::isTonicDegreeMinor
bool isTonicDegreeMinor()
Definition: functionmark.h:68
CAFunctionMark::VI
@ VI
Definition: functionmark.h:27
CAMusElement::addMark
void addMark(CAMark *mark)
Definition: muselement.cpp:135
CAFunctionMark::IV
@ IV
Definition: functionmark.h:25
CAFunctionMark::_function
CAFunctionType _function
Definition: functionmark.h:77
CAFunctionMark::clear
void clear()
Definition: functionmark.cpp:70
CAMusElement::FunctionMark
@ FunctionMark
Definition: muselement.h:35
CAFunctionMark::alteredDegrees
QList< int > alteredDegrees()
Definition: functionmark.h:49
CAFunctionMark::clone
CAFunctionMark * clone(CAContext *context=0)
Definition: functionmark.cpp:56
diatonickey.h
CAFunctionMark::V
@ V
Definition: functionmark.h:26
CAFunctionMark::CAFunctionType
CAFunctionType
Definition: functionmark.h:20
CAMusElement
An abstract class which represents every music element in the score.
Definition: muselement.h:21
CAFunctionMark::III
@ III
Definition: functionmark.h:24
CAFunctionMark::function
CAFunctionType function()
Definition: functionmark.h:45
CAFunctionMark::functionTypeFromString
static CAFunctionType functionTypeFromString(const QString)
Definition: functionmark.cpp:163
CAFunctionMark::setFunction
void setFunction(CAFunctionType function)
Definition: functionmark.h:51
CAFunctionMark::T
@ T
Definition: functionmark.h:29
CAFunctionMark::isPartOfEllipse
bool isPartOfEllipse()
Definition: functionmark.h:69
CAFunctionMark::fmContext
CAFunctionMarkContext * fmContext()
Definition: functionmark.h:43
CAFunctionMark::setMinor
void setMinor(bool minor)
Definition: functionmark.h:59
CAFunctionMark::tonicDegree
CAFunctionType tonicDegree()
Definition: functionmark.h:48
CAFunctionMark::key
CADiatonicKey key()
Definition: functionmark.h:46
CAFunctionMark::_chordAreaMinor
bool _chordAreaMinor
Definition: functionmark.h:80
CAMusElement::timeStart
virtual int timeStart() const
Definition: muselement.h:51
muselement.h
CAContext
Line of music elements in the sheet.
Definition: context.h:16
CAFunctionMark::functionTypeToString
static const QString functionTypeToString(CAFunctionType)
Definition: functionmark.cpp:141
CAFunctionMark::setAddedDegrees
void setAddedDegrees(QList< int > degrees)
Definition: functionmark.h:58
CAFunctionMark::_addedDegrees
QList< int > _addedDegrees
Definition: functionmark.h:84
CAFunctionMark::setTonicDegreeMinor
void setTonicDegreeMinor(bool minor)
Definition: functionmark.h:56
CAMusElement::_musElementType
CAMusElementType _musElementType
Definition: muselement.h:87
CAMark
Marks that depend on other music elements.
Definition: mark.h:15
CAFunctionMark::isSideDegree
bool isSideDegree()
Definition: functionmark.cpp:43
CAFunctionMark::~CAFunctionMark
~CAFunctionMark()
Definition: functionmark.cpp:40
CAFunctionMark::_tonicDegreeMinor
bool _tonicDegreeMinor
Definition: functionmark.h:82
CAFunctionMark::setKey
void setKey(CADiatonicKey key)
Definition: functionmark.h:52
CAFunctionMark::I
@ I
Definition: functionmark.h:22
CAFunctionMark::setEllipse
void setEllipse(bool ellipse)
Definition: functionmark.h:60
CAFunctionMark::setAlterations
void setAlterations(const QString alterations)
Definition: functionmark.cpp:100
CAMusElement::musElementType
CAMusElementType musElementType()
Definition: muselement.h:46
mark.h
CAFunctionMark::F
@ F
Definition: functionmark.h:32
CAFunctionMark::_key
CADiatonicKey _key
Definition: functionmark.h:78
CAFunctionMark::S
@ S
Definition: functionmark.h:30