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

[MusicXML] write bezier points for slurs #26568

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,30 @@ static String slurTieLineStyle(const SlurTie* s)
return rest;
}

static String slurBezier(const Slur* s, const bool start)
{
if (!ExportMusicXml::configuration()->exportLayout()) {
return String();
}

String rest;
const int spatium = s->spatium();
if (start) {
const SlurSegment* front = s->frontSegment();
const PointF start = front->ups(Grip::START).pos();
const PointF bezier = front->ups(Grip::BEZIER1).pos();
rest += String(u" bezier-x=\"%1\"").arg(10 * (bezier.x() - start.x()) / spatium);
rest += String(u" bezier-y=\"%1\"").arg(-10 * bezier.y() / spatium);
} else {
const SlurSegment* back = s->backSegment();
const PointF end = back->ups(Grip::END).pos();
const PointF bezier = back->ups(Grip::BEZIER2).pos();
rest += String(u" bezier-x=\"%1\"").arg(10 * (bezier.x() - end.x()) / spatium);
rest += String(u" bezier-y=\"%1\"").arg(-10 * bezier.y() / spatium);
}
return rest;
}

//---------------------------------------------------------
// findSlur -- get index of slur in slur table
// return -1 if not found
Expand Down Expand Up @@ -919,7 +943,7 @@ void SlurHandler::doSlurStart(const Slur* s, Notations& notations, XmlWriter& xm
String tagName = u"slur";
tagName += u" type=\"start\"";
tagName += slurTieLineStyle(s);
tagName += ExportMusicXml::positioningAttributes(s, true);
tagName += slurBezier(s, true);

if (i >= 0) {
// remove from list and print start
Expand Down Expand Up @@ -965,7 +989,7 @@ void SlurHandler::doSlurStop(const Slur* s, Notations& notations, XmlWriter& xml
m_started[i] = false;
notations.tag(xml, s);
String tagName = String(u"slur type=\"stop\" number=\"%1\"").arg(i + 1);
tagName += ExportMusicXml::positioningAttributes(s, false);
tagName += slurBezier(s, false);
xml.tagRaw(tagName);
} else {
LOGD("no free slur slot");
Expand All @@ -976,7 +1000,7 @@ void SlurHandler::doSlurStop(const Slur* s, Notations& notations, XmlWriter& xml
m_started[i] = false;
notations.tag(xml, s);
String tagName = String(u"slur type=\"stop\" number=\"%1\"").arg(i + 1);
tagName += ExportMusicXml::positioningAttributes(s, false);
tagName += slurBezier(s, false);
xml.tagRaw(tagName);
}
}
Expand Down
Loading