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

Represents a note in the score. More...

#include <note.h>

Inheritance diagram for CANote:
Inheritance graph
[legend]

List of all members.

Public Types

enum  CAStemDirection { StemNeutral, StemUp, StemDown, StemPreferred }
 Direction of the note's stem. More...

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

Static Public Member Functions

static const QString generateNoteName (int pitch, int accs)
static const QString stemDirectionToString (CAStemDirection)
static CAStemDirection stemDirectionFromString (const QString)

Private Attributes

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

Detailed Description

Represents a note in the score.

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

Member Enumeration Documentation

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:
StemNeutral 
StemUp 
StemDown 
StemPreferred 

Constructor & Destructor Documentation

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 ( ) [virtual]

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

Here is the call graph for this function:


Member Function Documentation

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:

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, 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:

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(), and CAMusElement::timeStart().

Referenced by CAStaff::clone().

Here is the call graph for this function:

Here is the caller graph for this function:

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:

bool CANote::forceAccidentals ( ) [inline]

References _forceAccidentals.

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 CAScoreViewPort::paintEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

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::indexOf(), CAVoice::musElementAt(), CAVoice::musElementCount(), CAMusElement::musElementType(), CAMusElement::Note, CAMusElement::timeStart(), and CAPlayable::voice().

Referenced by CAVoice::addNoteToChord(), CALilyPondExport::exportPlayable(), CAMainWin::insertMusElementAt(), and CAVoice::remove().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Referenced by CALilyPondExport::exportPlayable(), and CAVoice::remove().

Here is the call graph for this function:

Here is the caller graph for this function:

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

References CAMusElement::_timeStart, CAVoice::indexOf(), 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:

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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(), diatonicPitch(), CAVoice::getClef(), CADiatonicPitch::noteName(), 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:

void CANote::setDiatonicPitch ( CADiatonicPitch pitch) [inline]

References _diatonicPitch, and updateTies().

Referenced by CANote(), CACanorusMLImport::endElement(), and CAMainWin::scoreViewPortKeyPress().

Here is the call graph for this function:

Here is the caller graph for this function:

void CANote::setForceAccidentals ( bool  force) [inline]

References _forceAccidentals.

void CANote::setPhrasingSlurEnd ( CASlur pSlurEnd) [inline]
void CANote::setPhrasingSlurStart ( CASlur pSlurStart) [inline]
void CANote::setSlurEnd ( CASlur slurEnd) [inline]

References _slurEnd, and slurEnd().

Referenced by CANote(), 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:

void CANote::setSlurStart ( CASlur slurStart) [inline]

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:

void CANote::setTieEnd ( CASlur tieEnd) [inline]

References _tieEnd, and tieEnd().

Referenced by CANote(), CAMusElementFactory::configureSlur(), updateTies(), CAMidiImport::writeMidiChannelEventsToVoice(), and CASlur::~CASlur().

Here is the call graph for this function:

Here is the caller graph for this function:

void CANote::setTieStart ( CASlur tieStart) [inline]
CASlur* CANote::slurEnd ( ) [inline]
CASlur* CANote::slurStart ( ) [inline]

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:

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

See also:
CAStemDirection, CACanorusML

References StemDown, StemNeutral, StemPreferred, and StemUp.

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

Here is the caller graph for this function:

CASlur* CANote::tieEnd ( ) [inline]

References _tieEnd.

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

Here is the caller graph for this function:

CASlur* CANote::tieStart ( ) [inline]

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

Referenced by diatonicPitch(), and setDiatonicPitch().

Always draw notes accidentals.

See also:
_accs

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

Referenced by setSlurEnd(), and slurEnd().

Referenced by setSlurStart(), and slurStart().

Direction of the note's stem, if any.

See also:
CAStemDirection

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

CASlur* CANote::_tieEnd [private]

Referenced by setTieEnd(), and tieEnd().

Referenced by setTieStart(), and tieStart().


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