⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lilypondexporter.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
                    groupId = -1;                    groupType = "";                }            }        }        timeT soundingDuration = -1;        timeT duration = calculateDuration                         (s, i, barEnd, soundingDuration, tupletRatio, overlong);        if (soundingDuration == -1) {            soundingDuration = duration * tupletRatio.first / tupletRatio.second;        }        if ((*i)->has(SKIP_PROPERTY)) {            (*i)->unset(SKIP_PROPERTY);            ++i;            continue;        }        if ((*i)->isa(Note::EventType)) {            Chord chord(*s, i, m_composition->getNotationQuantizer());            Event *e = *chord.getInitialNote();            bool tiedForward = false;            // Examine the following event, and truncate our duration            // if we overlap it.            if (e->has(DISPLACED_X)) {                double xDisplacement = 1 + ((double) e->get                                            <Int>(DISPLACED_X)) / 1000;                str << "\\once \\override NoteColumn #'force-hshift = #"                << xDisplacement << " ";            }            bool hiddenNote = false;            if (e->has(INVISIBLE)) {                if (e->get                        <Bool>(INVISIBLE)) {                    hiddenNote = true;                }            }	    	    if ( hiddenNote ) {	        str << "\\hideNotes ";	    }            if (e->has(NotationProperties::STEM_UP)) {                if (e->get                        <Bool>(NotationProperties::STEM_UP)) {                    if (lastStem != 1) {                        str << "\\stemUp ";                        lastStem = 1;                    }                }                else {                    if (lastStem != -1) {                        str << "\\stemDown ";                        lastStem = -1;                    }                }            } else {                if (lastStem != 0) {                    str << "\\stemNeutral ";                    lastStem = 0;                }            }            if (chord.size() > 1)                str << "< ";            Segment::iterator stylei = s->end();            for (i = chord.getInitialElement(); s->isBeforeEndMarker(i); ++i) {                if ((*i)->isa(Text::EventType)) {                    if (!handleDirective(*i, lilyText, nextBarIsAlt1, nextBarIsAlt2,                                         nextBarIsDouble, nextBarIsEnd, nextBarIsDot)) {                        handleText(*i, lilyText);                    }                } else if ((*i)->isa(Note::EventType)) {                    if (m_languageLevel >= LILYPOND_VERSION_2_8) {                        // one \tweak per each chord note                        if (chord.size() > 1)                            writeStyle(*i, prevStyle, col, str, true);                        else                            writeStyle(*i, prevStyle, col, str, false);                    } else {                        // only one override per chord, and that outside the <>                        stylei = i;                    }                    writePitch(*i, key, str);                    bool noteHasCautionaryAccidental = false;                    (*i)->get                    <Bool>(NotationProperties::USE_CAUTIONARY_ACCIDENTAL, noteHasCautionaryAccidental);                    if (noteHasCautionaryAccidental)                        str << "?";                    bool noteTiedForward = false;                    (*i)->get                    <Bool>(TIED_FORWARD, noteTiedForward);                    if (noteTiedForward)                        tiedForward = true;                    str << " ";                } else if ((*i)->isa(Indication::EventType)) {                    eventsToStart.insert(*i);                    eventsInProgress.insert(*i);                }                if (i == chord.getFinalElement())                    break;            }            if (chord.size() > 1)                str << "> ";            if (duration != prevDuration) {                durationRatio = writeDuration(duration, str);                str << " ";                prevDuration = duration;            }            if (m_languageLevel == LILYPOND_VERSION_2_6) {                // only one override per chord, and that outside the <>                if (stylei != s->end()) {                    writeStyle(*stylei, prevStyle, col, str, false);                    stylei = s->end();                }            }            if (lilyText != "") {                str << lilyText;                lilyText = "";            }            writeSlashes(*i, str);            writtenDuration += soundingDuration;	    std::pair<int,int> ratio = fractionProduct(durationRatio,tupletRatio);	    durationRatioSum = fractionSum(durationRatioSum, ratio);	    // str << qstrtostr(QString(" %{ %1/%2 * %3/%4 = %5/%6 %} ").arg(durationRatio.first).arg(durationRatio.second).arg(tupletRatio.first).arg(tupletRatio.second).arg(ratio.first).arg(ratio.second)); // DEBUG            std::vector<Mark> marks(chord.getMarksForChord());            // problem here: stem direction unavailable (it's a view-local property)            bool stemUp = true;            e->get            <Bool>(NotationProperties::STEM_UP, stemUp);            for (std::vector<Mark>::iterator j = marks.begin(); j != marks.end(); ++j) {                str << composeLilyMark(*j, stemUp);            }            if (marks.size() > 0)                str << " ";            handleEndingEvents(eventsInProgress, i, str);            handleStartingEvents(eventsToStart, str);            if (tiedForward)                str << "~ ";	    if ( hiddenNote ) {	        str << "\\unHideNotes ";	    }            if (newBeamedGroup) {                // This is a workaround for bug #1705430:                //   Beaming groups erroneous after merging notes                // There will be fewer "e4. [ ]" errors in LilyPond-compiling.                // HJJ: This should be fixed in notation engine,                //      after which the workaround below should be removed.                Note note(Note::getNearestNote(duration, MAX_DOTS));                switch (note.getNoteType()) {                case Note::SixtyFourthNote:                case Note::ThirtySecondNote:                case Note::SixteenthNote:                case Note::EighthNote:                    notesInBeamedGroup++;                    break;                }            }            // // Old version before the workaround for bug #1705430:            // if (newBeamedGroup)            //    notesInBeamedGroup++;        } else if ((*i)->isa(Note::EventRestType)) {            bool hiddenRest = false;            if ((*i)->has(INVISIBLE)) {                if ((*i)->get                        <Bool>(INVISIBLE)) {                    hiddenRest = true;                }            }	    if (MultiMeasureRestCount == 0) {		if (hiddenRest) {		    str << "s";		} else if (duration == timeSignature.getBarDuration()) {		    // Look ahead the segment in order to detect		    // the number of measures in the multi measure rest.		    Segment::iterator mm_i = i;		    while (s->isBeforeEndMarker(++mm_i)) {			if ((*mm_i)->isa(Note::EventRestType) &&			    (*mm_i)->getNotationDuration() == (*i)->getNotationDuration() &&			    timeSignature == m_composition->getTimeSignatureAt((*mm_i)->getNotationAbsoluteTime())) {			    MultiMeasureRestCount++;			} else {			    break;			}		    }		    str << "R";		} else {		    str << "r";		}	    		if (duration != prevDuration) {		    durationRatio = writeDuration(duration, str);		    if (MultiMeasureRestCount > 0) {			str << "*" << (1 + MultiMeasureRestCount);		    }		    prevDuration = duration;		}		if (lilyText != "") {		    str << lilyText;		    lilyText = "";		}		str << " ";	    		handleEndingEvents(eventsInProgress, i, str);		handleStartingEvents(eventsToStart, str);		if (newBeamedGroup)		    notesInBeamedGroup++;	    } else {		MultiMeasureRestCount--;	    }            writtenDuration += soundingDuration;	    std::pair<int,int> ratio = fractionProduct(durationRatio,tupletRatio);	    durationRatioSum = fractionSum(durationRatioSum, ratio);	    // str << qstrtostr(QString(" %{ %1/%2 * %3/%4 = %5/%6 %} ").arg(durationRatio.first).arg(durationRatio.second).arg(tupletRatio.first).arg(tupletRatio.second).arg(ratio.first).arg(ratio.second)); // DEBUG        } else if ((*i)->isa(Clef::EventType)) {            try {                // Incomplete: Set which note the clef should center on  (DMM - why?)                // To allow octavation of the clef, enclose the clefname always with quotes.                str << "\\clef \"";                Clef clef(**i);                if (clef.getClefType() == Clef::Treble) {                    str << "treble";                } else if (clef.getClefType() == Clef::French) {                    str << "french";                } else if (clef.getClefType() == Clef::Soprano) {                    str << "soprano";                } else if (clef.getClefType() == Clef::Mezzosoprano) {                    str << "mezzosoprano";                } else if (clef.getClefType() == Clef::Alto) {                    str << "alto";                } else if (clef.getClefType() == Clef::Tenor) {                    str << "tenor";                } else if (clef.getClefType() == Clef::Baritone) {                    str << "baritone";                } else if (clef.getClefType() == Clef::Varbaritone) {                    str << "varbaritone";                } else if (clef.getClefType() == Clef::Bass) {                    str << "bass";                } else if (clef.getClefType() == Clef::Subbass) {                    str << "subbass";                }                // Transpose the clef one or two octaves up or down, if specified.                int octaveOffset = clef.getOctaveOffset();                if (octaveOffset > 0) {                    str << "^" << 8*octaveOffset;                } else if (octaveOffset < 0) {                    str << "_" << -8*octaveOffset;                }                str << "\"" << std::endl << indent(col);            } catch (Exception e) {                std::cerr << "Bad clef: " << e.getMessage() << std::endl;            }        } else if ((*i)->isa(Rosegarden::Key::EventType)) {            try {                str << "\\key ";                key = Rosegarden::Key(**i);                Accidental accidental = Accidentals::NoAccidental;                std::cout << "key tonic pitch: " << key.getTonicPitch() << std::endl; //REMOVE                str << convertPitchToLilyNote(key.getTonicPitch(), accidental, key);                if (key.isMinor()) {                    str << " \\minor";                } else {                    str << " \\major";                }                str << std::endl << indent(col);            } catch (Exception e) {                std::cerr << "Bad key: " << e.getMessage() << std::endl;            }        } else if ((*i)->isa(Text::EventType)) {            if (!handleDirective(*i, lilyText, nextBarIsAlt1, nextBarIsAlt2,                                 nextBarIsDouble, nextBarIsEnd, nextBarIsDot)) {                handleText(*i, lilyText);            }        } else if ((*i)->isa(Guitar::Chord::EventType)) {            try {                Guitar::Chord chord = Guitar::Chord(**i);                const Guitar::Fingering& fingering = chord.getFingering();                                int firstFret = fingering.getStartFret();                int barreStart = 0, barreEnd = 0, barreFret = 0;                //                 // Check if there is a barre.                //                if (fingering.hasBarre()) {                    Guitar::Fingering::Barre barre = fingering.getBarre();                    barreStart = barre.start;                    barreEnd = barre.end;                    barreFret = barre.fret;                }                if (barreStart == 0) {                    str << " s4*0^\\markup \\fret-diagram #\""

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -