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 (CAPlayableLength length, CAVoice *voice, int pitch, signed char accs, int timeStart, int dotted=0)
CANoteclone (CAVoice *voice)
CANoteclone ()
virtual ~CANote ()
CAPlayableLength noteLength ()
int pitch ()
void setPitch (int pitch)
int accidentals ()
void setAccidentals (int accs)
CAStemDirection stemDirection ()
void setStemDirection (CAStemDirection direction)
int notePosition ()
void setNotePosition (int notePosition)
unsigned char midiPitch ()
void setMidiPitch (unsigned char pitch)
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 isPartOfTheChord ()
bool isLastInTheChord ()
bool isFirstInTheChord ()
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)
static int pitchToMidiPitch (int pitch, int acc)
static int midiPitchToPitch (int midiPitch)

Private Member Functions

void calculateNotePosition ()

Private Attributes

unsigned char _midiPitch
int _pitch
int _accs
CAStemDirection _stemDirection
int _notePosition
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-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.


Member Enumeration Documentation

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

Definition at line 19 of file note.h.


Constructor & Destructor Documentation

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.

See also:
CAPlayableLength, CAPlayable, CAVoice, _pitch, _accs

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

Here is the call graph for this function:

Here is the caller graph for this function:

CANote::~CANote (  )  [virtual]

Definition at line 48 of file note.cpp.

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

Here is the call graph for this function:


Member Function Documentation

CANote * CANote::clone ( CAVoice voice  )  [virtual]

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

Here is the call graph for this function:

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

Here is the call graph for this function:

CAPlayableLength CANote::noteLength (  )  [inline]

Definition at line 32 of file note.h.

References CAPlayable::_playableLength.

CANote::pitch (  )  [inline]

Returns the note pitch in internal Canorus units.

See also:
_pitch, setPitch()

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

Here is the caller graph for this function:

CANote::setPitch ( int  pitch  ) 

Sets the note pitch to pitch.

See also:
_pitch
Sets the note pitch to pitch.

See also:
_pitch, pitch()

Definition at line 140 of file note.cpp.

References _accs, _midiPitch, _pitch, calculateNotePosition(), pitchToMidiPitch(), and updateTies().

Referenced by CAMainWin::scoreViewPortKeyPress().

Here is the call graph for this function:

CANote::accidentals (  )  [inline]

Returns number and type of accidentals of the note.

See also:
_accs, setAccidentals()

Definition at line 37 of file note.h.

References _accs.

Referenced by CALilyPondExport::exportVoiceImpl(), CACanorusMLExport::exportVoiceImpl(), and CALilyPondExport::relativePitchToString().

Here is the caller graph for this function:

CANote::setAccidentals ( int  accs  ) 

Keeps _midPitch proper when the Accidentals are modified

Sets a number and type of accidentals to accs of the note.

See also:
_accs, accidentals()

Definition at line 233 of file note.cpp.

References _accs, _midiPitch, _pitch, and pitchToMidiPitch().

Here is the call graph for this function:

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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

int CANote::notePosition (  )  [inline]

Definition at line 43 of file note.h.

References _notePosition.

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

Here is the caller graph for this function:

void CANote::setNotePosition ( int  notePosition  )  [inline]

Definition at line 44 of file note.h.

References _notePosition.

unsigned char CANote::midiPitch (  )  [inline]

Definition at line 46 of file note.h.

References _midiPitch.

Referenced by compare(), and CAPlayback::run().

Here is the caller graph for this function:

void CANote::setMidiPitch ( unsigned char  pitch  )  [inline]

Definition at line 47 of file note.h.

References _midiPitch.

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

Here is the caller graph for this function:

CASlur* CANote::tieEnd (  )  [inline]

Definition at line 50 of file note.h.

References _tieEnd.

Referenced by CAPlayback::run(), updateTies(), and ~CANote().

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool CANote::forceAccidentals (  )  [inline]

Definition at line 73 of file note.h.

References _forceAccidentals.

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

Definition at line 74 of file note.h.

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

Definition at line 114 of file note.cpp.

References CAMusElement::name().

Referenced by CAMainWin::scoreViewPortMouseMove().

Here is the call graph for this function:

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

Definition at line 301 of file note.cpp.

References StemDown, StemNeutral, StemPreferred, and StemUp.

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

Here is the caller graph for this function:

CANote::CAStemDirection CANote::stemDirectionFromString ( const   QString  )  [static]

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

See also:
CAStemDirection, CACanorusML

Definition at line 322 of file note.cpp.

References StemDown, StemNeutral, StemPreferred, and StemUp.

Referenced by CACanorusMLImport::startElement().

Here is the caller graph for this function:

int CANote::pitchToMidiPitch ( int  pitch,
int  acc 
) [static]

Converts the given internal Canorus pitch with accidentals acc to standard unsigned 7-bit MIDI pitch.

See also:
_pitch, midiPitchToPitch()

Definition at line 344 of file note.cpp.

Referenced by CANote(), setAccidentals(), and setPitch().

Here is the caller graph for this function:

int CANote::midiPitchToPitch ( int  midiPitch  )  [static]

Converts the given standard unsigned 7-bit MIDI pitch to internal Canorus pitch.

Todo:
This method currently doesn't do anything. Problem is determination of sharp/flat from MIDI. -Matevz
See also:
_pitch, pitchToMidiPitch()

Definition at line 359 of file note.cpp.

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

Here is the call graph for this function:

void CANote::calculateNotePosition (  )  [private]

Dependent on the current clef calculates and stores internally the vertical note position in the staff.

See also:
_notePosition, notePosition()

Definition at line 101 of file note.cpp.

References _notePosition, _pitch, CAClef::c1(), CAVoice::getClef(), and CAPlayable::voice().

Referenced by CANote(), and setPitch().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

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.

See also:
pitch(), setPitch(), midiPitchToPitch(), pitchToMidiPitch(), pitchToString(), generateNoteName()

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:

See also:
accidentals(), setAccidentals()

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.

See also:
CAStemDirection

Definition at line 92 of file note.h.

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

CANote::_notePosition [private]

Note location in the staff:

See also:
calculateNotePosition()

Definition at line 93 of file note.h.

Referenced by calculateNotePosition(), notePosition(), and setNotePosition().

CANote::_forceAccidentals [private]

Always draw notes accidentals.

See also:
_accs

Definition at line 94 of file note.h.

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

CASlur* CANote::_tieStart [private]

Definition at line 99 of file note.h.

Referenced by setTieStart(), and tieStart().

CASlur* CANote::_tieEnd [private]

Definition at line 100 of file note.h.

Referenced by setTieEnd(), and tieEnd().

CASlur* CANote::_slurStart [private]

Definition at line 101 of file note.h.

Referenced by setSlurStart(), and slurStart().

CASlur* CANote::_slurEnd [private]

Definition at line 102 of file note.h.

Referenced by setSlurEnd(), and slurEnd().

CASlur* CANote::_phrasingSlurStart [private]

Definition at line 103 of file note.h.

Referenced by phrasingSlurStart(), and setPhrasingSlurStart().

CASlur* CANote::_phrasingSlurEnd [private]

Definition at line 104 of file note.h.

Referenced by phrasingSlurEnd(), and setPhrasingSlurEnd().


The documentation for this class was generated from the following files:
Generated on Sat Feb 9 13:19:06 2008 for Canorus by  doxygen 1.5.3