Canorus 0.0
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CADiatonicPitch Class Reference

Musical note pitch. More...

#include <diatonicpitch.h>

Public Types

enum  CANoteName {
  Undefined = -1 , C = 0 , D = 1 , E = 2 ,
  F = 3 , G = 4 , A = 5 , B = 6
}
 
enum  CAMidiPitchMode { PreferAuto = 0 , PreferSharps = 1 , PreferFlats = -1 }
 

Public Member Functions

 CADiatonicPitch ()
 
 CADiatonicPitch (const QString &pitch)
 
 CADiatonicPitch (const int &noteName, const int &accs=0)
 
bool operator== (CADiatonicPitch)
 
bool operator!= (CADiatonicPitch p)
 
bool operator== (int noteName)
 
bool operator!= (int p)
 
CADiatonicPitch operator+ (CAInterval)
 
CADiatonicPitch operator- (CAInterval i)
 
const int noteName () const
 
const int accs () const
 
void setNoteName (const int noteName)
 
void setAccs (const int accs)
 
int midiPitch ()
 

Static Public Member Functions

static const QString diatonicPitchToString (CADiatonicPitch p)
 
static CADiatonicPitch diatonicPitchFromString (const QString s)
 
static CADiatonicPitch diatonicPitchFromMidiPitch (int midiPitch, CAMidiPitchMode m=PreferAuto)
 
static CADiatonicPitch diatonicPitchFromMidiPitchKey (int midiPitch, CADiatonicKey k, CAMidiPitchMode m=PreferAuto)
 
static int diatonicPitchToMidiPitch (const CADiatonicPitch &dp)
 

Private Attributes

int _noteName
 
int _accs
 

Detailed Description

Musical note pitch.

Copyright (c) 2008, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.

Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE.GPL for details.

This is a typical music presentation of the note pitch.

It consists of two properties:

Note name begins with sub-contra C.

Diatonic pitches can be compared with each other or only note names and summed with intervals.

See also
CAInterval, operator+(), CAMidiDevice::diatonicPitchToMidi()

Member Enumeration Documentation

◆ CAMidiPitchMode

Enumerator
PreferAuto 
PreferSharps 
PreferFlats 

◆ CANoteName

Enumerator
Undefined 

Constructor & Destructor Documentation

◆ CADiatonicPitch() [1/3]

CADiatonicPitch::CADiatonicPitch ( )

References setAccs(), setNoteName(), and Undefined.

Referenced by diatonicPitchFromMidiPitchKey(), and diatonicPitchFromString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CADiatonicPitch() [2/3]

CADiatonicPitch::CADiatonicPitch ( const QString &  pitch)

References noteName(), setAccs(), and setNoteName().

Here is the call graph for this function:

◆ CADiatonicPitch() [3/3]

CADiatonicPitch::CADiatonicPitch ( const int &  noteName,
const int &  accs = 0 
)

References accs(), noteName(), setAccs(), and setNoteName().

Here is the call graph for this function:

Member Function Documentation

◆ accs()

const int CADiatonicPitch::accs ( ) const
inline

◆ diatonicPitchFromMidiPitch()

CADiatonicPitch CADiatonicPitch::diatonicPitchFromMidiPitch ( int  midiPitch,
CAMidiPitchMode  mode = PreferAuto 
)
static

This function is provided for convenience.

See also
diatonicPitchFromMidiPitchKey()

References diatonicPitchFromMidiPitchKey(), and midiPitch().

Referenced by CAMidiImport::matchPitchToKey(), CAKeybdInput::midiInEventToScore(), and CALayoutEngine::reposit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ diatonicPitchFromMidiPitchKey()

CADiatonicPitch CADiatonicPitch::diatonicPitchFromMidiPitchKey ( int  midiPitch,
CADiatonicKey  key,
CAMidiPitchMode  mode = PreferAuto 
)
static

Generates prefered diatonic pitch for the given midiPitch. key tells generally which accidentals and note pitches to use. mode tells which accidental is the preferred one, if the diatonic pitch is unknown to the given key. If the auto mode is set, then C-major degrees C#, D#, F#, G# and Bb are taken for the given key. These are the only possible major thirds or minor sevenths of the Dominant chords of degrees.

See also
CAMidiPitchMode, diatonicPitchToMidiPitch

References accs(), CADiatonicPitch(), CADiatonicKey::containsPitch(), CADiatonicKey::diatonicPitch(), diatonicPitchToMidiPitch(), CAInterval::Diminished, CADiatonicKey::gender(), CAInterval::Major, midiPitch(), CADiatonicKey::Minor, PreferAuto, PreferFlats, PreferSharps, CAInterval::quantity(), CAInterval::Second, CAInterval::semitones(), setAccs(), setNoteName(), CAInterval::setQuantity(), and CAInterval::Sixth.

Referenced by diatonicPitchFromMidiPitch(), CAMidiImport::matchPitchToKey(), and CALayoutEngine::reposit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ diatonicPitchFromString()

CADiatonicPitch CADiatonicPitch::diatonicPitchFromString ( const QString  s)
static

Creates a new diatonic pitch from the given string.

References CADiatonicPitch().

Referenced by CAMusicXmlImport::readNote().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ diatonicPitchToMidiPitch()

int CADiatonicPitch::diatonicPitchToMidiPitch ( const CADiatonicPitch pitch)
static

Converts the given diatonic pitch (note name with octave and accidental) to standard unsigned 7-bit MIDI pitch.

References accs(), and noteName().

Referenced by diatonicPitchFromMidiPitchKey(), midiPitch(), CAPlayback::playSelectionImpl(), and CAPlayback::run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ diatonicPitchToString()

const QString CADiatonicPitch::diatonicPitchToString ( CADiatonicPitch  pitch)
static

Converts the music pitch to string.

References accs(), and noteName().

Here is the call graph for this function:

◆ midiPitch()

int CADiatonicPitch::midiPitch ( )
inline

References diatonicPitchToMidiPitch().

Referenced by diatonicPitchFromMidiPitch(), diatonicPitchFromMidiPitchKey(), and CANote::midiPitch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ noteName()

const int CADiatonicPitch::noteName ( ) const
inline

◆ operator!=() [1/2]

bool CADiatonicPitch::operator!= ( CADiatonicPitch  p)
inline

References operator==().

Here is the call graph for this function:

◆ operator!=() [2/2]

bool CADiatonicPitch::operator!= ( int  p)
inline

References operator==().

Here is the call graph for this function:

◆ operator+()

CADiatonicPitch CADiatonicPitch::operator+ ( CAInterval  i)

Calculates the new pitch using the old pitch + interval.

References accs(), CAInterval::Fifth, CAInterval::Fourth, noteName(), CAInterval::Prime, CAInterval::quality(), CAInterval::quantity(), CAInterval::Second, setAccs(), setNoteName(), CAInterval::Seventh, CAInterval::Sixth, and CAInterval::Third.

Referenced by operator-().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator-()

CADiatonicPitch CADiatonicPitch::operator- ( CAInterval  i)
inline

References operator+(), CAInterval::quality(), and CAInterval::quantity().

Here is the call graph for this function:

◆ operator==() [1/2]

bool CADiatonicPitch::operator== ( CADiatonicPitch  p)

References accs(), and noteName().

Referenced by operator!=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator==() [2/2]

bool CADiatonicPitch::operator== ( int  noteName)

References noteName().

Here is the call graph for this function:

◆ setAccs()

void CADiatonicPitch::setAccs ( const int  accs)
inline

References _accs, and accs().

Referenced by CADiatonicPitch(), diatonicPitchFromMidiPitchKey(), operator+(), and CAMusicXmlImport::readNote().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNoteName()

void CADiatonicPitch::setNoteName ( const int  noteName)
inline

References _noteName, and noteName().

Referenced by CADiatonicPitch(), diatonicPitchFromMidiPitchKey(), CADiatonicKey::operator+(), operator+(), CAMusicXmlImport::readNote(), and CALilyPondExport::writeRelativeIntro().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _accs

int CADiatonicPitch::_accs
private

Referenced by accs(), and setAccs().

◆ _noteName

int CADiatonicPitch::_noteName
private

Referenced by noteName(), and setNoteName().


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