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

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

#include <keysignature.h>

Inheritance diagram for CAKeySignature:
Inheritance graph
[legend]

Public Types

enum  CAKeySignatureType { MajorMinor, Modus, Custom }
 
enum  CAModus {
  Ionian, Dorian, Phrygian, Lydian,
  Mixolydian, Aeolian, Locrian, Hypodorian,
  Hypolydian, Hypomixolydian, Hypophrygian
}
 
- Public Types inherited from CAMusElement
enum  CAMusElementType {
  Undefined = 0, Note, Rest, MidiNote,
  Barline, Clef, TimeSignature, KeySignature,
  Slur, Tuplet, Syllable, FunctionMark,
  FiguredBassMark, Mark
}
 

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)
 
QList< int > & accidentals ()
 
int compare (CAMusElement *elt)
 
- Public Member Functions inherited from CAMusElement
 CAMusElement (CAContext *context, int timeStart, int timeLength=0)
 
virtual ~CAMusElement ()
 
CAMusElementType musElementType ()
 
CAContextcontext ()
 
void setContext (CAContext *context)
 
virtual int timeStart () const
 
void setTimeStart (int time)
 
virtual int timeLength () const
 
void setTimeLength (int length)
 
int timeEnd ()
 
virtual int realTimeStart ()
 
virtual int realTimeLength ()
 
int realTimeEnd ()
 
const QString name ()
 
void setName (const QString name)
 
const bool isVisible ()
 
void setVisible (const bool v)
 
const QColor color ()
 
void setColor (const QColor c)
 
const QList< CAMark * > markList ()
 
void addMark (CAMark *mark)
 
void addMarks (QList< CAMark * > marks)
 
void removeMark (CAMark *mark)
 
const QList< CANoteCheckerError * > & noteCheckerErrorList ()
 
void addNoteCheckerError (CANoteCheckerError *nce)
 
void removeNoteCheckerError (CANoteCheckerError *nce)
 
bool isPlayable ()
 

Static Public Member Functions

static const QString keySignatureTypeToString (CAKeySignatureType)
 
static CAKeySignatureType keySignatureTypeFromString (const QString)
 
static const QString modusToString (CAModus)
 
static CAModus modusFromString (const QString)
 
- Static Public Member Functions inherited from CAMusElement
static const QString musElementTypeToString (CAMusElementType)
 
static CAMusElementType musElementTypeFromString (const QString)
 

Private Member Functions

void updateAccidentals ()
 

Private Attributes

CAKeySignatureType _keySignatureType
 
CAModus _modus
 
CADiatonicKey _diatonicKey
 
QList< int > _accidentals
 

Additional Inherited Members

- Protected Member Functions inherited from CAMusElement
void setMusElementType (CAMusElementType type)
 
- Protected Attributes inherited from CAMusElement
CAMusElementType _musElementType
 
QList< CAMark * > _markList
 
QList< CANoteCheckerError * > _noteCheckerErrorList
 
CAContext_context
 
int _timeStart
 
int _timeLength
 
bool _visible
 
QColor _color
 
QString _name
 

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.

See also
CADiatonicKey

Member Enumeration Documentation

◆ CAKeySignatureType

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 

◆ CAModus

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() [1/2]

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 _accidentals, 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() [2/2]

CAKeySignature::CAKeySignature ( CAModus  m,
CAStaff staff,
int  timeStart 
)

Creates a new key signature of type Modus, modus type m, parent staff and timeStart.

Todo:
Modus on different pitches

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

Here is the call graph for this function:

◆ ~CAKeySignature()

CAKeySignature::~CAKeySignature ( )

Member Function Documentation

◆ accidentals()

CAKeySignature::accidentals ( )
inline

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:

◆ clone()

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

Clones a music element with exact properties including the context.

Implements CAMusElement.

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

Here is the call graph for this function:

◆ compare()

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:

◆ diatonicKey()

CADiatonicKey CAKeySignature::diatonicKey ( )
inline

◆ keySignatureType()

CAKeySignatureType CAKeySignature::keySignatureType ( )
inline

References _keySignatureType.

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

Here is the caller graph for this function:

◆ keySignatureTypeFromString()

CAKeySignature::CAKeySignatureType CAKeySignature::keySignatureTypeFromString ( const QString  type)
static

References Custom, MajorMinor, and Modus.

Referenced by CACanorusMLImport::startElement().

Here is the caller graph for this function:

◆ keySignatureTypeToString()

const QString CAKeySignature::keySignatureTypeToString ( CAKeySignatureType  type)
static

References Custom, MajorMinor, and Modus.

Referenced by CACanorusMLExport::exportVoiceImpl().

Here is the caller graph for this function:

◆ modus()

CAModus CAKeySignature::modus ( )
inline

References _modus.

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

Here is the caller graph for this function:

◆ modusFromString()

CAKeySignature::CAModus CAKeySignature::modusFromString ( const QString  modus)
static

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

Referenced by CACanorusMLImport::startElement().

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

◆ modusToString()

const QString CAKeySignature::modusToString ( CAModus  modus)
static

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

Referenced by CACanorusMLExport::exportVoiceImpl().

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

◆ setDiatonicKey()

void CAKeySignature::setDiatonicKey ( CADiatonicKey  k)
inline

References _diatonicKey, and updateAccidentals().

Referenced by CAKeySignature(), CACanorusMLImport::endElement(), CAKeySignatureCtl::on_uiKeySig_activated(), and CATranspose::reinterpretAccidentals().

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

◆ setKeySignatureType()

void CAKeySignature::setKeySignatureType ( CAKeySignatureType  type)
inline

References _keySignatureType.

Referenced by CAKeySignature().

Here is the caller graph for this function:

◆ setModus()

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:

◆ staff()

CAStaff* CAKeySignature::staff ( )
inline

References CAMusElement::context().

Here is the call graph for this function:

◆ updateAccidentals()

void CAKeySignature::updateAccidentals ( )
private
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

CAKeySignature::_accidentals
private

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(), CAKeySignature(), and updateAccidentals().

◆ _diatonicKey

CADiatonicKey CAKeySignature::_diatonicKey
private

◆ _keySignatureType

CAKeySignatureType CAKeySignature::_keySignatureType
private

◆ _modus

CAModus CAKeySignature::_modus
private

Referenced by modus(), and setModus().


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