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

Class used for tuplets (triplets, duols etc.) More...

#include <tuplet.h>

Inheritance diagram for CATuplet:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CATuplet (int number, int actualNumber, QList< CAPlayable * > noteList)
 CATuplet (int number, int actualNumber)
virtual ~CATuplet ()
CATupletclone (CAContext *context=0)
CATupletclone (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)
CAPlayablefirstNote ()
CAPlayablelastNote ()
bool containsNote (CAPlayable *p)
CAPlayablenextTimed (CAPlayable *p)
int timeLength ()
int timeStart ()
void assignTimes ()

Private Member Functions

void resetTimes ()

Private Attributes

int _number
int _actualNumber
QList< CAPlayable * > _noteList

Detailed Description

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

Constructor & Destructor Documentation

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

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

CATuplet::~CATuplet ( ) [virtual]

References resetTimes().

Here is the call graph for this function:


Member Function Documentation

int CATuplet::actualNumber ( ) [inline]

Adds a note to the tuplet.

References CAMusElement::Note, noteList(), and CAMusElement::timeStart().

Referenced by CAMainWin::deleteSelection(), CAVoice::insertInTupletAndVoiceAt(), and CACanorusMLImport::startElement().

Here is the call graph for this function:

Here is the caller graph for this function:

void CATuplet::addNotes ( QList< CAPlayable * >  l) [inline]

References noteList().

Here is the call graph for this function:

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.

See also:
resetTimes()

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

CATuplet * CATuplet::clone ( QList< CAPlayable * >  newList)

References actualNumber(), CATuplet(), and number().

Here is the call graph for this function:

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.

Here is the call graph for this function:

bool CATuplet::containsNote ( CAPlayable p) [inline]

References noteList().

Here is the call graph for this function:

References noteList().

Referenced by assignTimes(), CAPlayable::isFirstInTuplet(), and CAKeybdInput::midiInEventToScore().

Here is the call graph for this function:

Here is the caller graph for this function:

References noteList().

Referenced by CAPlayable::isLastInTuplet().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

QList<CAPlayable*>& CATuplet::noteList ( ) [inline]
int CATuplet::number ( ) [inline]
void CATuplet::removeNote ( CAPlayable p) [inline]

References noteList().

Referenced by CAMainWin::deleteSelection(), CAVoice::insertInTupletAndVoiceAt(), and CAPlayable::~CAPlayable().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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.

See also:
_timeLength, setTimeLength(), timeEnd()

Reimplemented from CAMusElement.

References noteList(), CAMusElement::timeEnd(), and timeStart().

Here is the call graph for this function:

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.

See also:
_timeStart, setTimeStart()

Reimplemented from CAMusElement.

References noteList().

Referenced by assignTimes(), and timeLength().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

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


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