Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
/home/iurt/rpm/BUILD/canorus-0.7.R1002/src/core/playable.h
Go to the documentation of this file.
00001 
00008 #ifndef PLAYABLE_H_
00009 #define PLAYABLE_H_
00010 
00011 #include "core/muselement.h"
00012 #include "core/staff.h"
00013 #include "core/playablelength.h"
00014 #include "core/tuplet.h"
00015 
00016 class CAVoice;
00017 
00018 class CAPlayable : public CAMusElement {
00019 public:
00020         CAPlayable( CAPlayableLength length, CAVoice *voice, int timeStart, int timeLength=-1 );
00021         virtual ~CAPlayable();
00022 
00023         inline CAPlayableLength& playableLength() { return _playableLength; }
00024         inline void setPlayableLength( CAPlayableLength& l ) { _playableLength = l; }
00025         virtual CAPlayable* clone(CAContext* context) { CAPlayable* pl = clone(); pl->setContext(context); }
00026         virtual CAPlayable* clone(CAVoice* voice=0)=0;
00027 
00028         CATuplet *tuplet() { return _tuplet; }
00029         void setTuplet( CATuplet *t ) { _tuplet = t; }
00030 
00031         inline CAVoice *voice() { return _voice; }
00032         void setVoice(CAVoice *v);
00033         inline CAStaff* staff() { return static_cast<CAStaff*>(_context); }
00034 
00035         inline bool isFirstInTuplet() { return ( _tuplet && _tuplet->firstNote()==this); }
00036         inline bool isLastInTuplet() { return ( _tuplet && _tuplet->lastNote()==this); }
00037 
00038         void resetTime();
00039         void calculateTimeLength();
00040 
00041 protected:
00042         CAPlayableLength _playableLength;
00043         CAVoice *_voice;
00044         CATuplet *_tuplet;
00045 };
00046 #endif /* PLAYABLE_H_ */