Planeshift
Classes | Public Member Functions | Public Attributes

Note Struct Reference

A single note in a musical score. More...

#include <pawssheetline.h>

List of all members.

Classes

class  NoteContext
 Used to keep track of previous altered notes in the current measure. More...

Public Member Functions

char GetName () const
 Get the note name.
int GetOctave () const
 Get the note octave number.
psMusic::Accidental GetPlayedAccidental (const ScoreContext &context) const
 Get the accidental of the played note.
psMusic::Accidental GetWrittenAccidental () const
 Get the written accidental.
 Note (short int position, short int alter)
 Constructor.
 Note (char name, int octave, psMusic::Accidental writtenAccidental)
 Constructor.
 Note ()
 Default constructor.
 Note ()
 Constructor.
bool operator== (const Note &note) const
 Equal operator.
void SetName (char name)
 Set the note name.
void SetOctave (int octave)
 Set the note octave number.
void SetWrittenAccidental (psMusic::Accidental accidental)
 Set the written accidental.
csString ToXML ()
 Writes this note as a <pitch> XML node.

Public Attributes

short int alter
 The note's alteration (-1 flat, 0 normal, 1 sharp).
char * flat
 the buffer of the flat note.
size_t flatLength
 the length of the buffer of the flat note.
char * normal
 the buffer of the unaltered note.
size_t normalLength
 the length of the buffer of the unaltered note.
short int position
 The note's position (0 is C4, 1 is D4 etc).
char * sharp
 the buffer of the sharp note.
size_t sharpLength
 the length of the buffer of the sharp note.

Detailed Description

A single note in a musical score.

This struct represents a musical note.

It keeps the stream buffer of the normal note, the sharp and the flat ones when available;

Definition at line 61 of file pawssheetline.h.


Constructor & Destructor Documentation

Note::Note ( short int  position,
short int  alter 
)

Constructor.

Parameters:
positionthe note's position.
alterthe note's alteration.
Note::Note ( )

Default constructor.

Create a natural middle C.

Note::Note ( char  name,
int  octave,
psMusic::Accidental  writtenAccidental 
)

Constructor.

Parameters:
nameName of the note (C, D, E, F, G, A or B). Must be uppercase.
octaveOctave number. Octave number 4 is the one that contains the central C on the piano.
accidentalThe accidental with which the note is written on the score. This is not related to the tonality of the piece but only on its representation. In other words the variable accidental must be different than UNALTERED if and only if an actual accidental is written on the musical score.
Note::Note ( ) [inline]

Constructor.

It initializes everything to 0.

Definition at line 53 of file instrument.h.


Member Function Documentation

char Note::GetName ( ) const [inline]

Get the note name.

Returns:
The uppercase name of the note (C, D, E, F, G, A or B).

Definition at line 133 of file scoreelements.h.

int Note::GetOctave ( ) const [inline]

Get the note octave number.

Returns:
The octave number of this note. Octave number 4 is the one that contains the central C on the piano.

Definition at line 141 of file scoreelements.h.

psMusic::Accidental Note::GetPlayedAccidental ( const ScoreContext context) const

Get the accidental of the played note.

This takes into account the written accidental, the tonality and previous accidental in the same measure.

Parameters:
contextThe context where tonality and previous accidentals are kept.
Returns:
The accidental with which the note must be played in the context of the tonality of the piece. An eventual accidental written on the score previously have the priority.
psMusic::Accidental Note::GetWrittenAccidental ( ) const [inline]

Get the written accidental.

Returns:
The accidental written on the score for this note.

Definition at line 159 of file scoreelements.h.

bool Note::operator== ( const Note note) const

Equal operator.

Parameters:
noteThe note to be compared with.
Returns:
True if the given note has the same name and octave.
void Note::SetName ( char  name)

Set the note name.

Parameters:
nameThe uppercase name of the note (C, D, E, F, G, A or B).
void Note::SetOctave ( int  octave)

Set the note octave number.

Parameters:
newOctaveThe octave number of this note. Octave number 4 is the one that contains the central C on the piano.
void Note::SetWrittenAccidental ( psMusic::Accidental  accidental)

Set the written accidental.

Parameters:
accidentalThe accidental written on the score for this note.
csString Note::ToXML ( )

Writes this note as a <pitch> XML node.

Returns:
the <pitch> XML node.

Member Data Documentation

The note's alteration (-1 flat, 0 normal, 1 sharp).

Definition at line 64 of file pawssheetline.h.

char* Note::flat

the buffer of the flat note.

Definition at line 44 of file instrument.h.

the length of the buffer of the flat note.

Definition at line 48 of file instrument.h.

char* Note::normal

the buffer of the unaltered note.

Definition at line 42 of file instrument.h.

the length of the buffer of the unaltered note.

Definition at line 46 of file instrument.h.

The note's position (0 is C4, 1 is D4 etc).

Definition at line 63 of file pawssheetline.h.

char* Note::sharp

the buffer of the sharp note.

Definition at line 43 of file instrument.h.

the length of the buffer of the sharp note.

Definition at line 47 of file instrument.h.


The documentation for this struct was generated from the following files: