Skip to content
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

fix pedal import/export for MusicXML #20224

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/importexport/musicxml/internal/musicxml/exportxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5159,12 +5159,12 @@ void ExportMusicXml::pedal(Pedal const* const pd, staff_idx_t staff, const Fract
pedalType = "change";
break;
case HookType::NONE:
pedalType = "resume";
pedalType = pd->lineVisible() ? "resume" : "start";
break;
default:
pedalType = "start";
}
signText = pd->beginText() == "" ? " sign=\"no\"" : " sign=\"yes\"";
signText = pd->beginText().isEmpty() ? " sign=\"no\"" : " sign=\"yes\"";
} else {
if (!pd->endText().isEmpty() || pd->endHookType() == HookType::HOOK_90) {
pedalType = "stop";
Expand All @@ -5173,7 +5173,7 @@ void ExportMusicXml::pedal(Pedal const* const pd, staff_idx_t staff, const Fract
}
// "change" type is handled only on the beginning of pedal lines

signText = pd->endText() == "" ? " sign=\"no\"" : " sign=\"yes\"";
signText = pd->endText().isEmpty() ? " sign=\"no\"" : " sign=\"yes\"";
}
pedalXml = QString("pedal type=\"%1\"").arg(pedalType);
pedalXml += lineText;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3552,6 +3552,8 @@ void MusicXMLParserDirection::pedal(const QString& type, const int /* number */,
p->setBeginText(u"<sym>keyboardPedalPed</sym>");
p->setContinueText(u"(<sym>keyboardPedalPed</sym>)");
} else {
p->setBeginText(u"");
p->setContinueText(u"");
p->setBeginHookType(type == "resume" ? HookType::NONE : HookType::HOOK_90);
}
p->setEndHookType(HookType::NONE);
Expand Down Expand Up @@ -3596,6 +3598,10 @@ void MusicXMLParserDirection::pedal(const QString& type, const int /* number */,
} else {
p->setLineVisible(false);
}
if (sign == "no") {
p->setBeginText(u"");
p->setContinueText(u"");
}
if (color.isValid()) {
p->setColor(color);
}
Expand Down
4 changes: 2 additions & 2 deletions src/importexport/musicxml/tests/data/testDirections1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<measure number="2">
<direction placement="above">
<direction-type>
<pedal type="resume" line="no" sign="yes"/>
<pedal type="start" line="no" sign="yes"/>
</direction-type>
</direction>
<note>
Expand Down Expand Up @@ -132,7 +132,7 @@
</note>
<direction placement="below">
<direction-type>
<pedal type="resume" line="no" sign="yes"/>
<pedal type="start" line="no" sign="yes"/>
</direction-type>
</direction>
<note>
Expand Down
4 changes: 2 additions & 2 deletions src/importexport/musicxml/tests/data/testDirections1_ref.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<measure number="2">
<direction placement="above">
<direction-type>
<pedal type="resume" line="no" sign="yes"/>
<pedal type="start" line="no" sign="yes"/>
</direction-type>
</direction>
<note>
Expand Down Expand Up @@ -132,7 +132,7 @@
</note>
<direction placement="below">
<direction-type>
<pedal type="resume" line="no" sign="yes"/>
<pedal type="start" line="no" sign="yes"/>
</direction-type>
</direction>
<note>
Expand Down
Loading