Canorus  0.0
note.h
Go to the documentation of this file.
1 
8 #ifndef NOTE_H_
9 #define NOTE_H_
10 
11 #include "score/muselement.h"
12 #include "score/playable.h"
13 #include "score/slur.h"
14 #include "score/diatonicpitch.h"
15 
16 class CAVoice;
17 
18 class CANote : public CAPlayable {
19 public:
25  StemPreferred // voice's direction
26  };
27 
30 
31  virtual ~CANote();
32 
34 
36  inline void setDiatonicPitch( CADiatonicPitch pitch ) {
37  _diatonicPitch = pitch;
38  updateTies();
39  }
40  inline int midiPitch() { return _diatonicPitch.midiPitch(); }
41 
43  void setStemDirection(CAStemDirection direction);
44 
45  int notePosition();
46 
47  inline CASlur *tieStart() { return _tieStart; }
48  inline CASlur *tieEnd() { return _tieEnd; }
49  inline CASlur *slurStart() { return _slurStart; }
50  inline CASlur *slurEnd() { return _slurEnd; }
52  inline CASlur *phrasingSlurEnd() { return _phrasingSlurEnd; }
53 
56 
57  inline void setTieStart( CASlur *tieStart ) { _tieStart = tieStart; }
58  inline void setTieEnd( CASlur *tieEnd ) { _tieEnd = tieEnd; }
60  inline void setSlurEnd( CASlur *slurEnd ) { _slurEnd = slurEnd; }
61  inline void setPhrasingSlurStart( CASlur *pSlurStart ) { _phrasingSlurStart = pSlurStart; }
62  inline void setPhrasingSlurEnd( CASlur *pSlurEnd ) { _phrasingSlurEnd = pSlurEnd; }
63 
64  void updateTies();
65 
66  bool isPartOfChord();
67  bool isLastInChord();
68  bool isFirstInChord();
69  QList<CANote*> getChord();
70 
72  void setForceAccidentals(bool force) { _forceAccidentals = force; }
73 
74  static const QString generateNoteName(int pitch, int accs);
75 
76  static const QString stemDirectionToString(CAStemDirection);
77  static CAStemDirection stemDirectionFromString(const QString);
78 
79  int compare(CAMusElement* elt);
80 
81 private:
84  bool _forceAccidentals; // Always draw notes accidentals.
85 
87  // Slurs and ties //
95 };
96 #endif /* NOTE_H_*/
CASlur * phrasingSlurStart()
Definition: note.h:51
CAStemDirection stemDirection()
Definition: note.h:42
CASlur * _phrasingSlurStart
Definition: note.h:93
CAStemDirection _stemDirection
Definition: note.h:83
CASlur * slurEnd()
Definition: note.h:50
Definition: note.h:24
void setSlurEnd(CASlur *slurEnd)
Definition: note.h:60
virtual int timeStart() const
Definition: muselement.h:51
CAStemDirection
Direction of the note's stem.
Definition: note.h:20
int compare(CAMusElement *elt)
Definition: note.cpp:214
CASlur * _slurStart
Definition: note.h:91
void setSlurStart(CASlur *slurStart)
Definition: note.h:59
CAPlayableLength _playableLength
Definition: playable.h:42
CASlur * _slurEnd
Definition: note.h:92
Class which represents a voice in the staff.
Definition: voice.h:23
int notePosition()
Definition: note.cpp:102
void updateTies()
Definition: note.cpp:236
void setPhrasingSlurEnd(CASlur *pSlurEnd)
Definition: note.h:62
CAVoice * voice()
Definition: playable.h:31
CANote * clone(CAVoice *voice=0)
Definition: note.cpp:81
Represents a note in the score.
Definition: note.h:18
bool isPartOfChord()
Definition: note.cpp:149
CASlurDirection
Direction of the slur.
Definition: slur.h:20
CASlur * tieStart()
Definition: note.h:47
void setTieEnd(CASlur *tieEnd)
Definition: note.h:58
CAPlayableLength noteLength()
Definition: note.h:33
void setForceAccidentals(bool force)
Definition: note.h:72
Musical note pitch.
Definition: diatonicpitch.h:16
Musical length of notes and rests.
Definition: playablelength.h:16
bool _forceAccidentals
Definition: note.h:84
CASlur * slurStart()
Definition: note.h:49
CAStemDirection actualStemDirection()
Definition: note.cpp:329
virtual ~CANote()
Definition: note.cpp:47
void setStemDirection(CAStemDirection direction)
Definition: note.cpp:228
Definition: note.h:22
CASlur * tieEnd()
Definition: note.h:48
An abstract class which represents every music element in the score.
Definition: muselement.h:21
Definition: note.h:23
CADiatonicPitch _diatonicPitch
Definition: note.h:82
CASlur * phrasingSlurEnd()
Definition: note.h:52
static CAStemDirection stemDirectionFromString(const QString)
Definition: note.cpp:310
int midiPitch()
Definition: note.h:40
static const QString generateNoteName(int pitch, int accs)
Definition: note.cpp:127
Playable instances of music elements.
Definition: playable.h:18
Slur, Tie, Phrasing slur and Laissez vibrer tie This class represents any type of slur....
Definition: slur.h:18
void setPhrasingSlurStart(CASlur *pSlurStart)
Definition: note.h:61
CASlur * _tieStart
Definition: note.h:89
CANote(CADiatonicPitch pitch, CAPlayableLength length, CAVoice *voice, int timeStart, int timeLength=-1)
Definition: note.cpp:31
static const QString stemDirectionToString(CAStemDirection)
Definition: note.cpp:288
CASlur * _phrasingSlurEnd
Definition: note.h:94
CASlur::CASlurDirection actualSlurDirection()
Definition: note.cpp:372
void setTieStart(CASlur *tieStart)
Definition: note.h:57
bool isFirstInChord()
Definition: note.cpp:166
void setDiatonicPitch(CADiatonicPitch pitch)
Definition: note.h:36
bool forceAccidentals()
Definition: note.h:71
bool isLastInChord()
Definition: note.cpp:179
Definition: note.h:25
virtual int timeLength() const
Definition: muselement.h:53
QList< CANote * > getChord()
Definition: note.cpp:197
CASlur * _tieEnd
Definition: note.h:90
CADiatonicPitch & diatonicPitch()
Definition: note.h:35
int midiPitch()
Definition: diatonicpitch.h:55
Definition: note.h:21