Planeshift
|
An element of a measure with a given duration. More...
#include <scoreelements.h>
Public Member Functions | |
bool | AddNote (char name, int octave, psMusic::Accidental writtenAccidental) |
Copy a note into the chord. More... | |
psMusic::Duration | GetDuration () |
Get the duration of this element. More... | |
size_t | GetNNotes () const |
Get the number of notes in this chord. More... | |
Note & | GetNote (size_t n) |
Return the n-th note in the element. More... | |
const Note & | GetNote (size_t n) const |
bool | IsRest () const |
Return whether this element is a rest or not. More... | |
MeasureElement (psMusic::Duration duration) | |
Constructor. More... | |
bool | RemoveNote (char name, int octave) |
Delete a note with the same name and octave. More... | |
void | SetDuration (psMusic::Duration duration) |
Set the duration of this element. More... | |
void | SetRest () |
Set this element to be a rest. More... | |
An element of a measure with a given duration.
It can be a rest, a single note or a group of notes with same duration that must be played together (a chord).
Definition at line 209 of file scoreelements.h.
MeasureElement::MeasureElement | ( | psMusic::Duration | duration | ) |
Constructor.
The default element is a rest of the given duration.
duration | The duration of this element. |
bool MeasureElement::AddNote | ( | char | name, |
int | octave, | ||
psMusic::Accidental | writtenAccidental | ||
) |
Copy a note into the chord.
If a note with the same name and octave already exists this will overwrite it or, in other words, its accidental will be overwritten.
name | Name of the note (C, D, E, F, G, A or B). Must be uppercase. |
octave | Octave number. Octave number 4 is the one that contains the central C on the piano. |
accidental | The accidental with which the note is written on the score. |
|
inline |
Get the duration of this element.
Definition at line 236 of file scoreelements.h.
|
inline |
Get the number of notes in this chord.
Definition at line 243 of file scoreelements.h.
|
inline |
Return the n-th note in the element.
n | The number of the note in the element. |
Definition at line 251 of file scoreelements.h.
|
inline |
Definition at line 256 of file scoreelements.h.
|
inline |
Return whether this element is a rest or not.
Definition at line 263 of file scoreelements.h.
bool MeasureElement::RemoveNote | ( | char | name, |
int | octave | ||
) |
Delete a note with the same name and octave.
note | The note that must be deleted. |
|
inline |
Set the duration of this element.
duration | the new duration for this element. |
Definition at line 278 of file scoreelements.h.
|
inline |
Set this element to be a rest.
All existing notes are deleted.
Definition at line 283 of file scoreelements.h.