|
Canorus 0.0
|
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< CAPlayableLength > | timeLengthToPlayableLengthList (int timeLength, bool longNotesFirst=true, int dotsLimit=4) |
| static QList< CAPlayableLength > | matchToBars (CAPlayableLength len, int timeStart, CABarline *lastBarline, CATimeSignature *ts, int dotsLimit=4) |
| static QList< CAPlayableLength > | matchToBars (int timeLength, int timeStart, CABarline *lastBarline, CATimeSignature *ts, int dotsLimit=4, int separiationTime=0) |
Private Attributes | |
| CAMusicLength | _musicLength |
| int | _dotted |
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.
| CAPlayableLength::CAPlayableLength | ( | ) |
References setDotted(), setMusicLength(), and Undefined.
Referenced by matchToBars(), musicLengthToTimeLength(), and timeLengthToPlayableLengthList().


| CAPlayableLength::CAPlayableLength | ( | CAMusicLength | l, |
| int | dotted = 0 |
||
| ) |
|
inline |
References _dotted.
Referenced by CAMusElementFactory::addPlayableDotted(), CADrawableNote::CADrawableNote(), CADrawableRest::CADrawableRest(), CAPlayableLength(), CADrawableNote::draw(), CADrawableRest::draw(), CACanorusMLExport::exportPlayableLength(), operator==(), CALilyPondImport::playableLengthFromLilyPond(), CALilyPondExport::playableLengthToLilyPond(), playableLengthToTimeLength(), CAMainWin::scoreViewKeyPress(), and CAMainWin::updateTempoToolBar().

|
static |
Split a playable to match a given bar border and bar length. This function is used at music input with a midi keyboard.
References CATimeSignature::beat(), CATimeSignature::beats(), CAPlayableLength(), playableLengthToTimeLength(), timeLengthToPlayableLengthList(), and CAMusElement::timeStart().
Referenced by CAKeybdInput::midiInEventToScore(), and CAMidiImport::writeMidiChannelEventsToVoice_New().


|
static |
Split a playable length to match a virtual or real next barline by recognising a given previous barline and bar length by a given time signature. In lack of barline or timesignature asumptions are made, maybe resulting in returning an empty split list.
separationTime is an additional splitting point, meant to do there key signature changes.
This function is used in midi import, could be used at mouse note input too, probably. See also matchToBars with CAPlayableLength as parameter, which is used at midi keyboard input. This functions probably could be merged.
References CATimeSignature::beat(), CATimeSignature::beats(), CAPlayableLength(), playableLengthToTimeLength(), Quarter, timeLengthToPlayableLengthList(), and CAMusElement::timeStart().

|
inline |
References _musicLength.
Referenced by CAMusElementFactory::addPlayableDotted(), CADrawableNote::CADrawableNote(), CADrawableRest::CADrawableRest(), CALilyPondExport::doAnacrusisCheck(), CAMusicXmlExport::exportNote(), CACanorusMLExport::exportPlayableLength(), CALilyPondImport::importVoiceImpl(), operator==(), CALilyPondExport::playableLengthToLilyPond(), playableLengthToTimeLength(), CAMusicXmlImport::readNote(), CAMainWin::updatePlayableToolBar(), and CAMainWin::updateTempoToolBar().

|
static |
References Breve, Eighth, Half, HundredTwentyEighth, Quarter, Sixteenth, SixtyFourth, ThirtySecond, Undefined, and Whole.
Referenced by CACanorusMLImport::importMark(), and CACanorusMLImport::startElement().

|
static |
References Breve, Eighth, Half, HundredTwentyEighth, Quarter, Sixteenth, SixtyFourth, ThirtySecond, Undefined, and Whole.
Referenced by CACanorusMLExport::exportPlayableLength().

|
inlinestatic |
References CAPlayableLength(), and playableLengthToTimeLength().
Referenced by CATimeSignature::barDuration(), CAMainWin::scoreViewMouseMove(), and timeLengthToPlayableLengthList().


| bool CAPlayableLength::operator!= | ( | CAPlayableLength | l | ) |
Compares two playable lengths.
| bool CAPlayableLength::operator== | ( | CAPlayableLength | l | ) |
Compares two playable lengths.
References dotted(), and musicLength().

|
static |
Converts internal enum playableLength to actual timeLength.
References Breve, dotted(), Eighth, Half, HundredTwentyEighth, musicLength(), Quarter, Sixteenth, SixtyFourth, ThirtySecond, and Whole.
Referenced by CATuplet::assignTimes(), CAPlayable::calculateTimeLength(), CAMainWin::deleteSelection(), CALilyPondExport::doAnacrusisCheck(), CAMusicXmlExport::exportMeasure(), CAMidiImport::importMidiEvents(), CAMainWin::insertMusElementAt(), matchToBars(), musicLengthToTimeLength(), CAMainWin::on_uiPlayableLength_toggled(), timeLengthToPlayableLengthList(), CAPlayback::updateSleepFactor(), CAMidiExport::writeFile(), and CAMidiImport::writeMidiChannelEventsToVoice_New().


|
inline |
References _dotted.
Referenced by CAMusElementFactory::addPlayableDotted(), CAPlayableLength(), CALilyPondImport::playableLengthFromLilyPond(), and CAMainWin::scoreViewKeyPress().

|
inline |
References _musicLength.
Referenced by CAPlayableLength(), and CALilyPondImport::playableLengthFromLilyPond().

|
static |
Compute for a given time length the CAPlayableLengths. In the general case this could result in several notes. In the canorus GUI we 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(), and CAMusicXmlImport::readNote().


|
private |
Referenced by dotted(), and setDotted().
|
private |
Referenced by musicLength(), and setMusicLength().