|
Canorus 0.0
|
LilyPond export filter This class is used to export the document or parts of the document to LilyPond syntax. The most common use is to simply call one of the constructors. More...
#include <lilypondexport.h>

Private Attributes | |
| QTextStream * | _out |
| CAVoice * | _curVoice |
| CASheet * | _curSheet |
| CAContext * | _curContext |
| CADocument * | _curDocument |
| int | _curContextIndex |
| int | _curIndentLevel |
| CADiatonicPitch | _lastNotePitch |
| CAPlayableLength | _lastPlayableLength |
| int | _curStreamTime |
| bool | _voltaFunctionWritten |
| bool | _voltaBracketFinishAtRepeat |
| bool | _voltaBracketFinishAtBar |
| bool | _timeSignatureFound |
Static Private Attributes | |
| static const QString | _regExpVoltaRepeat = QString("voltaRepeat (.*)") |
| static const QString | _regExpVoltaBar = QString("voltaBar (.*)") |
Additional Inherited Members | |
Signals inherited from CAExport | |
| void | documentExported (CADocument *) |
| void | sheetExported (CASheet *) |
| void | staffExported (CAStaff *) |
| void | voiceExported (CAVoice *) |
| void | lyricsContextExported (CALyricsContext *) |
| void | functionMarkContextExported (CAFunctionMarkContext *) |
| void | exportDone (int status) |
Protected Member Functions inherited from CAExport | |
| virtual void | exportDocumentImpl (CADocument *) |
| virtual void | exportSheetImpl (CASheet *) |
| virtual void | exportStaffImpl (CAStaff *) |
| virtual void | exportVoiceImpl (CAVoice *) |
| virtual void | exportLyricsContextImpl (CALyricsContext *) |
| virtual void | exportFunctionMarkContextImpl (CAFunctionMarkContext *) |
| QTextStream & | out () |
| void | run () |
Protected Member Functions inherited from CAFile | |
| void | setStatus (const int status) |
| void | setProgress (const int progress) |
| QTextStream * | stream () |
| virtual void | setStream (QTextStream *stream) |
| QFile * | file () |
| void | setFile (QFile *file) |
LilyPond export filter This class is used to export the document or parts of the document to LilyPond syntax. The most common use is to simply call one of the constructors.
Copyright (c) 2007-2010, 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.
Copyright (c) 2007-2010, 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.
textStream is usually the file stream or the content of the score source view widget.
| CALilyPondExport::CALilyPondExport | ( | QTextStream * | out = 0 | ) |
Constructor for the lilypond export. Called when viewing a single voice source in Lily syntax or exporting the whole document to a file.
Uses out for the output.
References _timeSignatureFound, _voltaBracketFinishAtBar, _voltaBracketFinishAtRepeat, _voltaFunctionWritten, setCurDocument(), and setIndentLevel().

|
private |
Converts the barline type to LilyPond syntax.
References CABarline::Dotted, CABarline::Double, CABarline::End, CABarline::RepeatClose, CABarline::RepeatCloseOpen, CABarline::RepeatOpen, CABarline::Single, and CABarline::Undefined.
Referenced by exportVoiceImpl().

|
private |
Converts the given clefType to LilyPond syntax.
References CAClef::C, CAClef::F, CAClef::G, CAClef::PercussionHigh, CAClef::PercussionLow, and CAClef::Tab.
Referenced by exportVoiceImpl().

|
inline |
References _curContext.
Referenced by exportScoreBlock().

|
inline |
References _curContextIndex.
Referenced by exportStaffVoices().

|
inline |
References _curDocument.
Referenced by writeDocumentHeader().

|
inline |
|
inline |
|
inline |
References _curVoice.
Referenced by doAnacrusisCheck(), exportStaffVoices(), and writeRelativeIntro().

|
private |
Returns the key signature gender major/minor in LilyPond syntax.
References CADiatonicKey::Major, and CADiatonicKey::Minor.
Referenced by exportVoiceImpl().

|
private |
Converts the note pitch to LilyPond syntax.
References CADiatonicPitch::accs(), and CADiatonicPitch::noteName().
Referenced by exportVoiceImpl(), and relativePitchToString().


|
private |
Writes the partial command before the first note if there is an upbeat.
References CAMusElement::Barline, CATimeSignature::beat(), CATimeSignature::beats(), curVoice(), CAPlayableLength::HundredTwentyEighth, CAVoice::musElementList(), CAPlayableLength::musicLength(), CAExport::out(), CAPlayableLength::playableLengthToTimeLength(), and CAPlayableLength::Quarter.
Referenced by exportVoiceImpl().


|
private |
Replaces characters like backslashes and double brackets with their escaped variant.
Referenced by exportScoreBlock(), and markupString().

|
private |
Exports the lyrics in form: SopranoLyricsOne = { My bu – ny is o – ver the o – cean __ My bu – ny. }
References exportLyricsContextImpl(), indent(), indentLess(), indentMore(), CAContext::name(), CAExport::out(), and spellNumbers().
Referenced by exportSheetImpl().


|
privatevirtual |
Exports the syllables only without the SopranoLyircsOne = {} frame.
Reimplemented from CAExport.
References CAExport::out(), CALyricsContext::syllableList(), and syllableToLilyPond().
Referenced by exportLyricsContextBlock().


|
private |
Exports the marks for the given elt chord, rest or non-playable music element.
For exporting note-specific marks (eg. fingering), see exportNoteMarks().
References _regExpVoltaBar, _regExpVoltaRepeat, CAArticulation::Accent, CAMark::Articulation, CAMark::BookMark, CAArticulation::Breath, CAMark::Crescendo, CADynamic::Custom, CAArticulation::DownBow, CAArticulation::DownMordent, CAArticulation::DownPrall, CAMark::Dynamic, CADynamic::dynamicTextFromString(), CAArticulation::Espressivo, CAMark::Fermata, CAMark::Fingering, CAArticulation::Flageolet, CAMark::InstrumentChange, CAArticulation::LinePrall, CAArticulation::Marcato, CAMusElement::markList(), CAMark::markType(), CAArticulation::Mordent, CAArticulation::Open, CAExport::out(), CAMark::Pedal, CAArticulation::Portato, CAArticulation::Prall, CAArticulation::PrallDown, CAArticulation::PrallMordent, CAArticulation::PrallPrall, CAArticulation::PrallUp, CAMark::RehersalMark, CAMark::RepeatMark, CAArticulation::ReverseTurn, CAMark::Ritardando, CARitardando::Ritardando, CARitardando::ritardandoType(), CAArticulation::Staccatissimo, CAArticulation::Staccato, CAArticulation::Stopped, CAMark::Tempo, CAArticulation::Tenuto, CADynamic::text(), CAMark::Text, CAArticulation::Trill, CAArticulation::Turn, CAArticulation::Undefined, CAMark::Undefined, CAArticulation::UpBow, CAArticulation::UpMordent, and CAArticulation::UpPrall.
Referenced by exportPlayable(), and exportVoiceImpl().


|
private |
Exports a volta bracket which is currently just a elt mark beginning with voltaBar or voltaRepeat.
References _regExpVoltaBar, _regExpVoltaRepeat, _voltaBracketFinishAtBar, _voltaBracketFinishAtRepeat, CAMark::Articulation, CATempo::beat(), CAMark::BookMark, CATempo::bpm(), CAMark::Crescendo, CAMark::Dynamic, CAMark::Fermata, CAMark::Fingering, CAMark::InstrumentChange, CAMusElement::markList(), CAMark::markType(), CAExport::out(), CAMark::Pedal, playableLengthToLilyPond(), CAMark::RehersalMark, CAMark::RepeatMark, CAMark::Ritardando, CAMark::Tempo, CAMark::Text, and CAMark::Undefined.
Referenced by exportVoiceImpl().


|
private |
Exports the note-specific marks like fingering.
References CAMark::Articulation, CAMark::BookMark, CAMark::Crescendo, CAMark::Dynamic, CAMark::Fermata, CAMark::Fingering, CAMark::InstrumentChange, CAMusElement::markList(), CAMark::markType(), CAExport::out(), CAMark::Pedal, CAMark::RehersalMark, CAMark::RepeatMark, CAMark::Ritardando, CAMark::Tempo, CAMark::Text, and CAMark::Undefined.
Referenced by exportPlayable().


|
private |
References _curStreamTime, _lastNotePitch, _lastPlayableLength, CATuplet::actualNumber(), CAMusElement::Barline, CAMusElement::Clef, CANote::diatonicPitch(), exportMarksAfterElement(), exportNoteMarks(), CAMusElement::FiguredBassMark, CANote::forceAccidentals(), CAMusElement::FunctionMark, CANote::getChord(), CANote::isFirstInChord(), CAPlayable::isFirstInTuplet(), CANote::isLastInChord(), CAPlayable::isLastInTuplet(), CANote::isPartOfChord(), CAMusElement::KeySignature, CAMusElement::Mark, CAMusElement::MidiNote, CAMusElement::musElementType(), CAMusElement::Note, CATuplet::number(), CAExport::out(), CANote::phrasingSlurEnd(), CANote::phrasingSlurStart(), CAPlayable::playableLength(), playableLengthToLilyPond(), relativePitchToString(), CAMusElement::Rest, CARest::restType(), restTypeToLilyPond(), CAMusElement::Slur, CANote::slurEnd(), CANote::slurStart(), CAMusElement::Syllable, CANote::tieStart(), CAMusElement::timeLength(), CAMusElement::TimeSignature, CAMusElement::timeStart(), CAMusElement::Tuplet, CAPlayable::tuplet(), and CAMusElement::Undefined.
Referenced by exportVoiceImpl().


|
private |
Exports the \score block for LilyPond from the current sheet. Looks like this:
References _timeSignatureFound, CALyricsContext::associatedVoice(), CASheet::contextList(), curContext(), curSheet(), escapeWeirdChars(), CAContext::FiguredBassContext, CAContext::FunctionMarkContext, indent(), indentLess(), indentMore(), CAContext::LyricsContext, CAContext::name(), CAExport::out(), setCurContext(), spellNumbers(), CAContext::Staff, CAVoice::staff(), CAStaff::voiceList(), and voiceVariableName().
Referenced by exportSheetImpl().


|
privatevirtual |
Exports the current sheet to Lilypond syntax.
Reimplemented from CAExport.
References CASheet::contextList(), CASheet::document(), exportLyricsContextBlock(), exportScoreBlock(), exportStaffVoices(), CAContext::FiguredBassContext, CAContext::FunctionMarkContext, CAContext::LyricsContext, CAExport::out(), scanForRepeats(), setCurContextIndex(), setCurDocument(), setCurSheet(), CAContext::Staff, and writeDocumentHeader().

|
private |
Exports all the voices in the staff to Lilypond. Each voice in the staff is stored as a Lilypond variable:
StaffOneVoiceOne = \relative c { ... }
References curContextIndex(), curVoice(), exportVoiceImpl(), indent(), CAVoice::name(), CAExport::out(), setCurVoice(), CAStaff::voiceList(), and voiceVariableName().
Referenced by exportSheetImpl().


|
privatevirtual |
Exports the given voice music elements to LilyPond syntax.
Reimplemented from CAExport.
References _curStreamTime, _lastNotePitch, _lastPlayableLength, _timeSignatureFound, _voltaBracketFinishAtBar, _voltaBracketFinishAtRepeat, CAMusElement::Barline, CABarline::barlineType(), barlineTypeToLilyPond(), CATimeSignature::beat(), CATimeSignature::beats(), CAClef::c1(), CAMusElement::Clef, CAClef::clefType(), clefTypeToLilyPond(), CAKeySignature::diatonicKey(), diatonicKeyGenderToLilyPond(), CADiatonicKey::diatonicPitch(), diatonicPitchToLilyPond(), doAnacrusisCheck(), exportMarksAfterElement(), exportMarksBeforeElement(), exportPlayable(), CAMusElement::FiguredBassMark, CAMusElement::FunctionMark, CADiatonicKey::gender(), indent(), indentLess(), indentMore(), CAMusElement::KeySignature, CAMusElement::Mark, CAMusElement::MidiNote, CAVoice::musElementList(), CAMusElement::Note, CAClef::offset(), CAExport::out(), CABarline::RepeatClose, CABarline::RepeatCloseOpen, CAMusElement::Rest, setCurVoice(), CABarline::Single, CAMusElement::Slur, CAMusElement::Syllable, CAMusElement::TimeSignature, CAMusElement::timeStart(), CAMusElement::Tuplet, CAMusElement::Undefined, CAPlayableLength::Undefined, and writeRelativeIntro().
Referenced by exportStaffVoices().


|
private |
Output tabs according to _indentLevel.
References curIndentLevel(), and CAExport::out().
Referenced by exportLyricsContextBlock(), exportScoreBlock(), exportStaffVoices(), exportVoiceImpl(), and writeDocumentHeader().


|
inlineprivate |
References _curIndentLevel.
Referenced by exportLyricsContextBlock(), exportScoreBlock(), exportVoiceImpl(), and writeDocumentHeader().

|
inlineprivate |
References _curIndentLevel.
Referenced by exportLyricsContextBlock(), exportScoreBlock(), exportVoiceImpl(), and writeDocumentHeader().

|
private |
Encapsulates the given string into \markup {}.
References escapeWeirdChars().
Referenced by writeDocumentHeader().


|
private |
Converts the note length to LilyPond syntax.
References CAPlayableLength::Breve, CAPlayableLength::dotted(), CAPlayableLength::Eighth, CAPlayableLength::Half, CAPlayableLength::HundredTwentyEighth, CAPlayableLength::musicLength(), CAPlayableLength::Quarter, CAPlayableLength::Sixteenth, CAPlayableLength::SixtyFourth, CAPlayableLength::ThirtySecond, CAPlayableLength::Undefined, and CAPlayableLength::Whole.
Referenced by exportMarksBeforeElement(), and exportPlayable().


|
private |
This function returns the relative note pitch in LilyPond syntax on the given Canorus pitch and previous note pitch.
eg. pitch=10, accs=1, prevPitch=5 => returns "f'"
References diatonicPitchToLilyPond(), and CADiatonicPitch::noteName().

|
inlineprivate |
References CANote::diatonicPitch(), and relativePitchToString().
Referenced by exportPlayable(), relativePitchToString(), and writeRelativeIntro().


|
private |
Converts the rest type to LilyPond syntax.
References CARest::Hidden, CARest::Normal, and CARest::Undefined.
Referenced by exportPlayable().

|
private |
Export document title, subtitle, composer, copyright etc.
References CAStaff::barlineRefs(), CABarline::barlineType(), CABarline::barlineTypeToString(), CAMusElement::markList(), CAExport::out(), CABarline::RepeatClose, CABarline::RepeatCloseOpen, CAMark::RepeatMark, CARepeatMark::repeatMarkTypeToString(), CABarline::RepeatOpen, and CARepeatMark::Volta.
Referenced by exportSheetImpl().


|
inlineprivate |
References _curContext.
Referenced by exportScoreBlock().

|
inlineprivate |
References _curContextIndex.
Referenced by exportSheetImpl().

|
inlineprivate |
References _curDocument.
Referenced by CALilyPondExport(), and exportSheetImpl().

|
inlineprivate |
|
inlineprivate |
References _curVoice.
Referenced by exportStaffVoices(), and exportVoiceImpl().

|
inlineprivate |
References _curIndentLevel.
Referenced by CALilyPondExport().

|
private |
Spell out numbers in a QString: "Staff1Voice2" -> "StaffOneVoiceTwo" This is necessary because Lilypond variable names can only contain letters.
Referenced by exportLyricsContextBlock(), exportScoreBlock(), and voiceVariableName().

|
private |
References CASyllable::hyphenStart(), CASyllable::melismaStart(), and CASyllable::text().
Referenced by exportLyricsContextImpl().


|
private |
Modify name to contain a string "StaffXVoiceY" where X and Y are spelled-out versions of staffNum and voiceNum, respectively. This is for generating names of Lilypond variables from Canorus staff and voices indices, since Lilypond variable names must contain only alphabetical characters.
Example: voiceVariableName( name, 1, 2 ); --> name is "StaffOneVoiceTwo"
References spellNumbers().
Referenced by exportScoreBlock(), and exportStaffVoices().


|
private |
|
private |
Export document title, subtitle, composer, copyright etc.
References curDocument(), indent(), indentLess(), indentMore(), markupString(), and CAExport::out().
Referenced by exportSheetImpl().


|
private |
Writes the voice's \relative note intro and returns the note pitch for the current voice. This function is usually used for writing the beginning of the voice.
References curVoice(), CAVoice::musElementList(), CAMusElement::Note, CADiatonicPitch::noteName(), CAExport::out(), relativePitchToString(), and CADiatonicPitch::setNoteName().
Referenced by exportVoiceImpl().


|
private |
Referenced by curContext(), and setCurContext().
|
private |
Referenced by curContextIndex(), and setCurContextIndex().
|
private |
Referenced by curDocument(), and setCurDocument().
|
private |
Referenced by curIndentLevel(), indentLess(), indentMore(), and setIndentLevel().
|
private |
Referenced by curSheet(), and setCurSheet().
|
private |
Referenced by exportPlayable(), and exportVoiceImpl().
|
private |
Referenced by curVoice(), and setCurVoice().
|
private |
Referenced by exportPlayable(), and exportVoiceImpl().
|
private |
Referenced by exportPlayable(), and exportVoiceImpl().
|
private |
|
staticprivate |
Referenced by exportMarksAfterElement(), and exportMarksBeforeElement().
|
staticprivate |
Referenced by exportMarksAfterElement(), and exportMarksBeforeElement().
|
private |
Referenced by CALilyPondExport(), exportScoreBlock(), and exportVoiceImpl().
|
private |
Referenced by CALilyPondExport(), exportMarksBeforeElement(), and exportVoiceImpl().
|
private |
Referenced by CALilyPondExport(), exportMarksBeforeElement(), and exportVoiceImpl().
|
private |
Referenced by CALilyPondExport(), and voltaFunction().