/media/hdb5/canorusNightlyBuildSystem/trunk/src/core/functionmarking.h

Go to the documentation of this file.
00001 
00008 #ifndef FUNCTIONMARKING_H_
00009 #define FUNCTIONMARKING_H_
00010 
00011 #include <QList>
00012 #include <QString>
00013 
00014 #include "core/muselement.h"
00015 
00016 class CAFunctionMarkingContext;
00017 
00018 class CAFunctionMarking : 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         CAFunctionMarking(CAFunctionType function, bool minor, const QString key, CAFunctionMarkingContext* context, int timeStart, int timeLength, CAFunctionType chordArea=Undefined, bool chordAreaMinor=false, CAFunctionType tonicDegree=T, bool tonicDegreeMinor=false, const QString alterations="", bool ellipseSequence=false);
00040         CAFunctionMarking* clone();
00041         void clear(); // same as in CASyllable
00042         ~CAFunctionMarking();
00043         
00044         CAFunctionType function() { return _function; }
00045         QString key() { return _key; }
00046         CAFunctionType chordArea() { return _chordArea; }
00047         CAFunctionType tonicDegree() { return _tonicDegree; }
00048         QList<int> alteredDegrees() { return _alteredDegrees; }
00049         QList<int> addedDegrees() { return _addedDegrees; }
00050         void setFunction(CAFunctionType function) { _function = function; }
00051         void setKey(QString key) { _key = key; }
00052         void setChordArea(CAFunctionType chordArea) { _chordArea = chordArea; }
00053         void setChordAreaMinor(bool minor) { _chordAreaMinor = minor; }
00054         void setTonicDegree(CAFunctionType tonicDegree) { _tonicDegree = tonicDegree; }
00055         void setTonicDegreeMinor(bool minor) { _tonicDegreeMinor = minor; }
00056         void setAlteredDegrees(QList<int> degrees) { _alteredDegrees = degrees; }
00057         void setAddedDegrees(QList<int> degrees) { _addedDegrees = degrees; }
00058         void setMinor(bool minor) { _minor = minor; }
00059         void setEllipse(bool ellipse) { _ellipseSequence = ellipse; }
00060         void setAlterations(const QString alterations);
00061         
00062         inline bool isEmpty() { return (function()==Undefined && chordArea()==Undefined && tonicDegree()==T && !alteredDegrees().size() && !addedDegrees().size()); }
00063         bool isSideDegree();
00064         
00065         bool isMinor() { return _minor; }
00066         bool isChordAreaMinor() { return _chordAreaMinor; }
00067         bool isTonicDegreeMinor() { return _tonicDegreeMinor; }
00068         bool isPartOfEllipse() { return _ellipseSequence; }
00069         
00070         int compare(CAMusElement *function);
00071         
00072         static const QString functionTypeToString(CAFunctionType);
00073         static CAFunctionType functionTypeFromString(const QString);
00074         
00075 private:
00076         CAFunctionType _function;               
00077         QString _key;                                   
00078         CAFunctionType _chordArea;              
00079         bool _chordAreaMinor;                   
00080         CAFunctionType _tonicDegree;    
00081         bool _tonicDegreeMinor;                 
00082         QList<int> _alteredDegrees;             
00083         QList<int> _addedDegrees;               
00084         bool _minor;                                    
00085         bool _ellipseSequence;                  
00086 };
00087 #endif /* FUNCTIONMARKING_H_*/

Generated on Sat Feb 9 13:06:25 2008 for Canorus by  doxygen 1.5.3