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. | |
psMusic::Duration | GetDuration () |
Get the duration of this element. | |
size_t | GetNNotes () const |
Get the number of notes in this chord. | |
Note & | GetNote (size_t n) |
Return the n-th note in the element. | |
const Note & | GetNote (size_t n) const |
bool | IsRest () const |
Return whether this element is a rest or not. | |
MeasureElement (psMusic::Duration duration) | |
Constructor. | |
bool | RemoveNote (char name, int octave) |
Delete a note with the same name and octave. | |
void | SetDuration (psMusic::Duration duration) |
Set the duration of this element. | |
void | SetRest () |
Set this element to be a rest. |
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. |
psMusic::Duration MeasureElement::GetDuration | ( | ) | [inline] |
Get the duration of this element.
Definition at line 236 of file scoreelements.h.
size_t MeasureElement::GetNNotes | ( | ) | const [inline] |
Get the number of notes in this chord.
Definition at line 243 of file scoreelements.h.
Note& MeasureElement::GetNote | ( | size_t | n | ) | [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.
const Note& MeasureElement::GetNote | ( | size_t | n | ) | const [inline] |
Definition at line 256 of file scoreelements.h.
bool MeasureElement::IsRest | ( | ) | const [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. |
void MeasureElement::SetDuration | ( | psMusic::Duration | duration | ) | [inline] |
Set the duration of this element.
duration | the new duration for this element. |
Definition at line 278 of file scoreelements.h.
void MeasureElement::SetRest | ( | ) | [inline] |
Set this element to be a rest.
All existing notes are deleted.
Definition at line 283 of file scoreelements.h.