|
Canorus
0.7
|
00001 00008 #ifndef PLAYABLELENGTH_H_ 00009 #define PLAYABLELENGTH_H_ 00010 00011 #include <QString> 00012 00013 class CABarline; 00014 class CATimeSignature; 00015 00016 class CAPlayableLength { 00017 public: 00018 enum CAMusicLength { 00019 Undefined = -1, 00020 Breve = 0, 00021 Whole = 1, 00022 Half = 2, 00023 Quarter = 4, 00024 Eighth = 8, 00025 Sixteenth = 16, 00026 ThirtySecond = 32, 00027 SixtyFourth = 64, 00028 HundredTwentyEighth = 128 00029 }; 00030 00031 CAPlayableLength(); 00032 CAPlayableLength( CAMusicLength l, int dotted=0 ); 00033 00034 inline const CAMusicLength musicLength() { return _musicLength; } 00035 inline const int dotted() { return _dotted; } 00036 00037 inline void setMusicLength( const CAMusicLength l ) { _musicLength = l; } 00038 inline void setDotted( const int d ) { _dotted = d; } 00039 00040 bool operator==(CAPlayableLength); 00041 bool operator!=(CAPlayableLength); 00042 00043 static const QString musicLengthToString( CAMusicLength length ); 00044 static CAMusicLength musicLengthFromString( const QString length ); 00045 00046 static const int playableLengthToTimeLength( CAPlayableLength length ); 00047 inline static const int musicLengthToTimeLength( CAMusicLength l ) { 00048 return playableLengthToTimeLength( CAPlayableLength(l) ); 00049 } 00050 static QList<CAPlayableLength> timeLengthToPlayableLengthList( int timeLength, bool longNotesFirst = true, int dotsLimit = 4 ); 00051 static QList<CAPlayableLength> matchToBars( CAPlayableLength len, int timeStart, CABarline *lastBarline, CATimeSignature *ts, int dotsLimit = 4 ); 00052 00053 private: 00054 CAMusicLength _musicLength; // note, rest length (half, whole, quarter) 00055 int _dotted; // number of dots 00056 }; 00057 #endif /* PLAYABLELENGTH_H_ */
1.8.0