Lomse library. API documentation  0.30.0
MidiPitch Class Reference

#include <lomse_pitch.h>

Detailed Description

Class MidiPitch is just an int number representing the pitch in a chromatic scale. It is the same as the MIDI key number used in MIDI for representing pitch. It has the following properties:

  • Very compact.
  • Equal temperament tunning assumed. This implies that there is no possibility to differentiate between enharmonic sounds, for instance, C sharp and D flat.
  • It is intended to be used only for sound generation.
  • It is usable for sweeps along the equal temperament sounds.

Public Member Functions

 MidiPitch (int note)
 
 MidiPitch (int step, int octave, int acc=0)
 
 operator int ()
 
string get_ldp_name ()
 
bool is_natural_note_for (EKeySignature nKey)
 
MidiPitch operator- (int i)
 
MidiPitch operator+ (int i)
 
MidiPitch operator+= (int i)
 
MidiPitch operator-= (int i)
 
int octave (EKeySignature nKey)
 
int step (EKeySignature nKey)
 
int accidentals (EKeySignature nKey)
 
void get_components (EKeySignature nKey, int *step, int *octave, int *acc)
 

Constructor & Destructor Documentation

◆ MidiPitch() [1/2]

MidiPitch::MidiPitch ( int  note)
inline

Constructor from a MIDI value.

◆ MidiPitch() [2/2]

MidiPitch::MidiPitch ( int  step,
int  octave,
int  acc = 0 
)

Constructor from the pitch components.

Member Function Documentation

◆ accidentals()

int MidiPitch::accidentals ( EKeySignature  nKey)

Components extraction

◆ get_components()

void MidiPitch::get_components ( EKeySignature  nKey,
int *  step,
int *  octave,
int *  acc 
)

Components extraction

◆ get_ldp_name()

string MidiPitch::get_ldp_name ( )

Returns the name of this pitch in LPD format, e.g., MidiPitch 60 will return "c4".

◆ is_natural_note_for()

bool MidiPitch::is_natural_note_for ( EKeySignature  nKey)

Returns TRUE if the pitch corresponds to a diatonic pitch in the given key signature.

◆ octave()

int MidiPitch::octave ( EKeySignature  nKey)

Components extraction

◆ operator int()

MidiPitch::operator int ( )
inline

Operator to cast to an int.

◆ operator+()

MidiPitch MidiPitch::operator+ ( int  i)
inline

Increment / decrement pitch by an arbitrary number of MIDI steps

◆ operator+=()

MidiPitch MidiPitch::operator+= ( int  i)
inline

Increment / decrement pitch by an arbitrary number of MIDI steps

◆ operator-()

MidiPitch MidiPitch::operator- ( int  i)
inline

Increment / decrement pitch by an arbitrary number of MIDI steps

◆ operator-=()

MidiPitch MidiPitch::operator-= ( int  i)
inline

Increment / decrement pitch by an arbitrary number of MIDI steps

◆ step()

int MidiPitch::step ( EKeySignature  nKey)

Components extraction