Canorus 0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CATuplet Class Reference

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

#include <tuplet.h>

Inheritance diagram for CATuplet:
Inheritance graph
[legend]

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)
 
const 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 ()
 
- Public Member Functions inherited from CAMusElement
 CAMusElement (CAContext *context, int timeStart, int timeLength=0)
 
virtual ~CAMusElement ()
 
virtual CAMusElementclone (CAContext *context=0)=0
 
virtual int compare (CAMusElement *elt)=0
 
CAMusElementType musElementType ()
 
CAContextcontext ()
 
void setContext (CAContext *context)
 
virtual int timeStart () const
 
void setTimeStart (int time)
 
virtual int timeLength () const
 
void setTimeLength (int length)
 
int timeEnd ()
 
virtual int realTimeStart ()
 
virtual int realTimeLength ()
 
int realTimeEnd ()
 
const QString name ()
 
void setName (const QString name)
 
const bool isVisible ()
 
void setVisible (const bool v)
 
const QColor color ()
 
void setColor (const QColor c)
 
const QList< CAMark * > markList ()
 
void addMark (CAMark *mark)
 
void addMarks (QList< CAMark * > marks)
 
void removeMark (CAMark *mark)
 
const QList< CANoteCheckerError * > & noteCheckerErrorList ()
 
void addNoteCheckerError (CANoteCheckerError *nce)
 
void removeNoteCheckerError (CANoteCheckerError *nce)
 
bool isPlayable ()
 

Private Member Functions

void resetTimes ()
 
QList< QList< CASlur * > > getNoteSlurs ()
 
void assignNoteSlurs (QList< QList< CASlur * > >)
 

Private Attributes

int _number
 
int _actualNumber
 
QList< CAPlayable * > _noteList
 

Additional Inherited Members

- Public Types inherited from CAMusElement
enum  CAMusElementType {
  Undefined = 0 , Note , Rest , MidiNote ,
  Barline , Clef , TimeSignature , KeySignature ,
  Slur , Tuplet , Syllable , FunctionMark ,
  FiguredBassMark , Mark
}
 
- Static Public Member Functions inherited from CAMusElement
static const QString musElementTypeToString (CAMusElementType)
 
static CAMusElementType musElementTypeFromString (const QString)
 
- Protected Member Functions inherited from CAMusElement
void setMusElementType (CAMusElementType type)
 
- Protected Attributes inherited from CAMusElement
CAMusElementType _musElementType
 
QList< CAMark * > _markList
 
QList< CANoteCheckerError * > _noteCheckerErrorList
 
CAContext_context
 
int _timeStart
 
int _timeLength
 
bool _visible
 
QColor _color
 
QString _name
 

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() [1/2]

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

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::~CATuplet ( )
virtual

References resetTimes().

Here is the call graph for this function:

Member Function Documentation

◆ actualNumber()

int CATuplet::actualNumber ( )
inline

◆ addNote()

void CATuplet::addNote ( CAPlayable p)

Adds a note to the tuplet.

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

◆ addNotes()

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

References _noteList.

◆ assignNoteSlurs()

void CATuplet::assignNoteSlurs ( QList< QList< CASlur * > >  noteSlurs)
private

Assigns the given list of slurs per note index.

This function is usually called in combination with getNoteSlurs() when managing note timeStarts and notes are removed/readded to voices.

See also
getNoteSlurs()

References noteList(), CAMusElement::setTimeLength(), CAMusElement::setTimeStart(), and CAMusElement::timeEnd().

Referenced by assignTimes(), and resetTimes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assignTimes()

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.

See also
resetTimes()

References actualNumber(), assignNoteSlurs(), CAMusElement::context(), firstNote(), getNoteSlurs(), 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:

◆ clone() [1/2]

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:

◆ clone() [2/2]

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

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

Here is the call graph for this function:

◆ compare()

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:

◆ containsNote()

bool CATuplet::containsNote ( CAPlayable p)
inline

References noteList().

Here is the call graph for this function:

◆ firstNote()

CAPlayable * CATuplet::firstNote ( )

Returns the first note/rest in the first chord of the tuplet.

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

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNoteSlurs()

QList< QList< CASlur * > > CATuplet::getNoteSlurs ( )
private

Generates a list of pointers to slurs (slur start, slur end, phrasing slur start, phrasing slur end) per each note index.

If tuplet contains a rest, no slurs are present at that index.

See also
assignNoteSlurs()

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

Referenced by assignTimes(), and resetTimes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lastNote()

CAPlayable * CATuplet::lastNote ( )

Returns the last note/rest in the last chord of the tuplet.

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

Referenced by CAPlayable::isLastInTuplet(), and CALayoutEngine::reposit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nextTimed()

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ noteList()

const QList< CAPlayable * > & CATuplet::noteList ( )
inline

◆ number()

int CATuplet::number ( )
inline

◆ removeNote()

void CATuplet::removeNote ( CAPlayable p)
inline

References _noteList.

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

Here is the caller graph for this function:

◆ resetTimes()

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 assignNoteSlurs(), getNoteSlurs(), 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:

◆ setActualNumber()

void CATuplet::setActualNumber ( int  n)
inline

References _actualNumber.

◆ setNumber()

void CATuplet::setNumber ( int  n)
inline

References _number.

◆ timeLength()

int CATuplet::timeLength ( )

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

Here is the call graph for this function:

◆ timeStart()

int CATuplet::timeStart ( )

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

◆ _actualNumber

int CATuplet::_actualNumber
private

Referenced by actualNumber(), and setActualNumber().

◆ _noteList

QList<CAPlayable*> CATuplet::_noteList
private

◆ _number

int CATuplet::_number
private

Referenced by number(), and setNumber().


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