Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CAKeySignature Class Reference

Represents a key signature sign in the staff. More...

#include <keysignature.h>

Inheritance diagram for CAKeySignature:
Inheritance graph
[legend]

List of all members.

Public Types

enum  CAKeySignatureType { MajorMinor, Modus, Custom }
enum  CAModus {
  Ionian, Dorian, Phrygian, Lydian,
  Mixolydian, Aeolian, Locrian, Hypodorian,
  Hypolydian, Hypomixolydian, Hypophrygian
}

Public Member Functions

 CAKeySignature (CADiatonicKey k, CAStaff *staff, int timeStart)
 CAKeySignature (CAModus m, CAStaff *staff, int timeStart)
 ~CAKeySignature ()
CAKeySignatureclone (CAContext *context=0)
CAStaffstaff ()
CAKeySignatureType keySignatureType ()
void setKeySignatureType (CAKeySignatureType type)
CADiatonicKey diatonicKey ()
CAModus modus ()
void setDiatonicKey (CADiatonicKey k)
void setModus (CAModus modus)
signed char * accidentals ()
int compare (CAMusElement *elt)

Static Public Member Functions

static const QString keySignatureTypeToString (CAKeySignatureType)
static CAKeySignatureType keySignatureTypeFromString (const QString)
static const QString modusToString (CAModus)
static CAModus modusFromString (const QString)

Private Member Functions

void updateAccidentals ()

Private Attributes

CAKeySignatureType _keySignatureType
CAModus _modus
CADiatonicKey _diatonicKey
signed char _accidentals [7]

Detailed Description

Represents a key signature sign in the staff.

Copyright (c) 2006-2007, 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.

    CAKeySignature represents a key signature sign (static accidentals) in the staff.
    The actual key signature key is stored (depends on type though - currently only major/minor
    diatonic keys are supported) in _diatonicKey.

    \sa CADiatonicKey

Member Enumeration Documentation

Type of the key signature:

  • MajorMinor Standard diatonic scale found by circle of fifths
  • Modus One of the moduses found in middle-age
  • Custom Custom scale. Modern scales, harmony of fourths, local scales
Enumerator:
MajorMinor 
Modus 
Custom 

Modus types:

  • Ionian
  • Dorian
  • Phrygian
  • Lydian
  • Mixolydian
  • Aeolian
  • Locrian
  • Hypodorian
  • Hypolydian
  • Hypomixolydian
  • Hypophrygian
Enumerator:
Ionian 
Dorian 
Phrygian 
Lydian 
Mixolydian 
Aeolian 
Locrian 
Hypodorian 
Hypolydian 
Hypomixolydian 
Hypophrygian 

Constructor & Destructor Documentation

CAKeySignature::CAKeySignature ( CADiatonicKey  k,
CAStaff staff,
int  timeStart 
)

Creates a new key signature of type MajorMinor, diatonic key dKey, parent staff and timeStart.

Number of accidentals is a signed number, positive for sharps, negative for flats. eg.

  • 0 - C-Major
  • -1 - F-Major
  • +7 - Cis-Major etc.

References CAMusElement::KeySignature, MajorMinor, setDiatonicKey(), setKeySignatureType(), and CAMusElement::setMusElementType().

Referenced by clone().

Here is the call graph for this function:

Here is the caller graph for this function:

CAKeySignature::CAKeySignature ( CAModus  m,
CAStaff staff,
int  timeStart 
)
    Creates a new key signature of type Modus, modus type \a m, parent \a staff and \a timeStart.
Todo:
Modus on different pitches

References CAMusElement::KeySignature, Modus, setKeySignatureType(), setModus(), and CAMusElement::setMusElementType().

Here is the call graph for this function:


Member Function Documentation

Returns the array of accidentals for every level in the scale.

The levels can have the following values:

  • 0 - natural
  • 1 - sharp
  • 2 - double sharp
  • ...
  • -1 - flat
  • -2 - double flat
  • ...

References _accidentals.

Referenced by CADrawableKeySignature::CADrawableKeySignature(), CADrawableStaff::getAccs(), and CAKeybdInput::matchPitchToKey().

Here is the caller graph for this function:

CAKeySignature * CAKeySignature::clone ( CAContext context = 0) [virtual]

Clones a music element with exact properties including the context.

Implements CAMusElement.

References CAMusElement::addMark(), CAKeySignature(), diatonicKey(), keySignatureType(), MajorMinor, CAMusElement::markList(), and CAMusElement::timeStart().

Here is the call graph for this function:

int CAKeySignature::compare ( CAMusElement elt) [virtual]

Compares the music element with the given elt and returns number of differences in their properties. Returns 0, if the music elements are exact; -1 if the music element type differs; otherwise number greater than 0.

This method is usually used when opening a score document where music elements are written in various voices (eg. barlines), but are eventually merged and written only once per staff.

Implements CAMusElement.

References diatonicKey(), CAMusElement::KeySignature, keySignatureType(), MajorMinor, and CAMusElement::musElementType().

Here is the call graph for this function:

References _keySignatureType.

Referenced by clone(), compare(), CACanorusMLImport::endElement(), CACanorusMLExport::exportVoiceImpl(), and updateAccidentals().

Here is the caller graph for this function:

References Custom, MajorMinor, and Modus.

Referenced by CACanorusMLImport::startElement().

Here is the caller graph for this function:

References Custom, MajorMinor, and Modus.

Referenced by CACanorusMLExport::exportVoiceImpl().

Here is the caller graph for this function:

References _modus.

Referenced by CACanorusMLExport::exportVoiceImpl(), and setModus().

Here is the caller graph for this function:

References Aeolian, Dorian, Hypodorian, Hypolydian, Hypomixolydian, Hypophrygian, Ionian, Locrian, Lydian, Mixolydian, and Phrygian.

Referenced by CACanorusMLImport::startElement().

Here is the caller graph for this function:

const QString CAKeySignature::modusToString ( CAModus  modus) [static]

References Aeolian, Dorian, Hypodorian, Hypolydian, Hypomixolydian, Hypophrygian, Ionian, Locrian, Lydian, Mixolydian, and Phrygian.

Referenced by CACanorusMLExport::exportVoiceImpl().

Here is the caller graph for this function:

References _diatonicKey, and updateAccidentals().

Referenced by CAKeySignature(), CACanorusMLImport::endElement(), and CAMainWin::on_uiKeySig_activated().

Here is the call graph for this function:

Here is the caller graph for this function:

References _keySignatureType.

Referenced by CAKeySignature().

Here is the caller graph for this function:

void CAKeySignature::setModus ( CAModus  modus) [inline]

References _modus, and modus().

Referenced by CAKeySignature().

Here is the call graph for this function:

Here is the caller graph for this function:

References CAMusElement::context().

Here is the call graph for this function:

Todo:
Implement non major-minor types

References _accidentals, _diatonicKey, keySignatureType(), MajorMinor, and CADiatonicKey::numberOfAccs().

Referenced by setDiatonicKey().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Accidentals configuration for each level.

Indexes: [0..6] - C, D, E, F ... B Values: 0 - none, -1 - flat, +1 - sharp

See also:
accidentals(), numberOfAccidentals()

Referenced by accidentals(), and updateAccidentals().

Referenced by modus(), and setModus().


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