#include <note.h>

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.
This class represents every note in the score. It inherits the base class CAPlayable.
Definition at line 17 of file note.h.
Direction of the note's stem.
This type represents the direction of the note's stem.
| CANote::CANote | ( | CAPlayableLength | length, | |
| CAVoice * | voice, | |||
| int | pitch, | |||
| signed char | accs, | |||
| int | timeStart, | |||
| int | dotted = 0 | |||
| ) |
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.
Definition at line 28 of file note.cpp.
References _accs, _forceAccidentals, _midiPitch, CAMusElement::_musElementType, _pitch, _stemDirection, calculateNotePosition(), CAMusElement::Note, pitchToMidiPitch(), setPhrasingSlurEnd(), setPhrasingSlurStart(), setSlurEnd(), setSlurStart(), setTieEnd(), setTieStart(), and StemPreferred.
Referenced by clone().


| CANote::~CANote | ( | ) | [virtual] |
Definition at line 48 of file note.cpp.
References CAMusElement::markList(), CASlur::setNoteEnd(), tieEnd(), and tieStart().

Clones the note with same pitch, voice, timeStart and other properties. Does *not* create clones of ties, slurs and phrasing slurs!
Implements CAPlayable.
Definition at line 82 of file note.cpp.
References _accs, CAPlayable::_dotted, _pitch, CAPlayable::_playableLength, CAMusElement::_timeStart, CAMusElement::addMark(), CANote(), CAMusElement::markList(), CAMark::setAssociatedElement(), setStemDirection(), and stemDirection().

| CANote* CANote::clone | ( | ) | [inline, virtual] |
Clones a music element with exact properties including the context.
Implements CAMusElement.
Definition at line 28 of file note.h.
References CAPlayable::voice().

| CAPlayableLength CANote::noteLength | ( | ) | [inline] |
| CANote::pitch | ( | ) | [inline] |
Returns the note pitch in internal Canorus units.
Definition at line 34 of file note.h.
References _pitch.
Referenced by CAVoice::addNoteToChord(), CADrawableStaff::calculateCenterYCoord(), compare(), CALilyPondExport::exportVoiceImpl(), CACanorusMLExport::exportVoiceImpl(), CAMainWin::insertMusElementAt(), CALilyPondExport::relativePitchToString(), CAMainWin::scoreViewPortKeyPress(), and updateTies().

| CANote::setPitch | ( | int | pitch | ) |
Sets the note pitch to pitch.
Definition at line 140 of file note.cpp.
References _accs, _midiPitch, _pitch, calculateNotePosition(), pitchToMidiPitch(), and updateTies().
Referenced by CAMainWin::scoreViewPortKeyPress().

| CANote::accidentals | ( | ) | [inline] |
Returns number and type of accidentals of the note.
Definition at line 37 of file note.h.
References _accs.
Referenced by CALilyPondExport::exportVoiceImpl(), CACanorusMLExport::exportVoiceImpl(), and CALilyPondExport::relativePitchToString().

| CANote::setAccidentals | ( | int | accs | ) |
Keeps _midPitch proper when the Accidentals are modified
Sets a number and type of accidentals to accs of the note.
Definition at line 233 of file note.cpp.
References _accs, _midiPitch, _pitch, and pitchToMidiPitch().

| CAStemDirection CANote::stemDirection | ( | ) | [inline] |
Definition at line 40 of file note.h.
References _stemDirection.
Referenced by actualSlurDirection(), actualStemDirection(), CAVoice::addNoteToChord(), clone(), CACanorusMLExport::exportVoiceImpl(), and CAMainWin::updatePlayableToolBar().

| void CANote::setStemDirection | ( | CAStemDirection | dir | ) |
Sets the stem direction and update tie, slur and phrasing slur direction.
Definition at line 241 of file note.cpp.
References _stemDirection.
Referenced by CAVoice::addNoteToChord(), clone(), CAMainWin::on_uiNoteStemDirection_toggled(), and CACanorusMLImport::startElement().

| int CANote::notePosition | ( | ) | [inline] |
Definition at line 43 of file note.h.
References _notePosition.
Referenced by actualStemDirection(), and CADrawableNote::draw().

| void CANote::setNotePosition | ( | int | notePosition | ) | [inline] |
| unsigned char CANote::midiPitch | ( | ) | [inline] |
Definition at line 46 of file note.h.
References _midiPitch.
Referenced by compare(), and CAPlayback::run().

| void CANote::setMidiPitch | ( | unsigned char | pitch | ) | [inline] |
| CASlur* CANote::tieStart | ( | ) | [inline] |
Definition at line 49 of file note.h.
References _tieStart.
Referenced by CALilyPondExport::exportVoiceImpl(), CACanorusMLExport::exportVoiceImpl(), CAMainWin::insertMusElementAt(), CAPlayback::run(), updateTies(), and ~CANote().

| CASlur* CANote::tieEnd | ( | ) | [inline] |
Definition at line 50 of file note.h.
References _tieEnd.
Referenced by CAPlayback::run(), updateTies(), and ~CANote().

| CASlur* CANote::slurStart | ( | ) | [inline] |
Definition at line 51 of file note.h.
References _slurStart.
Referenced by CALilyPondExport::exportVoiceImpl(), CACanorusMLExport::exportVoiceImpl(), CAMainWin::insertMusElementAt(), and CAVoice::remove().

| CASlur* CANote::slurEnd | ( | ) | [inline] |
Definition at line 52 of file note.h.
References _slurEnd.
Referenced by CALilyPondExport::exportVoiceImpl(), CACanorusMLExport::exportVoiceImpl(), CAMainWin::insertMusElementAt(), and CAVoice::remove().

| CASlur* CANote::phrasingSlurStart | ( | ) | [inline] |
Definition at line 53 of file note.h.
References _phrasingSlurStart.
Referenced by CALilyPondExport::exportVoiceImpl(), CACanorusMLExport::exportVoiceImpl(), CAMainWin::insertMusElementAt(), and CAVoice::remove().

| CASlur* CANote::phrasingSlurEnd | ( | ) | [inline] |
Definition at line 54 of file note.h.
References _phrasingSlurEnd.
Referenced by CALilyPondExport::exportVoiceImpl(), CACanorusMLExport::exportVoiceImpl(), CAMainWin::insertMusElementAt(), and CAVoice::remove().

| CANote::CAStemDirection CANote::actualStemDirection | ( | ) |
Returns the actual stem direction (the one which is drawn). Always returns stem up or stem down.
Definition at line 366 of file note.cpp.
References notePosition(), CAPlayable::staff(), CAVoice::stemDirection(), stemDirection(), StemDown, StemNeutral, StemPreferred, StemUp, and CAPlayable::voice().
Referenced by actualSlurDirection(), and CADrawableNote::CADrawableNote().


| 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).
Definition at line 405 of file note.cpp.
References actualStemDirection(), CASlur::SlurDown, CASlur::SlurUp, stemDirection(), StemNeutral, StemPreferred, StemUp, and CAPlayable::voice().

| void CANote::setTieStart | ( | CASlur * | tieStart | ) | [inline] |
Definition at line 59 of file note.h.
References _tieStart.
Referenced by CANote(), CAMusElementFactory::configureSlur(), CALilyPondImport::importVoiceImpl(), CACanorusMLImport::startElement(), and CASlur::~CASlur().

| void CANote::setTieEnd | ( | CASlur * | tieEnd | ) | [inline] |
Definition at line 60 of file note.h.
References _tieEnd.
Referenced by CANote(), CAMusElementFactory::configureSlur(), updateTies(), and CASlur::~CASlur().

| void CANote::setSlurStart | ( | CASlur * | slurStart | ) | [inline] |
Definition at line 61 of file note.h.
References _slurStart.
Referenced by CANote(), CAMusElementFactory::configureSlur(), CALilyPondImport::importVoiceImpl(), CAVoice::remove(), CACanorusMLImport::startElement(), and CASlur::~CASlur().

| void CANote::setSlurEnd | ( | CASlur * | slurEnd | ) | [inline] |
Definition at line 62 of file note.h.
References _slurEnd.
Referenced by CANote(), CAMusElementFactory::configureSlur(), CALilyPondImport::importVoiceImpl(), CAVoice::remove(), CACanorusMLImport::startElement(), and CASlur::~CASlur().

| void CANote::setPhrasingSlurStart | ( | CASlur * | pSlurStart | ) | [inline] |
Definition at line 63 of file note.h.
References _phrasingSlurStart.
Referenced by CANote(), CAMusElementFactory::configureSlur(), CALilyPondImport::importVoiceImpl(), CAVoice::remove(), CACanorusMLImport::startElement(), and CASlur::~CASlur().

| void CANote::setPhrasingSlurEnd | ( | CASlur * | pSlurEnd | ) | [inline] |
Definition at line 64 of file note.h.
References _phrasingSlurEnd.
Referenced by CANote(), CAMusElementFactory::configureSlur(), CALilyPondImport::importVoiceImpl(), CAVoice::remove(), CACanorusMLImport::startElement(), and CASlur::~CASlur().

| void CANote::updateTies | ( | ) |
Looks at the tieStart() and tieEnd() ties and unties the note and tie if the previous/next note pitch differs.
Definition at line 249 of file note.cpp.
References CAVoice::getNoteList(), CASlur::noteEnd(), pitch(), CASlur::setNoteEnd(), setTieEnd(), tieEnd(), tieStart(), CAMusElement::timeEnd(), CAMusElement::timeStart(), and CAPlayable::voice().
Referenced by CACanorusMLImport::endElement(), CALilyPondImport::importVoiceImpl(), and setPitch().


| bool CANote::isPartOfTheChord | ( | ) |
Returns true, if the note is part of a chord; otherwise false.
Definition at line 151 of file note.cpp.
References CAMusElement::_timeStart, CAVoice::indexOf(), CAMusElement::musElementType(), CAMusElement::Note, CAMusElement::timeStart(), and CAPlayable::voice().
Referenced by CALilyPondExport::exportVoiceImpl(), CAMainWin::insertMusElementAt(), and CAVoice::remove().


| bool CANote::isLastInTheChord | ( | ) |
Returns true, if the note is the last in the list of the chord; otherwise false.
Definition at line 181 of file note.cpp.
References CAMusElement::_timeStart, CAVoice::indexOf(), CAMusElement::musElementType(), CAMusElement::Note, CAMusElement::timeStart(), and CAPlayable::voice().
Referenced by CALilyPondExport::exportVoiceImpl().


| bool CANote::isFirstInTheChord | ( | ) |
Returns true, if the note is the first in the list of the chord; otherwise false.
Definition at line 168 of file note.cpp.
References CAMusElement::_timeStart, CAVoice::indexOf(), CAMusElement::musElementType(), CAMusElement::Note, CAMusElement::timeStart(), and CAPlayable::voice().
Referenced by CALilyPondExport::exportVoiceImpl(), and CAVoice::remove().


| 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.
Definition at line 199 of file note.cpp.
References CAVoice::indexOf(), CAVoice::musElementAt(), CAVoice::musElementCount(), CAMusElement::musElementType(), CAMusElement::Note, CAMusElement::timeStart(), and CAPlayable::voice().
Referenced by CAVoice::addNoteToChord(), CALilyPondExport::exportVoiceImpl(), CAMainWin::insertMusElementAt(), and CAVoice::remove().


| bool CANote::forceAccidentals | ( | ) | [inline] |
| void CANote::setForceAccidentals | ( | bool | force | ) | [inline] |
| 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.
Definition at line 114 of file note.cpp.
References CAMusElement::name().
Referenced by CAMainWin::scoreViewPortMouseMove().

| const QString CANote::stemDirectionToString | ( | CANote::CAStemDirection | dir | ) | [static] |
Converts stem direction CAStemDirection to QString. This is usually used when saving the score.
Definition at line 301 of file note.cpp.
References StemDown, StemNeutral, StemPreferred, and StemUp.
Referenced by CACanorusMLExport::exportDocumentImpl(), and CACanorusMLExport::exportVoiceImpl().

| CANote::CAStemDirection CANote::stemDirectionFromString | ( | const | QString | ) | [static] |
Converts stem direction in QString format to CAStemDirection. This is usually used when loading a score.
Definition at line 322 of file note.cpp.
References StemDown, StemNeutral, StemPreferred, and StemUp.
Referenced by CACanorusMLImport::startElement().

| int CANote::pitchToMidiPitch | ( | int | pitch, | |
| int | acc | |||
| ) | [static] |
Converts the given internal Canorus pitch with accidentals acc to standard unsigned 7-bit MIDI pitch.
Definition at line 344 of file note.cpp.
Referenced by CANote(), setAccidentals(), and setPitch().

| int CANote::midiPitchToPitch | ( | int | midiPitch | ) | [static] |
Converts the given standard unsigned 7-bit MIDI pitch to internal Canorus pitch.
| 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.
Definition at line 216 of file note.cpp.
References _accs, _midiPitch, _pitch, CAPlayable::_playableLength, midiPitch(), CAMusElement::musElementType(), CAMusElement::Note, pitch(), CAPlayable::playableLength(), and CAMusElement::timeLength().

| void CANote::calculateNotePosition | ( | ) | [private] |
Dependent on the current clef calculates and stores internally the vertical note position in the staff.
Definition at line 101 of file note.cpp.
References _notePosition, _pitch, CAClef::c1(), CAVoice::getClef(), and CAPlayable::voice().
Referenced by CANote(), and setPitch().


unsigned char CANote::_midiPitch [private] |
Definition at line 88 of file note.h.
Referenced by CANote(), compare(), midiPitch(), setAccidentals(), setMidiPitch(), and setPitch().
CANote::_pitch [private] |
Pitch in internal Canorus format.
Definition at line 90 of file note.h.
Referenced by calculateNotePosition(), CANote(), clone(), compare(), pitch(), setAccidentals(), and setPitch().
CANote::_accs [private] |
Number of note accidentals:
Definition at line 91 of file note.h.
Referenced by accidentals(), CANote(), clone(), compare(), setAccidentals(), and setPitch().
CANote::_stemDirection [private] |
Direction of the note's stem, if any.
Definition at line 92 of file note.h.
Referenced by CANote(), setStemDirection(), and stemDirection().
CANote::_notePosition [private] |
Note location in the staff:
Definition at line 93 of file note.h.
Referenced by calculateNotePosition(), notePosition(), and setNotePosition().
CANote::_forceAccidentals [private] |
Always draw notes accidentals.
Definition at line 94 of file note.h.
Referenced by CANote(), forceAccidentals(), and setForceAccidentals().
CASlur* CANote::_tieStart [private] |
CASlur* CANote::_tieEnd [private] |
CASlur* CANote::_slurStart [private] |
CASlur* CANote::_slurEnd [private] |
CASlur* CANote::_phrasingSlurStart [private] |
Definition at line 103 of file note.h.
Referenced by phrasingSlurStart(), and setPhrasingSlurStart().
CASlur* CANote::_phrasingSlurEnd [private] |
1.5.3