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

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
 

Detailed Description

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

See also
CADiatonicPitch

Member Enumeration Documentation

◆ CAGender

The lower tetrachord of the scale - gender:

  • Major
  • Minor
Enumerator
Major 
Minor 

◆ CAShape

The upper tetrachord of the scale - shape:

  • Natural
  • Harmonic
  • Melodic
Enumerator
Natural 
Harmonic 
Melodic 

Constructor & Destructor Documentation

◆ CADiatonicKey() [1/5]

CADiatonicKey::CADiatonicKey ( )

References Major, Natural, setDiatonicPitch(), setGender(), and setShape().

Referenced by diatonicKeyFromString(), and operator+().

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

◆ CADiatonicKey() [2/5]

CADiatonicKey::CADiatonicKey ( const QString &  key)

References operator=().

Here is the call graph for this function:

◆ CADiatonicKey() [3/5]

CADiatonicKey::CADiatonicKey ( const int &  numberOfAccs,
const CAGender gender 
)

References gender(), Major, Minor, Natural, setDiatonicPitch(), setGender(), and setShape().

Here is the call graph for this function:

◆ CADiatonicKey() [4/5]

CADiatonicKey::CADiatonicKey ( const CADiatonicPitch pitch,
const CAGender gender 
)

References gender(), Harmonic, Major, Natural, setDiatonicPitch(), setGender(), and setShape().

Here is the call graph for this function:

◆ CADiatonicKey() [5/5]

CADiatonicKey::CADiatonicKey ( const CADiatonicPitch pitch,
const CAGender gender,
const CAShape shape 
)

References gender(), setDiatonicPitch(), setGender(), setShape(), and shape().

Here is the call graph for this function:

Member Function Documentation

◆ accsMatrix()

QList< int > CADiatonicKey::accsMatrix ( )

Returns a list of accs from C to B for the key signature.

References numberOfAccs().

Referenced by containsPitch(), and noteAccs().

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

◆ containsPitch()

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

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

◆ diatonicKeyFromString()

CADiatonicKey CADiatonicKey::diatonicKeyFromString ( const QString  s)
static

Creates a new diatonic key from the given string.

References CADiatonicKey().

Here is the call graph for this function:

◆ diatonicKeyToString()

const QString CADiatonicKey::diatonicKeyToString ( CADiatonicKey  k)
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().

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

◆ diatonicPitch()

CADiatonicPitch CADiatonicKey::diatonicPitch ( )
inline

◆ gender()

const CAGender CADiatonicKey::gender ( )
inline

◆ genderFromString()

CADiatonicKey::CAGender CADiatonicKey::genderFromString ( const QString  gender)
static

References gender(), Major, and Minor.

Referenced by CAMusicXmlImport::readAttributes(), and CACanorusMLImport::startElement().

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

◆ genderToString()

const QString CADiatonicKey::genderToString ( CAGender  gender)
static

References gender(), Major, and Minor.

Referenced by CACanorusMLExport::exportDiatonicKey().

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

◆ noteAccs()

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

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

◆ numberOfAccs()

int CADiatonicKey::numberOfAccs ( )

◆ operator!=()

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

References operator==().

Here is the call graph for this function:

◆ operator+()

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

Here is the call graph for this function:

◆ operator=()

void CADiatonicKey::operator= ( const QString &  key)

References gender(), Harmonic, Major, Minor, Natural, setDiatonicPitch(), setGender(), and setShape().

Referenced by CADiatonicKey().

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

◆ operator==()

bool CADiatonicKey::operator== ( CADiatonicKey  k)

References diatonicPitch(), and gender().

Referenced by operator!=().

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

◆ setDiatonicPitch()

void CADiatonicKey::setDiatonicPitch ( const CADiatonicPitch  p)
inline

References _diatonicPitch.

Referenced by CADiatonicKey(), CACanorusMLImport::endElement(), and operator=().

Here is the caller graph for this function:

◆ setGender()

void CADiatonicKey::setGender ( const CAGender  g)
inline

References _gender.

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

Here is the caller graph for this function:

◆ setShape()

void CADiatonicKey::setShape ( const CAShape  s)
inline

References _shape.

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

Here is the caller graph for this function:

◆ shape()

const CAShape CADiatonicKey::shape ( )
inline

References _shape.

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

Here is the caller graph for this function:

◆ shapeFromString()

CADiatonicKey::CAShape CADiatonicKey::shapeFromString ( const QString  shape)
static

References Harmonic, Melodic, Natural, and shape().

Here is the call graph for this function:

◆ shapeToString()

const QString CADiatonicKey::shapeToString ( CAShape  shape)
static

References Harmonic, Melodic, Natural, and shape().

Here is the call graph for this function:

Member Data Documentation

◆ _diatonicPitch

CADiatonicPitch CADiatonicKey::_diatonicPitch
private

Referenced by diatonicPitch(), and setDiatonicPitch().

◆ _gender

CAGender CADiatonicKey::_gender
private

Referenced by gender(), and setGender().

◆ _shape

CAShape CADiatonicKey::_shape
private

Referenced by setShape(), and shape().


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