|
Canorus 0.0
|
Musical key. More...
#include <diatonickey.h>
Public Types | |
| enum | CAGender { Major , Minor } |
| enum | CAShape { Natural , Harmonic , Melodic } |
Public Member Functions | |
| CADiatonicKey () | |
| CADiatonicKey (const QString &key) | |
| CADiatonicKey (const int &numberOfAccs, const CAGender &gender) | |
| CADiatonicKey (const CADiatonicPitch &pitch, const CAGender &gender) | |
| CADiatonicKey (const CADiatonicPitch &pitch, const CAGender &gender, const CAShape &shape) | |
| bool | operator== (CADiatonicKey) |
| bool | operator!= (CADiatonicKey p) |
| void | operator= (const QString &key) |
| CADiatonicKey | operator+ (CAInterval) |
| CADiatonicPitch | diatonicPitch () |
| const CAGender | gender () |
| const CAShape | shape () |
| void | setDiatonicPitch (const CADiatonicPitch p) |
| void | setGender (const CAGender g) |
| void | setShape (const CAShape s) |
| int | numberOfAccs () |
| QList< int > | accsMatrix () |
| int | noteAccs (int noteName) |
| bool | containsPitch (const CADiatonicPitch &p) |
Static Public Member Functions | |
| static const QString | shapeToString (CAShape) |
| static CAShape | shapeFromString (const QString) |
| static const QString | genderToString (CAGender) |
| static CAGender | genderFromString (const QString) |
| static const QString | diatonicKeyToString (CADiatonicKey k) |
| static CADiatonicKey | diatonicKeyFromString (const QString) |
Private Attributes | |
| CADiatonicPitch | _diatonicPitch |
| CAGender | _gender |
| CAShape | _shape |
Musical key.
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.
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 key. For example, C-major, d-minor, e-flat-minor etc.
It consists of two properties:
Valid range of diatonic pitch for the diatonic key is a positive number ranging from 0 (C) to 6 (B).
| CADiatonicKey::CADiatonicKey | ( | ) |
References Major, Natural, setDiatonicPitch(), setGender(), and setShape().
Referenced by diatonicKeyFromString(), and operator+().


| CADiatonicKey::CADiatonicKey | ( | const QString & | key | ) |
References gender(), Major, Minor, Natural, setDiatonicPitch(), setGender(), and setShape().

| CADiatonicKey::CADiatonicKey | ( | const CADiatonicPitch & | pitch, |
| const CAGender & | gender | ||
| ) |
References gender(), Harmonic, Major, Natural, setDiatonicPitch(), setGender(), and setShape().

| CADiatonicKey::CADiatonicKey | ( | const CADiatonicPitch & | pitch, |
| const CAGender & | gender, | ||
| const CAShape & | shape | ||
| ) |
References gender(), setDiatonicPitch(), setGender(), setShape(), and shape().

| QList< int > CADiatonicKey::accsMatrix | ( | ) |
Returns a list of accs from C to B for the key signature.
References numberOfAccs().
Referenced by containsPitch(), and noteAccs().


| bool CADiatonicKey::containsPitch | ( | const CADiatonicPitch & | p | ) |
Returns true, if the given pitch p is a natural note in the key signature; False otherwise.
eg. F# is a natural note in G-major, but not in C-major (ie. F).
References CADiatonicPitch::accs(), accsMatrix(), and CADiatonicPitch::noteName().
Referenced by CADiatonicPitch::diatonicPitchFromMidiPitchKey().


|
static |
Creates a new diatonic key from the given string.
References CADiatonicKey().

|
static |
Generates a readable name of the diatonic key. eg. -3 accidentals & major => "Es" +6 accidentals & minor => "dis"
References gender(), Major, Minor, and numberOfAccs().
Referenced by CAMusElementFactory::configureFunctionMark(), CAKeySignatureCtl::on_uiKeySig_activated(), CAKeySignatureUI::populateComboBox(), CALayoutEngine::reposit(), CATransposeView::show(), CAMainWin::updateFMToolBar(), and CAKeySignatureUI::updateKeySigToolBar().


|
inline |
References _diatonicPitch.
Referenced by CADiatonicPitch::diatonicPitchFromMidiPitchKey(), CACanorusMLExport::exportDiatonicKey(), CALilyPondExport::exportVoiceImpl(), CAKeybdInput::matchPitchToKey(), numberOfAccs(), operator+(), operator==(), CATranspose::reinterpretAccidentals(), and CATranspose::transposeByKeySig().

References _gender.
Referenced by CADiatonicKey(), diatonicKeyToString(), CADiatonicPitch::diatonicPitchFromMidiPitchKey(), CACanorusMLExport::exportDiatonicKey(), CAMusicXmlExport::exportKeySig(), CALilyPondExport::exportVoiceImpl(), genderFromString(), genderToString(), CAPlayback::loopUntilPlayable(), numberOfAccs(), CAKeySignatureCtl::on_uiKeySig_activated(), operator+(), operator=(), operator==(), and CATranspose::reinterpretAccidentals().

|
static |
References gender(), Major, and Minor.
Referenced by CAMusicXmlImport::readAttributes(), and CACanorusMLImport::startElement().


References gender(), Major, and Minor.
Referenced by CACanorusMLExport::exportDiatonicKey().


| int CADiatonicKey::noteAccs | ( | int | noteName | ) |
Returns number of accidentals for the given note. Eg. If we call noteAccs(17) in D-Major, it returns 1, because 17 is a note F and D-Major has Fis.
References accsMatrix().
Referenced by CAMainWin::scoreViewKeyPress().


| int CADiatonicKey::numberOfAccs | ( | ) |
References CADiatonicPitch::accs(), diatonicPitch(), gender(), Major, and CADiatonicPitch::noteName().
Referenced by accsMatrix(), diatonicKeyToString(), CAMusicXmlExport::exportKeySig(), CAPlayback::loopUntilPlayable(), CAKeySignatureCtl::on_uiKeySig_activated(), CATranspose::reinterpretAccidentals(), and CAKeySignature::updateAccidentals().


|
inline |
| CADiatonicKey CADiatonicKey::operator+ | ( | CAInterval | interval | ) |
Transposes the key for the given interval. The new pitch is correctly bounded.
References CADiatonicKey(), diatonicPitch(), gender(), CADiatonicPitch::noteName(), CADiatonicPitch::setNoteName(), and shape().

| void CADiatonicKey::operator= | ( | const QString & | key | ) |
References gender(), Harmonic, Major, Minor, Natural, setDiatonicPitch(), setGender(), and setShape().
Referenced by CADiatonicKey().


| bool CADiatonicKey::operator== | ( | CADiatonicKey | k | ) |
References diatonicPitch(), and gender().
Referenced by operator!=().


|
inline |
References _diatonicPitch.
Referenced by CADiatonicKey(), CACanorusMLImport::endElement(), and operator=().

References _gender.
Referenced by CADiatonicKey(), and operator=().

References _shape.
Referenced by CADiatonicKey(), and operator=().

References _shape.
Referenced by CADiatonicKey(), operator+(), shapeFromString(), and shapeToString().

|
static |
|
private |
Referenced by diatonicPitch(), and setDiatonicPitch().
|
private |
Referenced by gender(), and setGender().
|
private |
Referenced by setShape(), and shape().