Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CAPlayableLength Class Reference

Musical length of notes and rests. More...

#include <playablelength.h>

Public Types

enum  CAMusicLength {
  Undefined = -1, Breve = 0, Whole = 1, Half = 2,
  Quarter = 4, Eighth = 8, Sixteenth = 16, ThirtySecond = 32,
  SixtyFourth = 64, HundredTwentyEighth = 128
}
 

Public Member Functions

 CAPlayableLength ()
 
 CAPlayableLength (CAMusicLength l, int dotted=0)
 
const CAMusicLength musicLength ()
 
const int dotted ()
 
void setMusicLength (const CAMusicLength l)
 
void setDotted (const int d)
 
bool operator== (CAPlayableLength)
 
bool operator!= (CAPlayableLength)
 

Static Public Member Functions

static const QString musicLengthToString (CAMusicLength length)
 
static CAMusicLength musicLengthFromString (const QString length)
 
static const int playableLengthToTimeLength (CAPlayableLength length)
 
static const int musicLengthToTimeLength (CAMusicLength l)
 
static QList< CAPlayableLengthtimeLengthToPlayableLengthList (int timeLength, bool longNotesFirst=true, int dotsLimit=4)
 
static QList< CAPlayableLengthmatchToBars (CAPlayableLength len, int timeStart, CABarline *lastBarline, CATimeSignature *ts, int dotsLimit=4)
 

Private Attributes

CAMusicLength _musicLength
 
int _dotted
 

Detailed Description

Musical length of notes and rests.

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.

This class represents a musical length (quarter, half, whole etc.) of notes and rests with number of dots.

It consists of two properties:

Playable length can be easily converted to timeLength. Vice-versa is a bit more difficult.

See Also
playableLengthToTimeLength(), CARest::composeRests()

Member Enumeration Documentation

Enumerator
Undefined 
Breve 
Whole 
Half 
Quarter 
Eighth 
Sixteenth 
ThirtySecond 
SixtyFourth 
HundredTwentyEighth 

Constructor & Destructor Documentation

CAPlayableLength::CAPlayableLength ( )

References setDotted(), setMusicLength(), and Undefined.

Referenced by matchToBars(), musicLengthToTimeLength(), and timeLengthToPlayableLengthList().

Here is the call graph for this function:

Here is the caller graph for this function:

CAPlayableLength::CAPlayableLength ( CAMusicLength  l,
int  dotted = 0 
)

References setDotted(), and setMusicLength().

Here is the call graph for this function:

Member Function Documentation

const int CAPlayableLength::dotted ( )
inline
QList< CAPlayableLength > CAPlayableLength::matchToBars ( CAPlayableLength  len,
int  timeStart,
CABarline lastBarline,
CATimeSignature ts,
int  dotsLimit = 4 
)
static

Split a playable to match a given bar border and bar length.

References CATimeSignature::beat(), CATimeSignature::beats(), CAPlayableLength(), playableLengthToTimeLength(), timeLengthToPlayableLengthList(), and CAMusElement::timeStart().

Referenced by CAKeybdInput::midiInEventToScore().

Here is the call graph for this function:

Here is the caller graph for this function:

const CAMusicLength CAPlayableLength::musicLength ( )
inline
CAPlayableLength::CAMusicLength CAPlayableLength::musicLengthFromString ( const QString  length)
static

References Breve, Eighth, Half, HundredTwentyEighth, Quarter, Sixteenth, SixtyFourth, ThirtySecond, Undefined, and Whole.

Referenced by CACanorusMLImport::importMark(), and CACanorusMLImport::startElement().

Here is the caller graph for this function:

const QString CAPlayableLength::musicLengthToString ( CAPlayableLength::CAMusicLength  length)
static

References Breve, Eighth, Half, HundredTwentyEighth, Quarter, Sixteenth, SixtyFourth, ThirtySecond, Undefined, and Whole.

Referenced by CACanorusMLExport::exportPlayableLength().

Here is the caller graph for this function:

static const int CAPlayableLength::musicLengthToTimeLength ( CAMusicLength  l)
inlinestatic

References CAPlayableLength(), and playableLengthToTimeLength().

Referenced by CAMainWin::scoreViewPortMouseMove(), and timeLengthToPlayableLengthList().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CAPlayableLength::operator!= ( CAPlayableLength  l)

Compares two playable lengths.

bool CAPlayableLength::operator== ( CAPlayableLength  l)

Compares two playable lengths.

References dotted(), and musicLength().

Here is the call graph for this function:

const int CAPlayableLength::playableLengthToTimeLength ( CAPlayableLength  length)
static
void CAPlayableLength::setDotted ( const int  d)
inline
void CAPlayableLength::setMusicLength ( const CAMusicLength  l)
inline

References _musicLength.

Referenced by CAPlayableLength(), CALilyPondImport::playableLengthFromLilyPond(), and CAMidiImport::playableLengthFromLilyPond().

Here is the caller graph for this function:

QList< CAPlayableLength > CAPlayableLength::timeLengthToPlayableLengthList ( int  t,
bool  longNotesFirst = true,
int  dotsLimit = 4 
)
static

Compute for a given time length the CAPlayableLengths. In the general case this could result in several notes. In the canorus GUI we have can have max. 4 dots. By default longer notes appear first in the list, but with negating longNotesFirst the short ones appear first. This is useful for end of bar notes.

To make this computation fast we take in account that note durations are a binary presentation of the time duration. The breve value is not exactly a log2 value, so we do this singular nonlinear operation through the method of computation (see **).

Limitations: Maximum four dots per note, and the smallest resulting time duration is SixtyFourth;

Todo: Allow change of limitations as function parameters, which are longest note and number of dots.

References Breve, CAPlayableLength(), HundredTwentyEighth, musicLengthToTimeLength(), and playableLengthToTimeLength().

Referenced by matchToBars(), CAMusicXmlImport::readNote(), and CAMidiImport::writeMidiChannelEventsToVoice().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

int CAPlayableLength::_dotted
private

Referenced by dotted(), and setDotted().

CAMusicLength CAPlayableLength::_musicLength
private

Referenced by musicLength(), and setMusicLength().


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