8 #ifndef __VRV_IOHUMDRUM_H__
9 #define __VRV_IOHUMDRUM_H__
36 #include "runningelement.h"
47 #ifndef NO_HUMDRUM_SUPPORT
49 #include "pugixml.hpp"
57 #ifndef NO_HUMDRUM_SUPPORT
85 HumdrumTie(
const HumdrumTie &anothertie);
87 HumdrumTie &operator=(
const HumdrumTie &anothertie);
89 void setStart(
const std::string &
id, Measure *starting,
int layer,
const std::string &token,
int pitch,
90 hum::HumNum starttime, hum::HumNum endtime,
int subindex, hum::HTp starttok,
int metertop,
91 hum::HumNum meterbot);
92 void setEnd(
const std::string &
id, Measure *ending,
int layer,
const std::string &token,
int pitch,
93 hum::HumNum starttime, hum::HumNum endtime,
int subindex, hum::HTp starttok,
int metertop,
94 hum::HumNum meterbot);
95 vrv::Tie *setEndAndInsert(
const std::string &
id, Measure *ending,
int layer,
const std::string &token,
96 int pitch, hum::HumNum starttime, hum::HumNum endtime,
int subindex, hum::HTp starttok,
int metertop,
97 hum::HumNum meterbot);
99 hum::HumNum getEndTime();
100 hum::HumNum getMeterUnit();
101 hum::HumNum getStartTime();
102 std::string getEndId();
103 void setEndId(
const std::string &
id);
104 hum::HTp getEndToken();
105 hum::HumNum getDuration();
106 std::string getStartToken();
107 hum::HTp getStartTokenPointer();
108 Measure *getStartMeasure();
109 Measure *getEndMeasure();
110 void setEndMeasure(Measure *measure);
111 int getStartSubindex();
112 int getEndSubindex();
120 hum::HumNum getMeterBottom();
121 void setMeterTop(
int metertop);
122 void setMeterBottom(hum::HumNum meterbot);
125 std::string m_starttoken;
126 std::string m_endtoken;
127 hum::HumNum m_starttime;
128 hum::HumNum m_endtime;
134 std::string m_startid;
136 Measure *m_startmeasure;
137 Measure *m_endmeasure;
138 hum::HTp m_starttokenpointer = NULL;
141 hum::HumNum m_meter_bottom;
144 class HumdrumBeamAndTuplet {
160 hum::HumNum duration;
161 hum::HumNum durationnodots;
163 HumdrumBeamAndTuplet() { clear(); }
164 ~HumdrumBeamAndTuplet() { clear(); }
170 tupletstart = tupletend = 0;
171 beamstart = beamend = 0;
172 gbeamstart = gbeamend = 0;
183 class StaffStateVariables {
185 StaffStateVariables();
186 ~StaffStateVariables();
188 ostream &print(ostream &out = std::cout,
const std::string &prefix =
"SS> ");
196 std::vector<hum::HTp> verse_labels;
200 std::vector<hum::HTp> verse_abbr_labels;
204 bool suppress_tuplet_number;
208 bool suppress_tuplet_bracket;
213 bool suppress_articulations;
221 std::vector<bool> cue_size;
230 std::vector<char> stem_type;
234 std::vector<bool> stem_visible;
237 bool ligature_recta =
false;
239 bool ligature_obliqua =
false;
243 std::string last_clef;
280 Note *ottavanotestart;
281 std::string ottavanotestartid;
283 hum::HumNum ottavaendtimestamp;
284 Measure *ottavameasure;
289 Note *ottavadownnotestart;
290 std::string ottavadownnotestartid;
291 Note *ottavadownnoteend;
292 hum::HumNum ottavadownendtimestamp;
293 Measure *ottavadownmeasure;
298 Note *ottava2notestart;
299 std::string ottava2notestartid;
300 Note *ottava2noteend;
301 hum::HumNum ottava2endtimestamp;
302 Measure *ottava2measure;
307 Note *ottava2downnotestart;
308 std::string ottava2downnotestartid;
309 Note *ottava2downnoteend;
310 hum::HumNum ottava2downendtimestamp;
311 Measure *ottava2downmeasure;
315 hum::HumNum meter_bottom = 4;
332 std::list<humaux::HumdrumTie> tiestarts;
337 std::list<humaux::HumdrumTie> tieends;
342 int m_dynamstaffadj = 0;
343 bool m_dynamposdefined =
false;
347 std::string m_notehead;
351 bool auto_custos =
false;
355 bool suppress_manual_custos =
false;
358 int mensuration_type = 0;
364 std::vector<hum::HTp> glissStarts;
376 std::string kernTerminalLong;
377 std::string kernTerminalBreve;
379 std::string mensTerminalLong;
380 std::string mensTerminalBreve;
382 std::vector<string> editaccKern;
383 std::vector<string> editaccMens;
384 std::vector<std::string> edittypeKern;
385 std::vector<std::string> edittypeMens;
388 std::string cresctext;
389 std::string crescfontstyle;
390 std::string decresctext;
391 std::string decrescfontstyle;
396 std::string phrase_color;
397 std::string phrase_style;
398 std::string phrase_slur;
400 std::string space_color;
401 std::string ispace_color;
402 std::string irest_color;
403 std::string rspace_color;
412 std::vector<string> mark;
413 std::vector<std::string> mcolor;
414 std::vector<std::string> markdir;
419 std::vector<string> mens_mark;
420 std::vector<std::string> mens_mcolor;
421 std::vector<std::string> mens_markdir;
424 std::vector<string> textmark;
425 std::vector<std::string> textcolor;
428 std::string hairpinAccent;
429 std::string verticalStroke;
437 std::string lineText;
443 bool isParseable =
false;
445 bool isHumdrumKey =
false;
447 bool isTranslated =
false;
449 std::string language;
457 std::string dateError;
459 std::string yearError;
461 std::string monthError;
463 std::string dayError;
465 std::string hourError;
467 std::string minuteError;
469 std::string secondError;
476 std::string constructType;
477 std::string dateConstructError;
478 std::string qualifier;
479 std::vector<DateWithErrors> dates;
480 std::vector<DateConstruct> dateConstructs;
493 bool Import(
const std::string &humdrum)
override;
495 void parseEmbeddedOptions(
vrv::Doc *doc);
496 void finalizeDocument(
vrv::Doc *doc);
498 #ifndef NO_HUMDRUM_SUPPORT
500 std::string GetHumdrumString();
501 std::string GetMeiString();
505 bool convertHumdrum();
506 void setupMeiDocument();
507 int getMeasureEndLine(
int startline);
508 bool convertSystemMeasure(
int &line);
509 bool convertMeasureStaves(
int startline,
int endline);
510 bool convertMeasureStaff(
int track,
int startline,
int endline,
int n,
int layercount);
511 void setupSystemMeasure(
int startline,
int endline);
512 bool convertStaffLayer(
int track,
int startline,
int endline,
int layerindex);
513 int getMeasureNumber(
int startline,
int endline);
514 bool fillContentsOfLayer(
int track,
int startline,
int endline,
int layerindex);
515 void calculateLayout();
516 void setSystemMeasureStyle(
int startline,
int endline);
517 std::vector<int> getStaffLayerCounts();
518 void prepareStaffGroups(
int top,
int bot);
519 void setClef(
StaffDef *staff,
const std::string &clef, hum::HTp cleftok = NULL, hum::HTp striatok = NULL);
520 void setDynamicTransposition(
int staffindex,
StaffDef *staff,
const std::string &itranspose);
521 void setTransposition(
StaffDef *staffDef,
const std::string &transpose);
522 void setTimeSig(
StaffDef *part,
const std::string ×ig,
const std::string &metersig =
"",
523 hum::HTp partstart = NULL, hum::HTp timetok = NULL, hum::HTp metertok = NULL);
524 void fillStaffInfo(hum::HTp staffstart,
int staffnumber,
int staffcount);
525 void storeStaffLayerTokensForMeasure(
int startline,
int endline);
526 void calculateReverseKernIndex();
527 void prepareTimeSigDur(
int &top,
int &bot);
528 void printMeasureTokens();
529 int characterCount(
const std::string &text,
char symbol);
530 int characterCount(hum::HTp token,
char symbol);
531 int characterCountInSubtoken(hum::HTp token,
char symbol);
532 int characterCountInSubtoken(
const std::string &text,
char symbol);
533 bool emptyMeasures();
534 bool hasFullMeasureRest(std::vector<hum::HTp> &layerdata, hum::HumNum timesigdur, hum::HumNum measuredur);
535 void convertNote(
vrv::Note *note, hum::HTp token,
int staffadj,
int staffindex,
int subtoken = -1);
536 void addCautionaryAccidental(
Accid *accid, hum::HTp token,
int acount);
537 void convertRest(
vrv::Rest *rest, hum::HTp token,
int subtoken,
int staffindex);
538 void convertMRest(
MRest *rest, hum::HTp token,
int subtoken,
int staffindex);
539 void processTieStart(
Note *note, hum::HTp token,
const std::string &tstring,
int subindex);
540 void processTieEnd(
Note *note, hum::HTp token,
const std::string &tstring,
int subindex);
541 void addFermata(hum::HTp token,
vrv::Object *parent = NULL);
542 void addBreath(hum::HTp token,
vrv::Object *parent = NULL);
543 void addTrill(
vrv::Object *linked, hum::HTp token);
544 void addTurn(hum::HTp token,
const std::string &tok,
int noteIndex);
545 void addMordent(
vrv::Object *linked, hum::HTp token);
546 void addOrnaments(
vrv::Object *
object, hum::HTp token);
547 void addArpeggio(
vrv::Object *
object, hum::HTp token);
548 void getTimingInformation(std::vector<hum::HumNum> &prespace, std::vector<hum::HTp> &layerdata,
549 hum::HumNum layerstarttime, hum::HumNum layerendtime);
550 void convertChord(
Chord *chord, hum::HTp token,
int staffindex);
551 void prepareVerses();
552 void checkForOmd(
int startline,
int endline);
553 void handleOttavaMark(hum::HTp token,
Note *note);
554 void handlePedalMark(hum::HTp token);
555 void handleLigature(hum::HTp token);
556 void handleColoration(hum::HTp token);
557 void prepareBeamAndTupletGroups(
558 std::vector<humaux::HumdrumBeamAndTuplet> &tg,
const std::vector<hum::HTp> &layerdata);
559 void assignScalingToTupletGroup(std::vector<humaux::HumdrumBeamAndTuplet *> &tggroup);
560 void printGroupInfo(
const std::vector<humaux::HumdrumBeamAndTuplet> &tg);
561 void insertTuplet(std::vector<std::string> &elements, std::vector<void *> &pointers,
562 const std::vector<humaux::HumdrumBeamAndTuplet> &tgs, std::vector<hum::HTp> layerdata,
int layerindex,
563 bool suppressTupletNumber,
bool suppressBracketTuplet);
565 std::vector<std::string> &elements, std::vector<void *> &pointers,
const humaux::HumdrumBeamAndTuplet &tg);
567 std::vector<std::string> &elements, std::vector<void *> &pointers,
const humaux::HumdrumBeamAndTuplet &tg);
568 void analyzeLayerBeams(
569 std::vector<int> &beamnum, std::vector<int> &gbeamnum,
const std::vector<hum::HTp> &layerdata);
570 void storeBreaksec(std::vector<int> &beamstate, std::vector<int> &gbeamstate,
571 const std::vector<hum::HTp> &layerdata,
bool grace =
false);
572 void setBeamDirection(
int direction,
const std::vector<humaux::HumdrumBeamAndTuplet> &tgs,
573 std::vector<hum::HTp> &layerdata,
int layerindex,
bool grace);
574 void handleGroupStarts(
const std::vector<humaux::HumdrumBeamAndTuplet> &tgs, std::vector<std::string> &elements,
575 std::vector<void *> &pointers, std::vector<hum::HTp> &layerdata,
int layerindex);
576 bool checkForTremolo(
577 std::vector<hum::HTp> &layerdata,
const std::vector<humaux::HumdrumBeamAndTuplet> &tgs,
int startindex);
578 void handleGroupEnds(
579 const humaux::HumdrumBeamAndTuplet &tg, std::vector<std::string> &elements, std::vector<void *> &pointers);
580 void handleStaffStateVariables(hum::HTp token);
581 void handleStaffDynamStateVariables(hum::HTp token);
582 void removeTuplet(std::vector<std::string> &elements, std::vector<void *> &pointers);
583 void removeGBeam(std::vector<std::string> &elements, std::vector<void *> &pointers);
584 void removeBeam(std::vector<std::string> &elements, std::vector<void *> &pointers);
586 std::vector<std::string> &elements, std::vector<void *> &pointers, hum::HTp clef, hum::HTp lastnote);
587 void insertMeterSigElement(std::vector<std::string> &elements, std::vector<void *> &pointers,
588 std::vector<hum::HTp> &layeritems,
int index);
589 void processSlurs(hum::HTp token);
590 std::string generateSlurId(hum::HTp token,
int count,
int number);
591 void processPhrases(hum::HTp token);
592 int getSlurEndNumber(hum::HTp startslur,
int slurstartnumber);
593 void addHarmFloatsForMeasure(
int startine,
int endline);
594 void addFingeringsForMeasure(
int startline,
int endline);
595 void insertFingerNumberInMeasure(
596 const std::string &text,
int staffindex, hum::HTp token,
int maxstaff,
bool aboveQ);
597 void addStringNumbersForMeasure(
int startline,
int endline);
598 void addFiguredBassForMeasure(
int startline,
int endline);
599 void processDynamics(hum::HTp token,
int staffindex);
600 void processDirections(hum::HTp token,
int staffindex);
601 void processLinkedDirection(
int index, hum::HTp token,
int staffindex);
602 void processGlobalDirections(hum::HTp token,
int staffindex);
603 void processChordSignifiers(
Chord *chord, hum::HTp token,
int staffindex);
604 hum::HumNum getMeasureTstamp(hum::HTp token,
int staffindex, hum::HumNum frac = 0);
605 hum::HumNum getMeasureTstamp(hum::HTp token, hum::HumNum extraduration,
int staffindex, hum::HumNum frac = 0);
606 hum::HumNum getMeasureTstampPlusDur(hum::HTp token,
int staffindex, hum::HumNum fract = 0);
607 hum::HumNum getMeasureEndTstamp(
int staffindex);
608 hum::HumNum getMeasureFactor(
int staffindex);
609 hum::HTp getPreviousDataToken(hum::HTp token);
610 hum::HTp getHairpinEnd(hum::HTp token,
const std::string &endchar);
611 hum::HTp getDecrescendoEnd(hum::HTp token);
612 hum::HTp getCrescendoEnd(hum::HTp token);
613 int getMeasureDifference(hum::HTp starttok, hum::HTp endtok);
614 int getMeasureDifference(hum::HTp starttok, hum::HumNum meterunit, hum::HumNum tieduration, hum::HumNum &tstamp);
615 void storeOriginalClefMensurationKeyApp();
616 void addSpace(std::vector<std::string> &elements, std::vector<void *> &pointers, hum::HumNum duration,
617 const std::string &typestring =
"");
618 void setLocationId(
vrv::Object *
object, hum::HTp token,
int subtoken = -1);
619 void setLocationId(
vrv::Object *
object,
int lineindex,
int fieldindex,
int subtokenindex);
620 std::string getLocationId(
vrv::Object *
object, hum::HTp token,
int subtoken = -1);
621 std::string getLocationId(
Object *
object,
int lineindex,
int fieldindex,
int subtokenindex);
622 std::string getLocationId(
const std::string &prefix, hum::HTp token,
int subtoken = -1);
623 std::string getLocationId(
const std::string &prefix,
int lineindex,
int fieldindex,
int subtokenindex);
624 void setLocationIdNSuffix(
vrv::Object *
object, hum::HTp token,
int number);
625 void setSlurLocationId(
626 vrv::Object *
object, hum::HTp slurstart, hum::HTp slurend,
int eindex,
const std::string &prefix =
"");
627 void setTieLocationId(
vrv::Object *
object, hum::HTp tiestart,
int sindex, hum::HTp tieend,
int eindex);
628 void setBeamLocationId(
vrv::Object *
object,
const std::vector<humaux::HumdrumBeamAndTuplet> &tgs,
629 std::vector<hum::HTp> &layerdata,
int startindex);
630 void setTupletLocationId(
vrv::Object *
object,
const std::vector<humaux::HumdrumBeamAndTuplet> &tgs,
631 std::vector<hum::HTp> &layerdata,
int startindex);
632 void addMidiTempo(
vrv::ScoreDef *scoreDef, hum::HTp kernpart,
int top,
int bot);
633 void addInstrumentDefinition(
vrv::StaffDef *staffdef, hum::HTp partstart);
634 void addOrnamentMarkers(hum::HTp token);
635 void setNextLeftBarStyle(data_BARRENDITION style);
636 void parseSignifiers(hum::HumdrumFile &infile);
637 std::string getAutoClef(hum::HTp partstart,
int partnumber);
638 void colorNote(
vrv::Note *note, hum::HTp token,
const std::string &subtoken,
int line,
int field);
639 void colorRest(
vrv::Rest *rest,
const std::string &token,
int line,
int field);
640 void colorVerse(
Verse *verse, std::string &token);
641 std::string getSpineColor(
int line,
int field);
642 void checkForColorSpine(hum::HumdrumFile &infile);
643 std::vector<int> analyzeMultiRest(hum::HumdrumFile &infile);
644 bool analyzeBreaks(hum::HumdrumFile &infile);
645 void addSystemClefKeyTimeChange(
int startline,
int endline);
646 void prepareSections();
647 int getDirection(
const std::string &token,
const std::string &target);
648 void resolveTupletBeamTie(std::vector<humaux::HumdrumBeamAndTuplet> &tg);
649 void resolveTupletBeamStartTie(std::vector<humaux::HumdrumBeamAndTuplet> &tg,
int index);
650 void resolveTupletBeamEndTie(std::vector<humaux::HumdrumBeamAndTuplet> &tg,
int index);
651 void mergeTupletsCuttingBeam(std::vector<humaux::HumdrumBeamAndTuplet> &tg);
652 void embedQstampInClass(
vrv::Note *note, hum::HTp token,
const std::string &tstring);
653 void embedQstampInClass(
vrv::Rest *note, hum::HTp token,
const std::string &tstring);
654 void embedQstampInClass(
vrv::MRest *mrest, hum::HTp token,
const std::string &tstring);
655 void embedQstampInClass(
vrv::Space *irest, hum::HTp token,
const std::string &tstring);
656 void embedPitchInformationInClass(
vrv::Note *note,
const std::string &token);
657 void embedTieInformation(
Note *note,
const std::string &token);
658 void splitSyllableBySpaces(std::vector<std::string> &vtext,
char spacer =
' ');
659 void addDefaultTempo(
ScoreDef *scoreDef);
660 int getChordNoteCount(hum::HTp token);
661 bool isLeftmostSystemArpeggio(hum::HTp token);
662 bool isLeftmostStaffArpeggio(hum::HTp token);
663 std::vector<hum::HTp> getSystemArpeggioTokens(hum::HTp token);
664 std::vector<hum::HTp> getStaffArpeggioTokens(hum::HTp token);
665 void addDirection(
const std::string &text,
const std::string &placement,
bool bold,
bool italic, hum::HTp token,
666 int staffindex,
int justification = 0,
const std::string &color =
"",
int vgroup = -1,
667 const std::string &label =
"");
668 bool addTempoDirection(
const std::string &text,
const std::string &placement,
bool bold,
bool italic,
669 hum::HTp token,
int staffindex,
int justification,
const std::string &color);
670 bool setTempoContent(
Tempo *tempo,
const std::string &text);
671 bool setLabelContent(
Label *label,
const std::string &text);
672 std::vector<std::string> convertMusicSymbolNameToSmuflName(
const std::string &text);
673 void processTerminalLong(hum::HTp token);
674 void processTerminalBreve(hum::HTp token);
675 void removeCharacter(hum::HTp token,
char removechar);
676 std::string getSystemDecoration(
const std::string &tag);
677 bool processStaffDecoration(
const std::string &decoration);
678 int getStaffNumberLabel(hum::HTp spinestart);
679 int getGroupNumberLabel(hum::HTp spinestart);
680 int getPartNumberLabel(hum::HTp spinestart);
681 bool isFirstTokenOnStaff(hum::HTp token);
682 bool hasAboveParameter(hum::HTp token,
const std::string &category);
683 bool hasAboveParameter(hum::HTp token,
const std::string &category,
int &output);
684 bool hasBelowParameter(hum::HTp token,
const std::string &category);
685 bool hasBelowParameter(hum::HTp token,
const std::string &category,
int &output);
686 bool hasCenterParameter(hum::HTp token,
const std::string &category,
int &output);
687 void prepareHeaderFooter();
689 std::vector<std::pair<std::string, std::string>> &biblist, std::map<std::string, std::string> &refmap);
691 std::vector<std::pair<std::string, std::string>> &biblist, std::map<std::string, std::string> &refmap);
692 std::string processReferenceTemplate(
const std::string &input,
693 std::vector<std::pair<std::string, std::string>> &biblist, std::map<std::string, std::string> &refmap);
694 std::string processTemplateOperator(
const std::string &value,
const std::string &op);
695 std::string automaticHeaderLeft(std::vector<std::pair<std::string, std::string>> &biblist,
696 std::map<std::string, std::string> &refmap,
int linecount);
697 std::string automaticHeaderCenter(
698 std::vector<std::pair<std::string, std::string>> &biblist, std::map<std::string, std::string> &refmap);
699 std::string automaticHeaderRight(std::vector<std::pair<std::string, std::string>> &biblist,
700 std::map<std::string, std::string> &refmap,
int &linecount);
701 void convertMensuralToken(
702 std::vector<std::string> &elements, std::vector<void *> &pointers, hum::HTp token,
int staffindex);
703 void initializeSpineColor(hum::HumdrumFile &infile);
704 void setStemLength(
Note *note, hum::HTp token);
705 void storeExpansionLists(
Section *section, hum::HTp starting);
706 int getStaffAdjustment(hum::HTp token);
707 void calculateNoteIdForSlur(std::string &idstring, std::vector<pair<int, int>> &sortednotes,
int index);
708 void promoteInstrumentNamesToGroup();
709 void promoteInstrumentsForStaffGroup(
StaffGrp *group);
710 void promoteInstrumentAbbreviationsToGroup();
711 void promoteInstrumentAbbreviationsForStaffGroup(
StaffGrp *group);
712 void setGroupSymbol(
StaffGrp *sg, staffGroupingSym_SYMBOL symbol);
713 std::string getInstrumentName(
StaffDef *sd);
714 std::string getInstrumentAbbreviation(
StaffDef *sd);
715 std::string getInstrumentClass(hum::HTp start);
716 void removeInstrumentName(
StaffDef *sd);
717 void removeInstrumentAbbreviation(
StaffDef *sd);
718 std::string getStartIdForOttava(hum::HTp token);
719 std::string getEndIdForOttava(hum::HTp token);
720 void prepareInitialOttavas(hum::HTp measure);
721 void linkFingeringToNote(
Fing *fing, hum::HTp token,
int xstaffindex);
722 bool checkForTupletForcedBreak(
const std::vector<hum::HTp> &duritems,
int index);
723 void extractSlurNoteAttachmentInformation(std::vector<std::pair<int, bool>> &data, hum::HTp token,
char slurtype);
724 void extractPhraseNoteAttachmentInformation(
725 std::vector<std::pair<int, bool>> &data, hum::HTp token,
char phrasetype);
726 bool getNoteStateSlur(hum::HTp token,
int slurnumber);
727 bool getNoteStatePhrase(hum::HTp token,
int phrasenumber);
728 void assignVerticalGroup(
Pedal *ped, hum::HTp token);
729 void storeAcclev(
const std::string value,
int staffindex);
730 void storeStemInterpretation(
const std::string &value,
int staffindex,
int layernumber);
731 bool getBooleanParameter(hum::HTp token,
const std::string &category,
const std::string &key);
732 std::string getStringParameter(hum::HTp token,
const std::string &category,
const std::string &key);
733 bool shouldHideBeamBracket(
734 const std::vector<humaux::HumdrumBeamAndTuplet> &tgs, std::vector<hum::HTp> &layerdata,
int layerindex);
735 void checkBeamWith(
Beam *beam,
const std::vector<humaux::HumdrumBeamAndTuplet> &tgs,
736 std::vector<hum::HTp> &layerdata,
int startindex);
737 std::string getTrackText(hum::HTp token);
738 void checkForLayoutBreak(
int line);
739 std::string removeCommas(
const std::string &input);
740 void extractNullInformation(vector<bool> &nulls, hum::HumdrumFile &infile);
741 void initializeIgnoreVector(hum::HumdrumFile &infile);
742 bool hasIndent(hum::HTp tok);
743 void prepareNonStandardKeySignature(
KeySig *vrvkeysig,
const std::string &ks, hum::HTp keytok);
744 void fixLargeTuplets(std::vector<humaux::HumdrumBeamAndTuplet> &tg);
745 void addSlurLineStyle(
Slur *element, hum::HTp token,
int slurindex);
746 void addTieLineStyle(
Tie *element, hum::HTp token,
int noteindex);
747 void setAccid(
Accid *accid,
const std::string &loaccid);
748 bool phraseIsInvisible(hum::HTp token,
int pindex);
749 hum::HumNum getLeftNoteDuration(hum::HTp token);
750 void checkClefBufferForSameAs();
751 void suppressBufferedClef(
int index);
752 void addExplicitStemDirection(
FTrem *ftrem, hum::HTp start);
753 void addSlur(
FTrem *ftrem, hum::HTp start, hum::HTp ending);
754 void addFTremSlurs();
755 std::vector<int> getStaffNumbers(std::string &deco);
756 int insertRepetitionElement(
757 std::vector<string> &elements, std::vector<void *> &pointers, std::vector<hum::HTp> tokens,
int index);
758 void setRepeatSlashes(
BeatRpt *repeat, std::vector<hum::HTp> &tokens,
int index);
759 std::string getLabelFromInstrumentCode(hum::HTp icode,
const std::string &transpose);
760 void checkForGlobalRehearsal(
int line);
761 bool isBlackNotation(hum::HTp starting);
762 std::string checkNoteForScordatura(
const std::string &token);
763 bool checkForScordatura(hum::HumdrumFile &infile);
764 void adjustMeasureTimings(hum::HumdrumFile &infile);
766 int staffindex,
int layerindex, std::vector<std::string> &elements, std::vector<void *> &pointers);
767 bool processOverfillingNotes(hum::HTp token);
768 bool isNextBarIgnored(hum::HTp token);
769 void hideTerminalBarlines(hum::HumdrumFile &infile);
770 void hideBarlinesInTiedGroup(hum::HTp startnote);
771 int getMultiEndline(
int startindex);
772 void processHangingTieEnd(
773 Note *note, hum::HTp token,
const std::string &tstring,
int subindex, hum::HumNum meterunit);
774 void processHangingTieStarts();
775 void processHangingTieStart(humaux::HumdrumTie &tieinfo);
776 bool atEndingBoundaryStart(hum::HTp token);
777 bool atEndingBoundaryEnd(hum::HTp token);
778 Tie *tieToPreviousItem(hum::HTp token,
int subindex, hum::HumNum meterunit,
Measure *measure = NULL);
779 Tie *addHangingTieToNextItem(hum::HTp token,
int subindex, hum::HumNum meterunit,
Measure *measure);
780 bool inDifferentEndings(hum::HTp token1, hum::HTp token2);
781 bool checkIfSlurIsInvisible(hum::HTp stoken,
int snumber, hum::HTp etoken,
int enumber);
782 void checkForTupletMergesAndSplits(std::vector<int> &tupletgroups, std::vector<hum::HTp> &duritems,
783 std::vector<hum::HumNum> &durations, std::vector<bool> &durforce);
784 bool hasLayoutParameter(hum::HTp token,
const std::string &category,
const std::string ¶m);
785 void assignTupletScalings(std::vector<humaux::HumdrumBeamAndTuplet> &tg);
786 std::string getLayoutParameter(hum::HTp token,
const std::string &category,
const std::string &catkey,
787 const std::string &trueString,
const std::string &falseString =
"");
788 void analyzeClefNulls(hum::HumdrumFile &infile);
789 void markAdjacentNullsWithClef(hum::HTp clef);
790 void markOtherClefsAsChange(hum::HTp clef);
791 int getCurrentLayerCount(hum::HTp token);
792 void checkForBreak(hum::HumdrumFile &infile,
int line);
793 bool hasMensuralStaff(hum::HLp line);
794 int getNextBarlineIndex(hum::HumdrumFile &infile,
int startline);
795 std::string escapeFreeAmpersand(
const std::string &value);
796 void addHairpinAccent(hum::HTp token);
798 std::vector<string> &elements, std::vector<void *> &pointers, std::vector<hum::HTp> tokens,
int index);
799 hum::HTp getAssociatedDynamSpine(hum::HTp stafftok);
800 hum::HTp getPreviousStaffToken(hum::HTp parttok);
801 void checkForVerseLabels(hum::HTp token);
802 std::vector<hum::HTp> getVerseLabels(hum::HTp token,
int staff);
803 std::vector<hum::HTp> getVerseAbbrLabels(hum::HTp token,
int staff);
804 std::string getVerseLabelText(hum::HTp token);
805 void addPlicaUp(
Note *note);
806 void addPlicaDown(
Note *note);
807 void setLayoutSlurDirection(
Slur *slur, hum::HTp token);
808 void setFontStyle(
Rend *rend,
const std::string &fontstyle);
809 void setFontWeight(
Rend *rend,
const std::string &fontweight);
810 void importVerovioOptions(
Doc *doc);
811 void adjustChordNoteDurations(
Chord *chord, std::vector<Note *> ¬es, std::vector<string> &tstrings);
812 void adjustChordNoteDuration(
Note *note, hum::HumNum hdur,
int dur,
int dots, hum::HumNum chorddur,
813 const std::string &tstring, hum::HumNum factor);
814 void setNoteMeiDur(
Note *note,
int meidur);
815 void storeExpansionListsInChoice(
Section *section, std::vector<hum::HTp> &expansions);
816 double getMmTempo(hum::HTp token,
bool checklast =
false);
817 double getMmTempoForward(hum::HTp token);
818 bool isNearOmd(hum::HTp token);
819 void handleTempoChange(hum::HTp token);
820 bool hasTempoTextAfter(hum::HTp token);
821 bool isTempoishText(hum::HTp token);
822 bool isLastStaffTempo(hum::HTp token);
823 void addMensuralQuality(
Note *note, hum::HTp token);
824 bool checkForMens(hum::HumdrumFile &infile);
825 bool layerOnlyContainsNullStuff(std::vector<hum::HTp> &data);
826 int getNoteStaff(hum::HTp token,
int homestaff);
827 void addBarLineElement(hum::HTp bartok, std::vector<std::string> &elements, std::vector<void *> &pointers);
828 void prepareFingerings(hum::HumdrumFile &infile);
829 void prepareFingerings(hum::HTp fstart);
830 std::string getLoColor(hum::HTp token,
const std::string &category,
int subtoken = 0);
831 bool isTieAllowedToHang(hum::HTp token);
832 void analyzeVerseColor(hum::HumdrumFile &infile);
833 void analyzeVerseColor(hum::HTp &token);
834 void processHangingTieEnds();
835 bool checkForInvisibleBeam(
Beam *beam,
const std::vector<humaux::HumdrumBeamAndTuplet> &tgs,
int layerindex);
836 void insertBeamSpan(hum::HTp token);
837 std::string getDataTokenId(hum::HTp token);
838 void checkForFingeredHarmonic(
Chord *chord, hum::HTp token);
839 double getGlobalTempoScaling(hum::HumdrumFile &infile);
840 bool isTacet(hum::HTp spinestart);
841 void storeBeamSpansInStartingMeasure();
842 hum::HTp getNextNonNullDataOrMeasureToken(hum::HTp tok);
843 void setBeamSpanPlist(
BeamSpan *beamspan, hum::HTp starttok, hum::HTp etok);
844 void checkMeterSigParameters(
MeterSig *msig, hum::HTp timesigtok);
845 bool checkForJoin(
Note *note, hum::HTp token);
846 bool checkForLayerJoin(
int staffindex,
int layerindex);
847 void storeTupletAndBeamInfoInTokens(std::vector<humaux::HumdrumBeamAndTuplet> &tgs);
848 std::vector<hum::HTp> getBeamNotes(hum::HTp token,
int beamstart);
849 bool checkForBeamSameas(
Beam *beam, std::vector<hum::HTp> &layerdata,
int layerindex);
850 bool checkForBeamStemSameas(std::vector<hum::HTp> &layerdata,
int layerindex);
851 void processInterpretationStuff(hum::HTp token,
int staffindex);
852 void insertGlissandos(std::vector<hum::HTp> &tokens);
853 void createGlissando(hum::HTp glissStart, hum::HTp glissEnd);
854 void setSmuflContent(
Symbol *symbol,
const std::string &name);
855 data_DURATION oneOverDenominatorToDur(
int denominator);
856 bool isExpressibleDuration(hum::HumNum duration);
857 pair<data_DURATION, int> getDurAndDots(hum::HumNum duration);
858 void checkForClefStyling(
Clef *clef, hum::HTp token);
859 void setClefColorOrEditorial(
860 hum::HTp token,
Clef *clef, std::vector<std::string> &elements, std::vector<void *> &pointers);
861 void setClefOctaveDisplacement(
Clef *clef,
const std::string &token);
862 void setClefBasicShape(
Clef *clef,
const std::string &tok);
863 void setClefStaffLine(
Clef *clef,
const std::string &tok);
864 void analyzeHarmInterpretations(hum::HTp starttok);
865 void analyzeDegreeInterpretations(hum::HTp starttok);
866 void analyzeTextInterpretation(hum::HTp starttok);
867 void addHarmLabel(hum::HumNum timestamp,
const std::string &label,
const std::string &labelStyle,
868 const std::string &n,
const std::string &place,
int staffNum);
869 std::u32string getMoveableDoName(hum::HTp token,
int degree,
int semitones);
870 void setFontsizeForHarm(
Harm *harm,
const std::string &fontsize);
871 void setFontStyleForHarm(
Harm *harm,
const std::string &style);
872 std::u32string addSemitoneAdjustmentsToDeg(
873 hum::HTp token,
int arrowQ,
int accidQ,
int solfegeQ,
int sharps,
int flats);
874 int hasParallelNote(hum::HTp token);
875 void setHarmContent(
Rend *rend, hum::HTp token);
876 std::string removeRecipFromHarmContent(
const std::string &input);
877 void setMxHarmContent(
Rend *rend,
const std::string &content);
878 void setDegreeContent(
Rend *rend, hum::HTp token,
int n = 0);
879 std::u32string cleanStringString(
const std::string &content);
880 std::vector<std::u32string> cleanFBString(std::vector<std::string> &pieces, hum::HTp token);
881 std::u32string cleanFBString2(std::vector<std::string> &pieces, hum::HTp token);
882 std::vector<std::string> splitFBString(
const std::string &content,
const std::string &separator =
" ");
883 std::u32string getVisualFBAccidental(
int accidental);
884 std::u32string convertFBNumber(
const std::string &input, hum::HTp token);
885 void checkForLineContinuations(hum::HTp token);
886 std::u32string convertNumberToWstring(
int number);
887 void appendTextToRend(
Rend *rend,
const std::string &content);
888 void parseMultiVerovioOptions(std::map<std::string, std::string> ¶meters,
const std::string &input);
889 void addSforzandoToNote(hum::HTp token,
int staffindex);
890 void addDynamicsMark(hum::HTp dyntok, hum::HTp token, hum::HLp line,
const std::string &letters,
int staffindex,
891 int staffadj,
int trackdiff);
892 bool hasNoStaves(hum::HumdrumFile &infile);
893 hum::HTp getVisualKeySignature(hum::HTp keysigtok);
894 bool isNotAtStartOfMeasure(std::vector<hum::HTp> &layerdata,
int index);
895 void analyzeFingerings(hum::HumdrumFile &infile);
896 void analyzeFingerings(hum::HTp sstart);
897 void insertMidMeasureKeySignature(
898 int staffindex, std::vector<std::string> &elements, std::vector<void *> &pointers, hum::HTp token);
899 int getKeySignatureNumber(
const std::string &humkeysig);
900 int getStaffNumForSpine(hum::HTp token);
901 bool checkIfReversedSpineOrder(std::vector<hum::HTp> &staffstarts);
902 bool hasOmdText(
int startline,
int endline);
903 void processMeiOptions(hum::HumdrumFile &infile);
904 std::string getInstrumentNumber(hum::HTp icode);
905 void insertTextWithNewlines(
Label *label,
const std::string &text);
906 bool hasBounceAfter(hum::HTp token);
907 bool hasBounceBefore(hum::HTp token);
908 void analyzeDefaultLayoutStyles(hum::HumdrumFile &infile);
909 std::string getDefaultLayoutParameter(
const std::string &category,
const std::string ¶meter);
913 void createFileDesc(pugi::xml_node meiHead);
914 void createDigitalSource(pugi::xml_node sourceDesc);
915 void createPrintedSource(pugi::xml_node sourceDesc);
916 void createRecordedSource(pugi::xml_node sourceDesc);
917 void createUnpublishedSource(pugi::xml_node sourceDesc);
918 void createEncodingDesc(pugi::xml_node meiHead);
919 void createWorkList(pugi::xml_node meiHead);
920 void createHumdrumVerbatimExtMeta(pugi::xml_node meiHead);
921 void createBackMatter();
922 void createSimpleTitleElement();
923 void createSimpleComposerElements();
924 void createTitleElements(pugi::xml_node element);
925 void createComposerElements(pugi::xml_node element);
926 void fillInIsoDate(pugi::xml_node element,
const std::string &dateString);
927 std::map<std::string, std::string> isoDateAttributesFromHumdrumDate(
928 const std::string &inHumdrumDate,
bool edtf =
false);
929 DateConstruct dateConstructFromHumdrumDate(
const std::string &dateString);
930 std::map<std::string, std::string> isoDateAttributesFromDateConstruct(
931 const DateConstruct &dateConstruct,
bool edtf,
bool isEdgeOfDateConstructRange =
false);
932 std::string isoDateFromDateWithErrors(
const DateWithErrors &dateWithErrors,
bool edtf);
933 DateWithErrors dateWithErrorsFromHumdrumDate(
const std::string &dateString);
934 bool sanityCheckDate(
int year,
int month,
int day,
int hour,
int minute,
int second);
935 std::string stripDateError(std::string &value);
936 std::string getTextListLanguage(
const std::vector<HumdrumReferenceItem> &textItems);
937 std::map<std::string, std::vector<HumdrumReferenceItem>> getAllReferenceItems(hum::HumdrumFile &infile);
938 std::vector<HumdrumReferenceItem> getReferenceItems(
const std::string &key);
939 bool anyReferenceItemsExist(
const std::vector<string> &keys);
940 int getBestItem(
const std::vector<HumdrumReferenceItem> &items,
const std::string &requiredLanguage);
941 bool isStandardHumdrumKey(
const std::string &key);
942 void appendText(pugi::xml_node element, std::string text);
943 void addDefaultTempoDist(
double distance);
946 template <
class ELEMENT>
void verticalRest(ELEMENT rest,
const std::string &token);
947 template <
class ELEMENT>
949 int partindex, ELEMENT element,
const std::string &keysig, hum::HTp keysigtok, hum::HTp keytok,
bool secondary);
950 template <
class ELEMENT>
void setKeySig(ELEMENT *element, hum::HTp keysigtok);
951 template <
class PARENT,
class CHILD>
void appendElement(PARENT parent, CHILD child);
952 template <
class ELEMENT>
void addArticulations(ELEMENT element, hum::HTp token);
953 template <
class ELEMENT> hum::HumNum convertRhythm(ELEMENT element, hum::HTp token,
int subtoken = -1);
954 template <
class ELEMENT>
void setRhythmFromDuration(ELEMENT element, hum::HumNum dur);
955 template <
class ELEMENT>
956 void setVisualAndGesturalRhythmFromDuration(ELEMENT element, hum::HumNum visdur, hum::HumNum gesdur);
957 template <
class ELEMENT> hum::HumNum convertMensuralRhythm(ELEMENT element, hum::HTp token,
int subtoken = -1);
958 template <
class ELEMENT> hum::HumNum setDuration(ELEMENT element, hum::HumNum duration);
959 template <
class ELEMENT>
void setStaff(ELEMENT element,
int staffnum);
960 template <
class ELEMENT>
void setStaffBetween(ELEMENT element,
int staffnum);
961 template <
class ELEMENT>
void setN(ELEMENT element,
int nvalue, hum::HTp tok = NULL);
962 template <
class ELEMENT>
void assignAutomaticStem(ELEMENT element, hum::HTp tok,
int staffindex);
963 template <
class ELEMENT>
KeySig *getKeySig(ELEMENT element);
964 template <
class ELEMENT>
MeterSig *getMeterSig(ELEMENT element);
965 template <
class ELEMENT>
Clef *getClef(ELEMENT element);
966 template <
class ELEMENT>
Mensur *getMensur(ELEMENT element, hum::HTp token = NULL);
967 template <
class ELEMENT>
968 void insertPhrase(ELEMENT phrase, hum::HTp phrasestart, hum::HTp phraseend,
Measure *startmeasure,
969 std::vector<pair<int, int>> &endchordsorted, std::vector<std::pair<int, int>> &startchordsorted,
970 std::vector<pair<int, bool>> &phrasestartnoteinfo, std::vector<pair<int, bool>> &phraseendnoteinfo,
int ndex,
971 std::vector<std::vector<int>> &phraseindex,
int i,
int j, std::vector<int> &startpitches,
972 std::vector<int> &endpitches, std::vector<bool> &indexused);
973 template <
class ELEMENT>
void convertVerses(ELEMENT element, hum::HTp token);
974 template <
class ELEMENT>
975 void setTimeSig(ELEMENT element, hum::HTp timesigtok, hum::HTp metersigtok,
int staffindex);
976 template <
class ELEMENT>
void addChildBackMeasureOrSection(ELEMENT element);
977 template <
class ELEMENT>
void addChildMeasureOrSection(ELEMENT element,
Measure *measure = NULL);
978 template <
class CHILD>
979 void appendElement(
const std::vector<std::string> &name,
const std::vector<void *> &pointers, CHILD child);
980 void popElementStack(std::vector<std::string> &elements, std::vector<void *> &pointers);
981 template <
class ELEMENT>
982 void addTextElement(ELEMENT *element,
const std::string &content,
const std::string &fontstyle =
"",
983 bool addSpacer =
true,
const std::string &label =
"");
984 template <
class ELEMENT>
void addMusicSymbol(ELEMENT *element,
const std::string &musictext);
985 template <
class ELEMENT>
void checkForAutoStem(ELEMENT element, hum::HTp token);
986 template <
class ELEMENT>
void appendTypeTag(ELEMENT *element,
const std::string &tag);
987 template <
class ELEMENT>
void setPlaceRelStaff(ELEMENT *element,
const std::string &place,
bool showplace =
false);
988 template <
class ELEMENT>
void setPlaceRelEvent(ELEMENT *element,
const std::string &place,
bool showplace =
false);
989 template <
class ELEMENT>
990 void setMeterSymbol(ELEMENT *element,
const std::string &metersig,
int staffindex, hum::HTp partstart = NULL,
991 hum::HTp metertok = NULL);
992 template <
class ELEMENT>
993 void setMensurationSymbol(ELEMENT *element,
const std::string &metersig,
int staffindex, hum::HTp mensurtok = NULL);
994 template <
class ELEMENT>
995 void setInstrumentName(ELEMENT *staffdef,
const std::string &name, hum::HTp labeltok = NULL);
996 template <
class ELEMENT>
997 void setInstrumentAbbreviation(ELEMENT *staffdef,
const std::string &name, hum::HTp abbrtok);
998 template <
class ELEMENT>
void addDurRecip(ELEMENT element,
const std::string &ttoken);
999 template <
class ELEMENT>
void addFermata(ELEMENT *rest,
const std::string &tstring);
1000 template <
class ELEMENT>
void storeExpansionList(ELEMENT *parent, hum::HTp etok);
1001 template <
class ELEMENT>
void setWrittenAccidentalUpper(ELEMENT element,
const std::string &value);
1002 template <
class ELEMENT>
void setWrittenAccidentalLower(ELEMENT element,
const std::string &value);
1003 template <
class ELEMENT>
void attachToToken(ELEMENT *element, hum::HTp token);
1004 template <
class ELEMENT>
void setAttachmentType(ELEMENT *element, hum::HTp token);
1005 template <
class ELEMENT>
1006 void setFontsize(ELEMENT *element,
const std::string &percentage,
const std::string &original);
1007 template <
class ELEMENT>
void setTstamp(ELEMENT *element,
const string &value);
1008 template <
class ELEMENT>
void setEnclosure(ELEMENT *element,
const string &value);
1012 static void WriteUTF8(std::ostream &Out,
unsigned int Ch);
1013 static void UnquoteHTML(std::istream &In, std::ostream &Out);
1014 static hum::HumNum removeFactorsOfTwo(hum::HumNum value,
int &tcount,
int &bcount);
1015 static int getDotPowerOfTwo(hum::HumNum value);
1016 static int nextLowerPowerOfTwo(
int x);
1017 static hum::HumNum nextHigherPowerOfTwo(hum::HumNum x);
1018 static std::string getDateString();
1019 static bool replace(std::string &str,
const std::string &oldStr,
const std::string &newStr);
1020 static bool replace(std::u32string &str,
const std::u32string &oldStr,
const std::u32string &newStr);
1024 std::string m_filename;
1036 Score *m_score = NULL;
1039 std::vector<Section *> m_sections;
1042 std::string m_lastsection;
1055 std::vector<vrv::StaffDef *> m_staffdef;
1057 std::vector<vrv::Measure *> m_measures;
1066 int m_currentstaff = -1;
1075 std::vector<std::vector<std::vector<hum::HTp>>> m_layertokens;
1080 std::vector<hum::HTp> m_staffstarts;
1083 std::vector<int> m_rkern;
1086 hum::HumdrumFileSet m_infiles;
1089 std::vector<hum::HumNum> m_timesigdurs;
1092 hum::HumNum m_tupletscaling = 1;
1095 hum::HumNum m_omd = -1;
1098 std::vector<std::pair<int, hum::HTp>> m_oclef;
1101 std::vector<std::pair<int, hum::HTp>> m_omet;
1104 std::vector<std::pair<int, hum::HTp>> m_okey;
1107 std::vector<humaux::StaffStateVariables> m_staffstates;
1116 bool m_harm =
false;
1121 bool m_degree =
false;
1126 bool m_fing =
false;
1131 bool m_string =
false;
1136 bool m_mens =
false;
1147 std::vector<bool> m_fbstaff;
1152 std::vector<int> m_fbstates;
1155 bool m_setrightstem =
false;
1160 data_BARRENDITION m_leftbarstyle;
1168 std::vector<int> m_multirest;
1171 std::vector<hum::HTp> m_sectionlabels;
1174 std::vector<hum::HTp> m_numberlesslabels;
1177 int m_endingnum = 0;
1186 bool m_has_color_spine =
false;
1190 std::vector<std::vector<std::string>> m_spine_color;
1193 std::vector<int> m_transpose;
1197 bool m_show_cautionary_keysig =
false;
1200 bool m_hasTremolo =
false;
1209 std::vector<int> m_placement;
1216 std::vector<int> m_reverse;
1222 std::vector<int> m_absolute;
1228 std::vector<int> m_slash;
1231 bool m_breaks =
false;
1234 std::vector<bool> m_nulls;
1239 std::vector<hum::HumNum> m_duradj;
1243 std::vector<bool> m_ignore;
1246 std::vector<std::tuple<bool, hum::HumNum, Clef *>> m_clef_buffer;
1250 std::vector<Slur *> m_ftrem_slurs;
1253 std::map<int, std::string> m_group_name;
1256 std::map<int, hum::HTp> m_group_name_tok;
1259 std::map<int, std::string> m_group_abbr;
1262 std::map<int, hum::HTp> m_group_abbr_tok;
1265 std::vector<std::string> m_scordatura_marker;
1268 std::vector<hum::HumTransposer *> m_scordatura_transposition;
1272 int m_humtype =
false;
1276 std::vector<hum::HTp> m_beamSpanStartDatabase;
1279 double m_globalTempoScaling = 1.0;
1282 hum::HumNum m_localTempoScaling = 1;
1285 bool m_join =
false;
1288 double m_midibpm = 120.0;
1291 std::string m_textNoteSize =
"70%";
1295 std::string m_textAugmentationDotSpacer =
"\xe2\x80\x89";
1299 std::string m_textSmuflSpacer =
"\xc2\xa0";
1302 std::map<std::string, std::map<string, std::string>> m_layoutDefaultStyles;
1305 std::vector<hum::HumdrumLine *> m_humdrumLineReferences;
1306 std::map<std::string, std::vector<HumdrumReferenceItem>> m_references;
1307 pugi::xml_document m_simpleTitleDoc;
1308 pugi::xml_node m_simpleTitle;
1309 pugi::xml_document m_simpleComposersDoc;
1310 pugi::xml_document m_madsDoc;
1311 pugi::xml_node m_madsCollection;
1313 std::vector<string> m_standardHumdrumKeys = {
1417 #endif // __VRV_IOHUMDRUM_H__