Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
note.h
Go to the documentation of this file.
1 
8 #ifndef NOTE_H_
9 #define NOTE_H_
10 
11 #include "core/muselement.h"
12 #include "core/playable.h"
13 #include "core/slur.h"
14 #include "core/diatonicpitch.h"
15 
16 class CAVoice;
17 
18 class CANote : public CAPlayable {
19 public:
24  StemPreferred // voice's direction
25  };
26 
29 
30  virtual ~CANote();
31 
33 
35  inline void setDiatonicPitch( CADiatonicPitch& pitch ) {
36  _diatonicPitch = pitch;
37  updateTies();
38  }
39 
41  void setStemDirection(CAStemDirection direction);
42 
43  int notePosition();
44 
45  inline CASlur *tieStart() { return _tieStart; }
46  inline CASlur *tieEnd() { return _tieEnd; }
47  inline CASlur *slurStart() { return _slurStart; }
48  inline CASlur *slurEnd() { return _slurEnd; }
50  inline CASlur *phrasingSlurEnd() { return _phrasingSlurEnd; }
51 
54 
55  inline void setTieStart( CASlur *tieStart ) { _tieStart = tieStart; }
56  inline void setTieEnd( CASlur *tieEnd ) { _tieEnd = tieEnd; }
58  inline void setSlurEnd( CASlur *slurEnd ) { _slurEnd = slurEnd; }
59  inline void setPhrasingSlurStart( CASlur *pSlurStart ) { _phrasingSlurStart = pSlurStart; }
60  inline void setPhrasingSlurEnd( CASlur *pSlurEnd ) { _phrasingSlurEnd = pSlurEnd; }
61 
62  void updateTies();
63 
64  bool isPartOfChord();
65  bool isLastInChord();
66  bool isFirstInChord();
67  QList<CANote*> getChord();
68 
70  void setForceAccidentals(bool force) { _forceAccidentals = force; }
71 
72  static const QString generateNoteName(int pitch, int accs);
73 
74  static const QString stemDirectionToString(CAStemDirection);
75  static CAStemDirection stemDirectionFromString(const QString);
76 
77  int compare(CAMusElement* elt);
78 
79 private:
82  bool _forceAccidentals; // Always draw notes accidentals.
83 
85  // Slurs and ties //
93 };
94 #endif /* NOTE_H_*/