-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XML ottava fixes #24776
Open
miiizen
wants to merge
4
commits into
musescore:master
Choose a base branch
from
miiizen:xml-ottavas
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+502
−108
Open
XML ottava fixes #24776
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2196,10 +2196,11 @@ void MusicXMLParserPass2::part() | |
// Clean up unterminated ties | ||
for (auto tie : m_ties) { | ||
if (tie.second) { | ||
cleanupUnterminatedTie(tie.second, m_score, m_pass1.exporterString().contains(u"dolet 6")); | ||
cleanupUnterminatedTie(tie.second, m_score, m_pass1.exporterSoftware() == MusicXMLExporterSoftware::DOLET6); | ||
m_ties[tie.first] = nullptr; | ||
} | ||
} | ||
|
||
m_ties.clear(); | ||
|
||
if (m_hasDrumset) { | ||
|
@@ -3213,7 +3214,7 @@ void MusicXMLParserDirection::direction(const String& partId, | |
bool isVocalStaff = m_pass1.isVocalStaff(partId); | ||
bool isPercussionStaff = m_pass1.isPercussionStaff(partId); | ||
bool isExpressionText = false; | ||
bool delayOttava = m_pass1.exporterString().contains(u"sibelius"); | ||
bool delayOttava = m_pass1.exporterSoftware() == MusicXMLExporterSoftware::SIBELIUS; | ||
m_systemDirection = m_e.attribute("system") == "only-top"; | ||
//LOGD("direction track %d", track); | ||
std::vector<MusicXmlSpannerDesc> starts; | ||
|
@@ -3520,19 +3521,23 @@ void MusicXMLParserDirection::direction(const String& partId, | |
delete desc.sp; | ||
} else { | ||
if (spdesc.isStarted) { | ||
// Adjustments to ottavas by the offset value are unwanted | ||
const Fraction spTick = spdesc.sp && spdesc.sp->isOttava() ? tick : tick + m_offset; | ||
if (spdesc.sp && spdesc.sp->isOttava() && delayOttava) { | ||
// Sibelius writes ottava ends 1 note too early | ||
m_pass2.setDelayedOttava(spdesc.sp); | ||
m_pass2.delayedOttava()->setTrack2(m_track); | ||
m_pass2.delayedOttava()->setTick2(tick + m_offset); | ||
m_pass2.delayedOttava()->setTick2(spTick); | ||
// need to set tick again later | ||
m_pass2.clearSpanner(desc); | ||
} else { | ||
handleSpannerStop(spdesc.sp, m_track, tick + m_offset, spanners); | ||
handleSpannerStop(spdesc.sp, m_track, spTick, spanners); | ||
m_pass2.clearSpanner(desc); | ||
} | ||
} else { | ||
spdesc.sp = desc.sp; | ||
spdesc.tick2 = tick + m_offset; | ||
const Fraction spTick = spdesc.sp && spdesc.sp->isOttava() ? tick : tick + m_offset; | ||
spdesc.tick2 = spTick; | ||
spdesc.track2 = m_track; | ||
spdesc.isStopped = true; | ||
} | ||
|
@@ -3876,7 +3881,7 @@ void MusicXMLParserDirection::otherDirection() | |
// TODO: Multiple sets of maps for exporters other than Dolet 6/Sibelius | ||
// TODO: Add more symbols from Sibelius | ||
std::map<String, String> otherDirectionStrings; | ||
if (m_pass1.exporterString().contains(u"dolet")) { | ||
if (m_pass1.dolet()) { | ||
otherDirectionStrings = { | ||
{ String(u"To Coda"), String(u"To Coda") }, | ||
{ String(u"Segno"), String(u"<sym>segno</sym>") }, | ||
|
@@ -4114,7 +4119,7 @@ void MusicXMLParserDirection::textToDynamic(String& text) | |
} | ||
String simplifiedText = MScoreTextToMXML::toPlainText(text).simplified(); | ||
// Correct finale's incorrect dynamic export | ||
if (m_pass1.exporterString().contains(u"finale")) { | ||
if (m_pass1.exporterSoftware() == MusicXMLExporterSoftware::FINALE) { | ||
static const std::map<String, | ||
String> finaleDynamicSubs | ||
= { { u"π", u"pp" }, { u"P", u"mp" }, { u"F", u"mf" }, { u"ƒ", u"ff" }, { u"Ï", u"fff" }, { u"S", u"sf" }, { u"ß", u"sfz" }, | ||
|
@@ -4515,7 +4520,7 @@ void MusicXMLParserDirection::handleTempo(String& wordsString) | |
}; | ||
|
||
MetronomeTextMap textMap; | ||
if (m_pass1.exporterString().contains(u"sibelius")) { | ||
if (m_pass1.sibOrDolet()) { | ||
textMap = sibeliusSyms; | ||
} else if (m_fontFamily == u"MetTimes Plain") { | ||
textMap = metTimesSyms; | ||
|
@@ -4822,19 +4827,22 @@ void MusicXMLParserDirection::octaveShift(const String& type, const int number, | |
} else { | ||
Ottava* o = spdesc.isStopped ? toOttava(spdesc.sp) : Factory::createOttava(m_score->dummy()); | ||
|
||
// if (placement.empty()) placement = "above"; // TODO ? set default | ||
|
||
if (type == u"down" && ottavasize == 8) { | ||
o->setOttavaType(OttavaType::OTTAVA_8VA); | ||
} | ||
if (type == u"down" && ottavasize == 15) { | ||
o->setOttavaType(OttavaType::OTTAVA_15MA); | ||
} | ||
if (type == u"up" && ottavasize == 8) { | ||
o->setOttavaType(OttavaType::OTTAVA_8VB); | ||
if (type == u"down") { | ||
m_placement = m_placement.empty() ? u"above" : m_placement; | ||
if (ottavasize == 8) { | ||
o->setOttavaType(OttavaType::OTTAVA_8VA); | ||
} else if (ottavasize == 15) { | ||
o->setOttavaType(OttavaType::OTTAVA_15MA); | ||
} | ||
} | ||
if (type == u"up" && ottavasize == 15) { | ||
o->setOttavaType(OttavaType::OTTAVA_15MB); | ||
|
||
if (type == u"up") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wouldn#t this rather be |
||
m_placement = m_placement.empty() ? u"below" : m_placement; | ||
if (ottavasize == 8) { | ||
o->setOttavaType(OttavaType::OTTAVA_8VB); | ||
} else if (ottavasize == 15) { | ||
o->setOttavaType(OttavaType::OTTAVA_15MB); | ||
} | ||
} | ||
|
||
const Color color = Color::fromString(m_e.asciiAttribute("color").ascii()); | ||
|
@@ -6550,7 +6558,7 @@ Note* MusicXMLParserPass2::note(const String& partId, | |
String noteheadValue = m_e.readText(); | ||
if (noteheadValue == "none") { | ||
hasHead = false; | ||
} else if (noteheadValue == "named" && m_pass1.exporterString().contains(u"noteflight")) { | ||
} else if (noteheadValue == "named" && m_pass1.exporterSoftware() == MusicXMLExporterSoftware::NOTEFLIGHT) { | ||
headScheme = NoteHeadScheme::HEAD_PITCHNAME; | ||
} else { | ||
headGroup = convertNotehead(noteheadValue); | ||
|
@@ -6847,7 +6855,8 @@ Note* MusicXMLParserPass2::note(const String& partId, | |
Notation notation = Notation(u"tied"); | ||
const String type2 = u"type"; | ||
notation.addAttribute(type2, tieType); | ||
addTie(notation, m_score, note, cr->track(), m_ties, m_logger, &m_e, m_pass1.exporterString().contains(u"dolet 6")); | ||
addTie(notation, m_score, note, cr->track(), m_ties, m_logger, &m_e, | ||
m_pass1.exporterSoftware() == MusicXMLExporterSoftware::DOLET6); | ||
} | ||
} | ||
|
||
|
@@ -7449,7 +7458,7 @@ void MusicXMLParserPass2::harmony(const String& partId, Measure* measure, const | |
|
||
const HarmonyDesc newHarmonyDesc(track, ha, fd); | ||
bool insert = true; | ||
if (m_pass1.exporterString().contains(u"dolet")) { | ||
if (m_pass1.sibOrDolet()) { | ||
const int ticks = (sTime + offset).ticks(); | ||
for (auto itr = harmonyMap.begin(); itr != harmonyMap.end(); itr++) { | ||
if (itr->first != ticks) { | ||
|
@@ -8689,7 +8698,8 @@ void MusicXMLParserNotations::addToScore(ChordRest* const cr, Note* const note, | |
} else if (note && (notation.name() == "glissando" || notation.name() == "slide")) { | ||
addGlissandoSlide(notation, note, glissandi, spanners, m_logger, &m_e); | ||
} else if (note && notation.name() == "tied") { | ||
addTie(notation, m_score, note, cr->track(), ties, m_logger, &m_e, m_pass1.exporterString().contains(u"dolet 6")); | ||
addTie(notation, m_score, note, cr->track(), ties, m_logger, &m_e, | ||
m_pass1.exporterSoftware() == MusicXMLExporterSoftware::DOLET6); | ||
} else if (note && notation.parent() == "technical") { | ||
addTechnical(notation, note); | ||
} else { | ||
|
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not reuse
dolet()
here?