|
Canorus 0.0
|
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 ¬eName, 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 |
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.
| CADiatonicPitch::CADiatonicPitch | ( | ) |
References setAccs(), setNoteName(), and Undefined.
Referenced by diatonicPitchFromMidiPitchKey(), and diatonicPitchFromString().


| CADiatonicPitch::CADiatonicPitch | ( | const QString & | pitch | ) |
References accs(), noteName(), setAccs(), and setNoteName().

|
inline |
References _accs.
Referenced by CADiatonicPitch(), CAInterval::CAInterval(), CADiatonicKey::containsPitch(), diatonicPitchFromMidiPitchKey(), CALilyPondExport::diatonicPitchToLilyPond(), diatonicPitchToMidiPitch(), diatonicPitchToString(), CACanorusMLExport::exportDiatonicPitch(), CAMusicXmlExport::exportNote(), CAKeybdInput::matchPitchToKey(), CADiatonicKey::numberOfAccs(), operator+(), operator==(), CATranspose::reinterpretAccidentals(), CALayoutEngine::reposit(), CAMainWin::scoreViewKeyPress(), and setAccs().

|
static |
This function is provided for convenience.
References diatonicPitchFromMidiPitchKey(), and midiPitch().
Referenced by CAMidiImport::matchPitchToKey(), CAKeybdInput::midiInEventToScore(), and CALayoutEngine::reposit().


|
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.
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().


|
static |
Creates a new diatonic pitch from the given string.
References CADiatonicPitch().
Referenced by CAMusicXmlImport::readNote().


|
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().


|
static |
Converts the music pitch to string.
References accs(), and noteName().

|
inline |
References diatonicPitchToMidiPitch().
Referenced by diatonicPitchFromMidiPitch(), diatonicPitchFromMidiPitchKey(), and CANote::midiPitch().


|
inline |
References _noteName.
Referenced by CAVoice::addNoteToChord(), CADiatonicPitch(), CAInterval::CAInterval(), CADrawableStaff::calculateCenterYCoord(), CADiatonicKey::containsPitch(), CALilyPondExport::diatonicPitchToLilyPond(), diatonicPitchToMidiPitch(), diatonicPitchToString(), CACanorusMLExport::exportDiatonicPitch(), CAMusicXmlExport::exportNote(), CAKeybdInput::matchPitchToKey(), CANote::notePosition(), CADiatonicKey::numberOfAccs(), CADiatonicKey::operator+(), operator+(), operator==(), CAMusicXmlImport::readNote(), CALilyPondImport::relativePitchFromLilyPond(), CALilyPondExport::relativePitchToString(), CALayoutEngine::reposit(), CAMainWin::scoreViewKeyPress(), setNoteName(), CATranspose::transposeByKeySig(), and CALilyPondExport::writeRelativeIntro().

|
inline |
|
inline |
| 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-().


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

| bool CADiatonicPitch::operator== | ( | CADiatonicPitch | p | ) |
References accs(), and noteName().
Referenced by operator!=().


| bool CADiatonicPitch::operator== | ( | int | noteName | ) |
|
inline |
Referenced by CADiatonicPitch(), diatonicPitchFromMidiPitchKey(), operator+(), and CAMusicXmlImport::readNote().


|
inline |
References _noteName, and noteName().
Referenced by CADiatonicPitch(), diatonicPitchFromMidiPitchKey(), CADiatonicKey::operator+(), operator+(), CAMusicXmlImport::readNote(), and CALilyPondExport::writeRelativeIntro().


|
private |
Referenced by noteName(), and setNoteName().