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_ */
Represents a single sheet of paper in the document.
Definition: sheet.h:22
Tempo mark.
Definition: tempo.h:14
void insertVoice(int idx, CAVoice *voice)
Definition: staff.h:37
QList< CAMusElement * > & keySignatureRefs()
Definition: staff.h:60
CAVoice * addVoice()
Definition: staff.cpp:203
bool synchronizeVoices()
Definition: staff.cpp:346
Class which represents a voice in the staff.
Definition: voice.h:23
QList< CAMusElement * > & clefRefs()
Definition: staff.h:59
QList< CAMusElement * > _clefList
Definition: staff.h:69
const QString name()
Definition: context.h:29
CAStaff * clone(CASheet *s)
Definition: staff.cpp:51
Represents a note in the score.
Definition: note.h:18
QList< CAMusElement * > & barlineRefs()
Definition: staff.h:62
QList< CAMusElement * > _keySignatureList
Definition: staff.h:70
QList< CAMusElement * > & timeSignatureRefs()
Definition: staff.h:61
CAMusElement * next(CAMusElement *elt)
Definition: staff.cpp:215
CAMusElementType
Definition: muselement.h:23
void addVoice(CAVoice *voice)
Definition: staff.h:36
QList< CAPlayable * > getChord(int time)
Definition: staff.cpp:307
int _numberOfLines
Definition: staff.h:67
QList< CAVoice * > _voiceList
Definition: staff.h:65
void removeVoice(CAVoice *voice)
Definition: staff.h:39
An abstract class which represents every music element in the score.
Definition: muselement.h:21
bool remove(CAMusElement *elt, bool updateSignTimes)
Definition: staff.cpp:247
CAStaff(const QString name, CASheet *s, int numberOfLines=5)
Definition: staff.cpp:41
CATempo * getTempo(int time)
Definition: staff.cpp:318
Playable instances of music elements.
Definition: playable.h:18
~CAStaff()
Definition: staff.cpp:47
bool remove(CAMusElement *elt)
Definition: staff.h:45
Represents a staff in the sheet.
Definition: staff.h:25
CAMusElement * getOneEltByType(CAMusElement::CAMusElementType type, int startTime)
Definition: staff.cpp:289
CAVoice * findVoice(const QString name)
Definition: staff.cpp:257
void clear()
Definition: staff.cpp:193
void setNumberOfLines(int val)
Definition: staff.h:31
QList< CAMusElement * > getEltByType(CAMusElement::CAMusElementType type, int startTime)
Definition: staff.cpp:272
int numberOfLines()
Definition: staff.h:30
CAMusElement * previous(CAMusElement *elt)
Definition: staff.cpp:230
QList< CAMusElement * > _timeSignatureList
Definition: staff.h:71
static bool placeAutoBar(CAPlayable *elt)
Definition: staff.cpp:501
QList< CAMusElement * > _barlineList
Definition: staff.h:72
Line of music elements in the sheet.
Definition: context.h:16
const QList< CAVoice * > & voiceList()
Definition: staff.h:35
int lastTimeEnd()
Definition: staff.cpp:184