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

Represents a note in the score. More...

#include <note.h>

Inheritance diagram for CANote:
Inheritance graph
[legend]

Public Types

enum  CAStemDirection {
  StemUndefined = -1 , StemNeutral , StemUp , StemDown ,
  StemPreferred
}
 Direction of the note's stem. More...
 
- 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

 CANote (CADiatonicPitch pitch, CAPlayableLength length, CAVoice *voice, int timeStart, int timeLength=-1)
 
CANoteclone (CAVoice *voice=0)
 
virtual ~CANote ()
 
CAPlayableLength noteLength ()
 
CADiatonicPitchdiatonicPitch ()
 
void setDiatonicPitch (CADiatonicPitch pitch)
 
int midiPitch ()
 
CAStemDirection stemDirection ()
 
void setStemDirection (CAStemDirection direction)
 
int notePosition ()
 
CASlurtieStart ()
 
CASlurtieEnd ()
 
CASlurslurStart ()
 
CASlurslurEnd ()
 
CASlurphrasingSlurStart ()
 
CASlurphrasingSlurEnd ()
 
CAStemDirection actualStemDirection ()
 
CASlur::CASlurDirection actualSlurDirection ()
 
void setTieStart (CASlur *tieStart)
 
void setTieEnd (CASlur *tieEnd)
 
void setSlurStart (CASlur *slurStart)
 
void setSlurEnd (CASlur *slurEnd)
 
void setPhrasingSlurStart (CASlur *pSlurStart)
 
void setPhrasingSlurEnd (CASlur *pSlurEnd)
 
void updateTies ()
 
bool isPartOfChord ()
 
bool isLastInChord ()
 
bool isFirstInChord ()
 
QList< CANote * > getChord ()
 
bool forceAccidentals ()
 
void setForceAccidentals (bool force)
 
int compare (CAMusElement *elt)
 
- Public Member Functions inherited from CAPlayable
 CAPlayable (CAPlayableLength length, CAVoice *voice, int timeStart, int timeLength=-1)
 
virtual ~CAPlayable ()
 
CAPlayableLengthplayableLength ()
 
void setPlayableLength (CAPlayableLength &l)
 
virtual CAPlayableclone (CAContext *context)
 
virtual CAPlayableclone (CAVoice *voice=0)=0
 
CATuplettuplet ()
 
void setTuplet (CATuplet *t)
 
CAVoicevoice ()
 
void setVoice (CAVoice *v)
 
CAStaffstaff ()
 
bool isFirstInTuplet ()
 
bool isLastInTuplet ()
 
void resetTime ()
 
void calculateTimeLength ()
 
- Public Member Functions inherited from CAMusElement
 CAMusElement (CAContext *context, int timeStart, int timeLength=0)
 
virtual ~CAMusElement ()
 
virtual CAMusElementclone (CAContext *context=0)=0
 
virtual int compare (CAMusElement *elt)=0
 
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 generateNoteName (int pitch, int accs)
 
static const QString stemDirectionToString (CAStemDirection)
 
static CAStemDirection stemDirectionFromString (const QString)
 
- Static Public Member Functions inherited from CAMusElement
static const QString musElementTypeToString (CAMusElementType)
 
static CAMusElementType musElementTypeFromString (const QString)
 

Private Attributes

CADiatonicPitch _diatonicPitch
 
CAStemDirection _stemDirection
 
bool _forceAccidentals
 
CASlur_tieStart
 
CASlur_tieEnd
 
CASlur_slurStart
 
CASlur_slurEnd
 
CASlur_phrasingSlurStart
 
CASlur_phrasingSlurEnd
 

Additional Inherited Members

- Protected Member Functions inherited from CAMusElement
void setMusElementType (CAMusElementType type)
 
- Protected Attributes inherited from CAPlayable
CAPlayableLength _playableLength
 
CAVoice_voice
 
CATuplet_tuplet
 
- 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 note in the score.

Copyright (c) 2006-2010, 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 class represents every note in the score. It inherits the base class CAPlayable.

Chords in Canorus don't have its own class, but are represented as a list of notes. The first note in the chord identifies it and contains chord-level marks.

Member Enumeration Documentation

◆ CAStemDirection

Direction of the note's stem.

This type represents the direction of the note's stem.

Todo:
Stem itself will probably be created as a separate class in the future. This will give us possibility for a chord to have a common stem, apply additional stem properties etc. -Matevz

Possible values:

  • StemNeutral Up if under the middle line, down if above the middle line.
  • StemUp Always up.
  • StemDown Always down.
  • StemPreferred Use the voice's preferred direction.
Enumerator
StemUndefined 
StemNeutral 
StemUp 
StemDown 
StemPreferred 

Constructor & Destructor Documentation

◆ CANote()

CANote::CANote ( CADiatonicPitch  pitch,
CAPlayableLength  length,
CAVoice voice,
int  timeStart,
int  timeLength = -1 
)

Creates a new note with playable length length in voice voice with pitch pitch and accidentals accs, with starting time in the score timeStart and number of dots dotted. timeLength is calculated automatically from the playable length.

See also
CAPlayableLength, CAPlayable, CAVoice, _pitch, _accs

References _forceAccidentals, CAMusElement::_musElementType, _stemDirection, CAMusElement::Note, setDiatonicPitch(), setPhrasingSlurEnd(), setPhrasingSlurStart(), setSlurEnd(), setSlurStart(), setTieEnd(), setTieStart(), and StemPreferred.

Referenced by clone().

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

◆ ~CANote()

CANote::~CANote ( )
virtual

References CAMusElement::markList(), CASlur::setNoteEnd(), tieEnd(), and tieStart().

Here is the call graph for this function:

Member Function Documentation

◆ actualSlurDirection()

CASlur::CASlurDirection CANote::actualSlurDirection ( )

Determines the right slur direction of the note. Slur should be on the other side of the stem, if the stem direction is neutral or on the same side if the stem direction is set strictly to up and down (or preferred).

References actualStemDirection(), CASlur::SlurDown, CASlur::SlurUp, stemDirection(), StemNeutral, StemPreferred, StemUp, and CAPlayable::voice().

Here is the call graph for this function:

◆ actualStemDirection()

CANote::CAStemDirection CANote::actualStemDirection ( )

Returns the actual stem direction (the one which is drawn). Always returns stem up or stem down.

References notePosition(), CAPlayable::staff(), stemDirection(), CAVoice::stemDirection(), StemDown, StemNeutral, StemPreferred, StemUndefined, StemUp, and CAPlayable::voice().

Referenced by actualSlurDirection(), and CADrawableNote::CADrawableNote().

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

◆ clone()

CANote * CANote::clone ( CAVoice voice = 0)
virtual

Clones the note with same pitch, voice, timeStart and other properties. Does not create clones of ties, slurs and phrasing slurs!

Implements CAPlayable.

References CAMusElement::addMark(), CANote(), diatonicPitch(), CAMusElement::markList(), CAPlayable::playableLength(), setStemDirection(), stemDirection(), CAMusElement::timeLength(), CAMusElement::timeStart(), and CAPlayable::voice().

Here is the call graph for this function:

◆ compare()

int CANote::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 diatonicPitch(), CAMusElement::musElementType(), CAMusElement::Note, and CAPlayable::playableLength().

Here is the call graph for this function:

◆ diatonicPitch()

CADiatonicPitch & CANote::diatonicPitch ( )
inline

◆ forceAccidentals()

bool CANote::forceAccidentals ( )
inline

References _forceAccidentals.

Referenced by CALilyPondExport::exportPlayable().

Here is the caller graph for this function:

◆ generateNoteName()

const QString CANote::generateNoteName ( int  pitch,
int  accs 
)
static

Generates the note name on the given pitch pitch with accidentals accs. Note name ranges are from C,, for sub-contra octave to c''''' for fifth octave. This method is usually used for showing the note pitch in status bar.

See also
_pitch, _accs

References CAMusElement::name().

Referenced by CAScoreView::paintEvent().

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

◆ getChord()

QList< CANote * > CANote::getChord ( )

Generates a list of notes with the same start time - the whole chord - in the current voice. Notes in chord keep the order present in the voice. This is usually bottom-up.

Returns a single element in the list - only the note itself, if the note isn't part of the chord.

See also
CAVoice::addNoteToChord()

References CAVoice::musElementList(), CAMusElement::musElementType(), CAMusElement::Note, CAMusElement::timeStart(), and CAPlayable::voice().

Referenced by CAVoice::addNoteToChord(), CALilyPondExport::exportPlayable(), CAVoice::insert(), CAMainWin::insertMusElementAt(), CAMusicXmlImport::readNote(), CAVoice::remove(), and CAMainWin::scoreViewKeyPress().

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

◆ isFirstInChord()

bool CANote::isFirstInChord ( )

Returns true, if the note is the first in the list of the chord; otherwise false.

References CAMusElement::_timeStart, CAVoice::musElementList(), CAMusElement::musElementType(), CAMusElement::Note, CAMusElement::timeStart(), and CAPlayable::voice().

Referenced by CACanorusMLExport::exportMarks(), CAMusicXmlExport::exportNote(), CALilyPondExport::exportPlayable(), CAPlayback::loopUntilPlayable(), CALayoutEngine::placeMarks(), and CAVoice::remove().

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

◆ isLastInChord()

bool CANote::isLastInChord ( )

Returns true, if the note is the last in the list of the chord; otherwise false.

References CAMusElement::_timeStart, CAVoice::musElementList(), CAMusElement::musElementType(), CAMusElement::Note, CAMusElement::timeStart(), and CAPlayable::voice().

Referenced by CALilyPondExport::exportPlayable().

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

◆ isPartOfChord()

bool CANote::isPartOfChord ( )

Returns true, if the note is part of a chord; otherwise false.

References CAMusElement::_timeStart, CAVoice::musElementList(), CAMusElement::musElementType(), CAMusElement::Note, CAMusElement::timeStart(), and CAPlayable::voice().

Referenced by CAMainWin::deleteSelection(), CAMusicXmlExport::exportNote(), CALilyPondExport::exportPlayable(), CAMainWin::insertMusElementAt(), and CAVoice::remove().

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

◆ midiPitch()

int CANote::midiPitch ( )
inline

References _diatonicPitch, and CADiatonicPitch::midiPitch().

Here is the call graph for this function:

◆ noteLength()

CAPlayableLength CANote::noteLength ( )
inline

◆ notePosition()

int CANote::notePosition ( )

Dependent on the current clef calculates and returns the vertical note position in the staff looking bottom-up:

  • 0 - first line
  • 1 - first space
  • 2 - second line
  • -1 - first space below the first line
  • -2 - first ledger line below the staff (eg. C1 in treble clef)

References CAClef::c1(), CAStaff::clefRefs(), diatonicPitch(), CADiatonicPitch::noteName(), CAPlayable::staff(), CAVoice::staff(), CAMusElement::timeStart(), and CAPlayable::voice().

Referenced by actualStemDirection(), and CADrawableNote::draw().

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

◆ phrasingSlurEnd()

CASlur * CANote::phrasingSlurEnd ( )
inline

◆ phrasingSlurStart()

CASlur * CANote::phrasingSlurStart ( )
inline

◆ setDiatonicPitch()

void CANote::setDiatonicPitch ( CADiatonicPitch  pitch)
inline

References _diatonicPitch, and updateTies().

Referenced by CANote(), CACanorusMLImport::endElement(), CATranspose::reinterpretAccidentals(), and CAMainWin::scoreViewKeyPress().

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

◆ setForceAccidentals()

void CANote::setForceAccidentals ( bool  force)
inline

References _forceAccidentals.

◆ setPhrasingSlurEnd()

void CANote::setPhrasingSlurEnd ( CASlur pSlurEnd)
inline

◆ setPhrasingSlurStart()

void CANote::setPhrasingSlurStart ( CASlur pSlurStart)
inline

◆ setSlurEnd()

void CANote::setSlurEnd ( CASlur slurEnd)
inline

References _slurEnd, and slurEnd().

Referenced by CANote(), CAStaff::clone(), CAMusElementFactory::configureSlur(), CALilyPondImport::importVoiceImpl(), CAVoice::remove(), CACanorusMLImport::startElement(), and CASlur::~CASlur().

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

◆ setSlurStart()

void CANote::setSlurStart ( CASlur slurStart)
inline

◆ setStemDirection()

void CANote::setStemDirection ( CAStemDirection  dir)

Sets the stem direction and update tie, slur and phrasing slur direction.

References _stemDirection.

Referenced by CAVoice::addNoteToChord(), clone(), CAMainWin::on_uiNoteStemDirection_toggled(), and CACanorusMLImport::startElement().

Here is the caller graph for this function:

◆ setTieEnd()

void CANote::setTieEnd ( CASlur tieEnd)
inline

References _tieEnd, and tieEnd().

Referenced by CANote(), CAStaff::clone(), CAMusElementFactory::configureSlur(), CAMainWin::pasteAt(), CAMusicXmlImport::readNote(), updateTies(), and CASlur::~CASlur().

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

◆ setTieStart()

void CANote::setTieStart ( CASlur tieStart)
inline

◆ slurEnd()

CASlur * CANote::slurEnd ( )
inline

◆ slurStart()

CASlur * CANote::slurStart ( )
inline

◆ stemDirection()

CAStemDirection CANote::stemDirection ( )
inline

◆ stemDirectionFromString()

CANote::CAStemDirection CANote::stemDirectionFromString ( const QString  dir)
static

Converts stem direction in QString format to CAStemDirection. This is usually used when loading a score.

See also
CAStemDirection, CACanorusML

References StemDown, StemNeutral, StemPreferred, and StemUp.

Referenced by CACanorusMLImport::startElement().

Here is the caller graph for this function:

◆ stemDirectionToString()

const QString CANote::stemDirectionToString ( CANote::CAStemDirection  dir)
static

Converts stem direction CAStemDirection to QString. This is usually used when saving the score.

See also
CAStemDirection, CACanorusML

References StemDown, StemNeutral, StemPreferred, StemUndefined, and StemUp.

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

Here is the caller graph for this function:

◆ tieEnd()

CASlur * CANote::tieEnd ( )
inline

References _tieEnd.

Referenced by CAMainWin::copySelection(), CAMainWin::pasteAt(), CALayoutEngine::reposit(), CAPlayback::run(), setTieEnd(), updateTies(), and ~CANote().

Here is the caller graph for this function:

◆ tieStart()

CASlur * CANote::tieStart ( )
inline

◆ updateTies()

void CANote::updateTies ( )

Looks at the tieStart() and tieEnd() ties and unties the note and tie if the previous/next note pitch differs.

References diatonicPitch(), CAVoice::getNoteList(), CASlur::noteEnd(), CASlur::setNoteEnd(), setTieEnd(), tieEnd(), tieStart(), CAMusElement::timeEnd(), CAMusElement::timeStart(), and CAPlayable::voice().

Referenced by CACanorusMLImport::endElement(), CALilyPondImport::importVoiceImpl(), and setDiatonicPitch().

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

Member Data Documentation

◆ _diatonicPitch

CADiatonicPitch CANote::_diatonicPitch
private

◆ _forceAccidentals

CANote::_forceAccidentals
private

Always draw notes accidentals.

See also
_accs

Referenced by CANote(), forceAccidentals(), and setForceAccidentals().

◆ _phrasingSlurEnd

CASlur* CANote::_phrasingSlurEnd
private

◆ _phrasingSlurStart

CASlur* CANote::_phrasingSlurStart
private

◆ _slurEnd

CASlur* CANote::_slurEnd
private

Referenced by setSlurEnd(), and slurEnd().

◆ _slurStart

CASlur* CANote::_slurStart
private

Referenced by setSlurStart(), and slurStart().

◆ _stemDirection

CANote::_stemDirection
private

Direction of the note's stem, if any.

See also
CAStemDirection

Referenced by CANote(), setStemDirection(), and stemDirection().

◆ _tieEnd

CASlur* CANote::_tieEnd
private

Referenced by setTieEnd(), and tieEnd().

◆ _tieStart

CASlur* CANote::_tieStart
private

Referenced by setTieStart(), and tieStart().


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