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
16class CAVoice;
17
18class CANote : public CAPlayable {
19public:
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; }
53
56
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
81private:
84 bool _forceAccidentals; // Always draw notes accidentals.
85
87 // Slurs and ties //
95};
96#endif /* NOTE_H_*/
Musical note pitch.
Definition: diatonicpitch.h:16
int midiPitch()
Definition: diatonicpitch.h:55
An abstract class which represents every music element in the score.
Definition: muselement.h:21
virtual int timeStart() const
Definition: muselement.h:51
virtual int timeLength() const
Definition: muselement.h:53
Represents a note in the score.
Definition: note.h:18
CASlur * tieStart()
Definition: note.h:47
CANote(CADiatonicPitch pitch, CAPlayableLength length, CAVoice *voice, int timeStart, int timeLength=-1)
Definition: note.cpp:31
CASlur * slurEnd()
Definition: note.h:50
bool isFirstInChord()
Definition: note.cpp:166
CAStemDirection _stemDirection
Definition: note.h:83
bool _forceAccidentals
Definition: note.h:84
CASlur * tieEnd()
Definition: note.h:48
CAStemDirection stemDirection()
Definition: note.h:42
int compare(CAMusElement *elt)
Definition: note.cpp:214
static CAStemDirection stemDirectionFromString(const QString)
Definition: note.cpp:310
CAPlayableLength noteLength()
Definition: note.h:33
int midiPitch()
Definition: note.h:40
CASlur * _phrasingSlurStart
Definition: note.h:93
void setTieEnd(CASlur *tieEnd)
Definition: note.h:58
void setDiatonicPitch(CADiatonicPitch pitch)
Definition: note.h:36
CASlur::CASlurDirection actualSlurDirection()
Definition: note.cpp:372
bool forceAccidentals()
Definition: note.h:71
CANote * clone(CAVoice *voice=0)
Definition: note.cpp:81
void updateTies()
Definition: note.cpp:236
CADiatonicPitch _diatonicPitch
Definition: note.h:82
static const QString generateNoteName(int pitch, int accs)
Definition: note.cpp:127
void setSlurStart(CASlur *slurStart)
Definition: note.h:59
CASlur * _slurStart
Definition: note.h:91
CASlur * _tieStart
Definition: note.h:89
CASlur * phrasingSlurStart()
Definition: note.h:51
bool isLastInChord()
Definition: note.cpp:179
void setPhrasingSlurEnd(CASlur *pSlurEnd)
Definition: note.h:62
QList< CANote * > getChord()
Definition: note.cpp:197
CADiatonicPitch & diatonicPitch()
Definition: note.h:35
virtual ~CANote()
Definition: note.cpp:47
bool isPartOfChord()
Definition: note.cpp:149
void setStemDirection(CAStemDirection direction)
Definition: note.cpp:228
CASlur * _phrasingSlurEnd
Definition: note.h:94
CASlur * _tieEnd
Definition: note.h:90
CASlur * phrasingSlurEnd()
Definition: note.h:52
int notePosition()
Definition: note.cpp:102
void setSlurEnd(CASlur *slurEnd)
Definition: note.h:60
CASlur * _slurEnd
Definition: note.h:92
static const QString stemDirectionToString(CAStemDirection)
Definition: note.cpp:288
CAStemDirection
Direction of the note's stem.
Definition: note.h:20
@ StemUp
Definition: note.h:23
@ StemNeutral
Definition: note.h:22
@ StemPreferred
Definition: note.h:25
@ StemUndefined
Definition: note.h:21
@ StemDown
Definition: note.h:24
CASlur * slurStart()
Definition: note.h:49
void setForceAccidentals(bool force)
Definition: note.h:72
void setTieStart(CASlur *tieStart)
Definition: note.h:57
void setPhrasingSlurStart(CASlur *pSlurStart)
Definition: note.h:61
CAStemDirection actualStemDirection()
Definition: note.cpp:329
Musical length of notes and rests.
Definition: playablelength.h:16
Playable instances of music elements.
Definition: playable.h:18
CAVoice * voice()
Definition: playable.h:31
CAPlayableLength _playableLength
Definition: playable.h:42
Slur, Tie, Phrasing slur and Laissez vibrer tie This class represents any type of slur....
Definition: slur.h:18
CASlurDirection
Direction of the slur.
Definition: slur.h:20
Class which represents a voice in the staff.
Definition: voice.h:23