|
Canorus
0.7
|
Class used for tuplets (triplets, duols etc.) More...
#include <tuplet.h>

Public Member Functions | |
| CATuplet (int number, int actualNumber, QList< CAPlayable * > noteList) | |
| CATuplet (int number, int actualNumber) | |
| virtual | ~CATuplet () |
| CATuplet * | clone (CAContext *context=0) |
| CATuplet * | clone (QList< CAPlayable * > newList) |
| int | compare (CAMusElement *) |
| int | number () |
| void | setNumber (int n) |
| int | actualNumber () |
| void | setActualNumber (int n) |
| QList< CAPlayable * > & | noteList () |
| void | addNote (CAPlayable *p) |
| void | addNotes (QList< CAPlayable * > l) |
| void | removeNote (CAPlayable *p) |
| CAPlayable * | firstNote () |
| CAPlayable * | lastNote () |
| bool | containsNote (CAPlayable *p) |
| CAPlayable * | nextTimed (CAPlayable *p) |
| int | timeLength () |
| int | timeStart () |
| void | assignTimes () |
Private Member Functions | |
| void | resetTimes () |
Private Attributes | |
| int | _number |
| int | _actualNumber |
| QList< CAPlayable * > | _noteList |
Class used for tuplets (triplets, duols etc.)
Copyright (c) 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.
Tuplets are a rhythmic specialty. They are used to shorten the set of
notes for a specified multiplier.
Most used tuplets are triplets (multiplier 2/3) and duols (multiplier 3/4).| CATuplet::CATuplet | ( | int | number, |
| int | actualNumber, | ||
| QList< CAPlayable * > | noteList | ||
| ) |
Constructs a tuplet.
number is the existing number of notes and actualNumber is the desired length of the notes expressed in number of them. These parameters are used to calculate the multiplier of the notes. eg. number=3, actualNumber=2 multiplies all notes by a factor of 2/3.
noteList is a sorted list of rests and notes under the tuplet. Elements should already be part of the voice.
References assignTimes(), CAMusElement::setMusElementType(), and CAMusElement::Tuplet.
Referenced by clone().


| CATuplet::CATuplet | ( | int | number, |
| int | actualNumber | ||
| ) |
Constructs an empty tuplet.
Add notes and rests under it manually by calling addNote(). Call assignTimes() to apply the actual times then.
References CAMusElement::setMusElementType(), and CAMusElement::Tuplet.

| CATuplet::~CATuplet | ( | ) | [virtual] |
| int CATuplet::actualNumber | ( | ) | [inline] |
References _actualNumber.
Referenced by assignTimes(), clone(), CAStaff::clone(), compare(), CALilyPondExport::exportPlayable(), CACanorusMLExport::exportVoiceImpl(), and CAMainWin::insertMusElementAt().

| void CATuplet::addNote | ( | CAPlayable * | p | ) |
Adds a note to the tuplet.
References CAMusElement::Note, noteList(), and CAMusElement::timeStart().
Referenced by CAMainWin::deleteSelection(), CAVoice::insertInTupletAndVoiceAt(), and CACanorusMLImport::startElement().


| void CATuplet::addNotes | ( | QList< CAPlayable * > | l | ) | [inline] |
| void CATuplet::assignTimes | ( | ) |
Transforms note times to tuplet-affected times.
The use case should be somewhat this: 1) Place ordinary notes and rests. 2) Create a tuplet containing them. This calls assignTimes() automatically to transform music elements times.
This function requires elements to be part of the voice.
References actualNumber(), CAMusElement::context(), firstNote(), CAVoice::insert(), CAMusElement::musElementType(), CAVoice::next(), CAMusElement::Note, noteList(), number(), CAPlayableLength::playableLengthToTimeLength(), CAVoice::remove(), resetTimes(), CAMusElement::setContext(), CAMusElement::setTimeLength(), CAMusElement::timeEnd(), and timeStart().
Referenced by CATuplet(), CAMainWin::deleteSelection(), CACanorusMLImport::endElement(), and CAVoice::insertInTupletAndVoiceAt().


| CATuplet * CATuplet::clone | ( | CAContext * | context = 0 | ) | [virtual] |
Clones a music element with exact properties including the context.
Implements CAMusElement.
References actualNumber(), CATuplet(), noteList(), and number().
Referenced by CAMainWin::copySelection(), and CAMainWin::pasteAt().


| CATuplet * CATuplet::clone | ( | QList< CAPlayable * > | newList | ) |
| int CATuplet::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 actualNumber(), CAMusElement::musElementType(), number(), and CAMusElement::Tuplet.

| bool CATuplet::containsNote | ( | CAPlayable * | p | ) | [inline] |
| CAPlayable* CATuplet::firstNote | ( | ) | [inline] |
References noteList().
Referenced by assignTimes(), CAPlayable::isFirstInTuplet(), and CAKeybdInput::midiInEventToScore().


| CAPlayable* CATuplet::lastNote | ( | ) | [inline] |
References noteList().
Referenced by CAPlayable::isLastInTuplet().


| CAPlayable * CATuplet::nextTimed | ( | CAPlayable * | p | ) |
Returns a pointer to the next member of tuplet with a greater timeStart. If it doesn't exist it returns 0.
References noteList(), and CAMusElement::timeStart().
Referenced by CAKeybdInput::midiInEventToScore().


| QList<CAPlayable*>& CATuplet::noteList | ( | ) | [inline] |
References _noteList.
Referenced by addNote(), addNotes(), assignTimes(), clone(), containsNote(), CAMainWin::copySelection(), firstNote(), CAMainWin::insertMusElementAt(), lastNote(), nextTimed(), CAMainWin::pasteAt(), removeNote(), resetTimes(), timeLength(), and timeStart().

| int CATuplet::number | ( | ) | [inline] |
References _number.
Referenced by assignTimes(), clone(), CAStaff::clone(), compare(), CALilyPondExport::exportPlayable(), CACanorusMLExport::exportVoiceImpl(), and CAMainWin::insertMusElementAt().

| void CATuplet::removeNote | ( | CAPlayable * | p | ) | [inline] |
References noteList().
Referenced by CAMainWin::deleteSelection(), CAVoice::insertInTupletAndVoiceAt(), and CAPlayable::~CAPlayable().


| void CATuplet::resetTimes | ( | ) | [private] |
Resets the notes times back to their original values before placing the tuplet.
This is usually called from the destructor of the tuplet.
References CAVoice::insert(), CAMusElement::musElementType(), CAVoice::next(), CAMusElement::Note, noteList(), and CAVoice::remove().
Referenced by assignTimes(), and ~CATuplet().


| void CATuplet::setActualNumber | ( | int | n | ) | [inline] |
References _actualNumber.
| void CATuplet::setNumber | ( | int | n | ) | [inline] |
References _number.
| int CATuplet::timeLength | ( | ) | [virtual] |
Returns the time how long the music element lasts in the score. The returned time is in absolute time units.
Reimplemented from CAMusElement.
References noteList(), CAMusElement::timeEnd(), and timeStart().

| int CATuplet::timeStart | ( | ) | [virtual] |
Returns the time in the score when the music element appears in time. The returned time is in absolute time units.
Reimplemented from CAMusElement.
References noteList().
Referenced by assignTimes(), and timeLength().


int CATuplet::_actualNumber [private] |
Referenced by actualNumber(), and setActualNumber().
QList<CAPlayable*> CATuplet::_noteList [private] |
Referenced by noteList().
int CATuplet::_number [private] |
Referenced by number(), and setNumber().
1.8.0