Canorus  0.0
staff.h
Go to the documentation of this file.
1 
8 #ifndef STAFF_H_
9 #define STAFF_H_
10 
11 #include <QList>
12 #include <QString>
13 
14 class QPainter;
15 
16 #include "score/context.h"
17 #include "score/muselement.h"
18 
19 class CASheet;
20 class CAContext;
21 class CAVoice;
22 class CANote;
23 class CATempo;
24 
25 class CAStaff : public CAContext {
26 public:
27  CAStaff( const QString name, CASheet *s, int numberOfLines = 5);
28  ~CAStaff();
29 
30  inline int numberOfLines() { return _numberOfLines; }
31  inline void setNumberOfLines(int val) { _numberOfLines = val; }
32  void clear();
33  CAStaff *clone( CASheet *s );
34 
35  inline const QList<CAVoice*>& voiceList() { return _voiceList; }
36  inline void addVoice(CAVoice *voice) { _voiceList << voice; }
37  inline void insertVoice(int idx, CAVoice *voice) { _voiceList.insert(idx, voice); }
38  CAVoice* addVoice();
39  inline void removeVoice(CAVoice *voice) { _voiceList.removeAll(voice); }
40  CAVoice *findVoice(const QString name);
41 
44  bool remove( CAMusElement *elt, bool updateSignTimes );
45  bool remove( CAMusElement *elt ) { return remove(elt, true); }
46 
47  int lastTimeEnd();
48  QList<CAMusElement*> getEltByType( CAMusElement::CAMusElementType type, int startTime );
50 
51  QList<CAPlayable*> getChord( int time );
52  CATempo *getTempo( int time );
53 
54  bool synchronizeVoices();
55 
56  static bool placeAutoBar( CAPlayable* elt );
57 
58  // Functions to keep list of references of signature events for a faster look up.
59  inline QList<CAMusElement *>& clefRefs() { return _clefList; }
60  inline QList<CAMusElement *>& keySignatureRefs() { return _keySignatureList; }
61  inline QList<CAMusElement *>& timeSignatureRefs() { return _timeSignatureList; }
62  inline QList<CAMusElement *>& barlineRefs() { return _barlineList; }
63 
64 private:
65  QList<CAVoice *> _voiceList;
66 
68 
69  QList<CAMusElement *> _clefList;
70  QList<CAMusElement *> _keySignatureList;
71  QList<CAMusElement *> _timeSignatureList;
72  QList<CAMusElement *> _barlineList;
73 };
74 #endif /* STAFF_H_ */
rest.h
CAMusElement::CAMusElementType
CAMusElementType
Definition: muselement.h:23
CAStaff::voiceList
const QList< CAVoice * > & voiceList()
Definition: staff.h:35
CAPlayable::staff
CAStaff * staff()
Definition: playable.h:33
CAContext::Staff
@ Staff
Definition: context.h:23
CAStaff::getEltByType
QList< CAMusElement * > getEltByType(CAMusElement::CAMusElementType type, int startTime)
Definition: staff.cpp:272
CATuplet::number
int number()
Definition: tuplet.h:27
CAPlayable::isLastInTuplet
bool isLastInTuplet()
Definition: playable.h:36
CAStaff::clear
void clear()
Definition: staff.cpp:193
note.h
CANote::phrasingSlurStart
CASlur * phrasingSlurStart()
Definition: note.h:51
CAVoice::insert
bool insert(CAMusElement *eltAfter, CAMusElement *elt, bool addToChord=false)
Definition: voice.cpp:154
CAStaff::next
CAMusElement * next(CAMusElement *elt)
Definition: staff.cpp:215
CAContext::_contextType
CAContextType _contextType
Definition: context.h:47
CAVoice::previousByType
CAMusElement * previousByType(CAMusElement::CAMusElementType type, CAMusElement *elt)
Definition: voice.cpp:753
CATuplet::actualNumber
int actualNumber()
Definition: tuplet.h:30
CANote
Represents a note in the score.
Definition: note.h:18
CAMusElement::Clef
@ Clef
Definition: muselement.h:29
CANote::setPhrasingSlurEnd
void setPhrasingSlurEnd(CASlur *pSlurEnd)
Definition: note.h:62
CAVoice
Class which represents a voice in the staff.
Definition: voice.h:23
CAStaff::previous
CAMusElement * previous(CAMusElement *elt)
Definition: staff.cpp:230
CAMusElement::Barline
@ Barline
Definition: muselement.h:28
CATimeSignature
Represents a time signature in the staff.
Definition: timesignature.h:18
CAStaff::_timeSignatureList
QList< CAMusElement * > _timeSignatureList
Definition: staff.h:71
CAStaff::getChord
QList< CAPlayable * > getChord(int time)
Definition: staff.cpp:307
CASlur::setNoteStart
void setNoteStart(CANote *noteStart)
Definition: slur.h:53
CAStaff::getOneEltByType
CAMusElement * getOneEltByType(CAMusElement::CAMusElementType type, int startTime)
Definition: staff.cpp:289
CAPlayable
Playable instances of music elements.
Definition: playable.h:18
CAContext::name
const QString name()
Definition: context.h:29
CAStaff::_numberOfLines
int _numberOfLines
Definition: staff.h:67
CAStaff::_barlineList
QList< CAMusElement * > _barlineList
Definition: staff.h:72
CAStaff::timeSignatureRefs
QList< CAMusElement * > & timeSignatureRefs()
Definition: staff.h:61
CAStaff::lastTimeEnd
int lastTimeEnd()
Definition: staff.cpp:184
CAPlayable::tuplet
CATuplet * tuplet()
Definition: playable.h:28
CAStaff::findVoice
CAVoice * findVoice(const QString name)
Definition: staff.cpp:257
CAMusElement::TimeSignature
@ TimeSignature
Definition: muselement.h:30
CAStaff::removeVoice
void removeVoice(CAVoice *voice)
Definition: staff.h:39
CANote::tieStart
CASlur * tieStart()
Definition: note.h:47
CAStaff::~CAStaff
~CAStaff()
Definition: staff.cpp:47
CATempo
Tempo mark.
Definition: tempo.h:14
CABarline::Single
@ Single
Definition: barline.h:21
CAMusElement::KeySignature
@ KeySignature
Definition: muselement.h:31
CAStaff::placeAutoBar
static bool placeAutoBar(CAPlayable *elt)
Definition: staff.cpp:501
CAStaff::clone
CAStaff * clone(CASheet *s)
Definition: staff.cpp:51
CAStaff::setNumberOfLines
void setNumberOfLines(int val)
Definition: staff.h:31
CATuplet
Class used for tuplets (triplets, duols etc.)
Definition: tuplet.h:17
CAStaff::CAStaff
CAStaff(const QString name, CASheet *s, int numberOfLines=5)
Definition: staff.cpp:41
CANote::setTieEnd
void setTieEnd(CASlur *tieEnd)
Definition: note.h:58
CAStaff
Represents a staff in the sheet.
Definition: staff.h:25
CAMusElement
An abstract class which represents every music element in the score.
Definition: muselement.h:21
CAStaff::addVoice
CAVoice * addVoice()
Definition: staff.cpp:203
CANote::slurStart
CASlur * slurStart()
Definition: note.h:49
CAStaff::_voiceList
QList< CAVoice * > _voiceList
Definition: staff.h:65
CAStaff::remove
bool remove(CAMusElement *elt, bool updateSignTimes)
Definition: staff.cpp:247
CAStaff::_keySignatureList
QList< CAMusElement * > _keySignatureList
Definition: staff.h:70
CAMusElement::timeEnd
int timeEnd()
Definition: muselement.h:55
CARest::composeRests
static QList< CARest * > composeRests(int timeLength, int timeStart, CAVoice *voice=0, CARestType=Hidden)
Definition: rest.cpp:96
CAStaff::clefRefs
QList< CAMusElement * > & clefRefs()
Definition: staff.h:59
CATimeSignature::barDuration
int barDuration()
Definition: timesignature.cpp:143
CAMusElement::Note
@ Note
Definition: muselement.h:25
timesignature.h
context.h
barline.h
CANote::setSlurEnd
void setSlurEnd(CASlur *slurEnd)
Definition: note.h:60
CAMusElement::timeStart
virtual int timeStart() const
Definition: muselement.h:51
CAVoice::staff
CAStaff * staff()
Definition: voice.h:29
muselement.h
CAContext
Line of music elements in the sheet.
Definition: context.h:16
CAStaff::remove
bool remove(CAMusElement *elt)
Definition: staff.h:45
CAStaff::addVoice
void addVoice(CAVoice *voice)
Definition: staff.h:36
CAStaff::barlineRefs
QList< CAMusElement * > & barlineRefs()
Definition: staff.h:62
tempo.h
CABarline
Music element which represents a barline in the score.
Definition: barline.h:17
tuplet.h
voice.h
CASheet
Represents a single sheet of paper in the document.
Definition: sheet.h:22
CAStaff::numberOfLines
int numberOfLines()
Definition: staff.h:30
CASlur::clone
CASlur * clone(CAContext *context=0)
Definition: slur.cpp:74
staff.h
CAPlayable::clone
virtual CAPlayable * clone(CAContext *context)
Definition: playable.h:25
CASlur
Slur, Tie, Phrasing slur and Laissez vibrer tie This class represents any type of slur....
Definition: slur.h:18
CAStaff::insertVoice
void insertVoice(int idx, CAVoice *voice)
Definition: staff.h:37
CAMusElement::musElementType
CAMusElementType musElementType()
Definition: muselement.h:46
CAPlayable::voice
CAVoice * voice()
Definition: playable.h:31
CAStaff::_clefList
QList< CAMusElement * > _clefList
Definition: staff.h:69
CAStaff::synchronizeVoices
bool synchronizeVoices()
Definition: staff.cpp:346
CAContext::_name
QString _name
Definition: context.h:46
CASlur::setNoteEnd
void setNoteEnd(CANote *noteEnd)
Definition: slur.h:54
CAStaff::keySignatureRefs
QList< CAMusElement * > & keySignatureRefs()
Definition: staff.h:60
CAStaff::getTempo
CATempo * getTempo(int time)
Definition: staff.cpp:318