Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | Related Pages

TPitch Class Reference

The MusicXML representation of the pitch. More...

#include <TPitch.h>

Inheritance diagram for TPitch:

visitable smartable TRest TUnpitched List of all members.

Public Types

enum  {
  undefined = 0, C = 1, D, E,
  F, G, A, B,
  last = B, diatonicSteps = last
}

Public Member Functions

virtual void accept (TScoreVisitor &visitor)
int getStep () const
float getAlter () const
int getOctave () const
void setStep (int step)
void setAlter (float alter)
void setOctave (int oct)
TPitchoperator++ (int)
 the ++ operator adds a sharp

TPitchoperator-- (int)
 the -- operator adds a flat

TPitchoperator+= (int n)
TPitchoperator+= (unsigned int n)
 adds n diatonic steps to the pitch field and update the octave when necessary

TPitchoperator-= (int n)
TPitchoperator-= (unsigned int n)
 substracts n diatonic steps to the pitch field and update the octave when necessary

unsigned short MIDIPitch () const
 returns the corresponding MIDI pitch


Static Public Member Functions

const string xmlpitch (int d)
 convert a numeric pitch to a MusicXML string

int xmlpitch (const string str)
 convert a MusicXML string to a numeric pitch


Protected Attributes

int fStep
float fAlter
int fOctave

Friends

EXP friend SMARTP< TPitchnewPitch ()

Detailed Description

Pitch is represented as a combination of the step of the diatonic scale, the chromatic alteration, and the octave. The step element uses the English letters A through G: in a future revision, this could expand to international namings. The alter element represents chromatic alteration in number of semitones (e.g., -1 for flat, 1 for sharp). Decimal values like 0.5 (quarter tone sharp) may be used for microtones. The octave element is represented by the numbers 0 to 9, where 4 indicates the octave started by middle C.
The MusicXML pitch element is defined in note.dtd.


Generated on Tue Mar 23 09:50:14 2004 for LibMusicXML by doxygen 1.3.3