00001
00008 #include "core/crescendo.h"
00009 #include "core/note.h"
00010
00021 CACrescendo::CACrescendo( int volume, CANote *note, CACrescendoType t, int timeStart, int timeLength )
00022 : CAMark( CAMark::Crescendo, note, timeStart, timeLength ) {
00023 setFinalVolume(volume);
00024 setCrescendoType(t);
00025 }
00026
00027 CACrescendo::~CACrescendo() {
00028 }
00029
00030 CAMusElement* CACrescendo::clone() {
00031 return new CACrescendo( finalVolume(), static_cast<CANote*>(associatedElement()), crescendoType(), timeStart(), timeLength() );
00032 }
00033
00034 int CACrescendo::compare( CAMusElement *elt ) {
00035 if (elt->musElementType()!=CAMusElement::Mark)
00036 return -2;
00037
00038 if (static_cast<CAMark*>(elt)->markType()!=CAMark::Crescendo)
00039 return -1;
00040
00041 if (static_cast<CACrescendo*>(elt)->finalVolume()!=finalVolume())
00042 return 1;
00043
00044 if (static_cast<CACrescendo*>(elt)->crescendoType()!=crescendoType())
00045 return 1;
00046
00047 return 0;
00048 }
00049
00050 const QString CACrescendo::crescendoTypeToString( CACrescendoType t ) {
00051 switch (t) {
00052 case Crescendo:
00053 return "Crescendo";
00054 case Decrescendo:
00055 return "Decrescendo";
00056 }
00057 }
00058
00059 CACrescendo::CACrescendoType CACrescendo::crescendoTypeFromString( const QString c ) {
00060 if (c=="Crescendo") {
00061 return Crescendo;
00062 } else
00063 if (c=="Decrescendo") {
00064 return Decrescendo;
00065 }
00066 }