Skip to content

Commit

Permalink
MusicXML Import - Arpeggios don't have their color imported
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo-Schmitz committed Feb 14, 2025
1 parent ff3ffaa commit 00b3d50
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8473,6 +8473,10 @@ void MusicXmlParserNotations::arpeggio()
if (m_arpeggioNo == 0) {
m_arpeggioNo = 1;
}
Color color = Color::fromString(m_e.attribute("color"));
if (color.isValid()) {
m_arpeggioColor = color;
}
m_e.skipCurrentElement(); // skip but don't log
}

Expand Down Expand Up @@ -8592,8 +8596,8 @@ static void addGlissandoSlide(const Notation& notation, Note* note,
// addArpeggio
//---------------------------------------------------------

static void addArpeggio(ChordRest* cr, String& arpeggioType, int arpeggioNo, ArpeggioMap& arpMap,
DelayedArpMap& delayedArps)
static void addArpeggio(ChordRest* cr, String& arpeggioType, int arpeggioNo, Color arpeggioColor,
ArpeggioMap& arpMap, DelayedArpMap& delayedArps)
{
if (cr->isRest() && !arpeggioType.empty()) {
// If the arpeggio is attached to a rest, store to add to the next available chord
Expand Down Expand Up @@ -8638,6 +8642,9 @@ static void addArpeggio(ChordRest* cr, String& arpeggioType, int arpeggioNo, Arp
} else if (arpeggioType == "non-arpeggiate") {
arpeggio->setArpeggioType(ArpeggioType::BRACKET);
}
if (arpeggioColor.isValid()) {
arpeggio->setColor(arpeggioColor);
}
// there can be only one
if (!(static_cast<Chord*>(cr))->arpeggio()) {
cr->add(arpeggio);
Expand Down Expand Up @@ -9038,7 +9045,7 @@ void MusicXmlParserNotations::addToScore(ChordRest* const cr, Note* const note,
std::vector<Note*>& unendedTieNotes, ArpeggioMap& arpMap,
DelayedArpMap& delayedArps)
{
addArpeggio(cr, m_arpeggioType, m_arpeggioNo, arpMap, delayedArps);
addArpeggio(cr, m_arpeggioType, m_arpeggioNo, m_arpeggioColor, arpMap, delayedArps);
addWavyLine(cr, Fraction::fromTicks(tick), m_wavyLineNo, m_wavyLineType, spanners, trills, m_logger, &m_e);

for (const Notation& notation : m_notations) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ class MusicXmlParserNotations
int m_wavyLineNo = 0;
muse::String m_arpeggioType;
int m_arpeggioNo = 0;
muse::draw::Color m_arpeggioColor;
bool m_slurStop = false;
bool m_slurStart = false;
bool m_wavyLineStop = false;
Expand Down
3 changes: 3 additions & 0 deletions src/importexport/musicxml/tests/data/testColors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@
<stem>down</stem>
<notehead color="#9437FF">normal</notehead>
<beam number="1" color="#FF0000">begin</beam>
<notations>
<arpeggiate number="1" color="#FF0000"/>
</notations>
</note>
<note>
<pitch>
Expand Down

0 comments on commit 00b3d50

Please sign in to comment.