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