Skip to content

Commit

Permalink
Merge pull request #2336 from AntonioBL/finaleCompatibility
Browse files Browse the repository at this point in the history
Improve compatibility with two-notes tremolos from Finale MusicXML im…
  • Loading branch information
lasconic committed Jan 10, 2016
2 parents b8f9558 + 2fe37be commit dde2ef2
Show file tree
Hide file tree
Showing 5 changed files with 253 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mscore/exportxml.cpp
Expand Up @@ -2256,6 +2256,8 @@ static int determineTupletNormalTicks(ChordRest const* const chord)
for (int i = 1; i < t->elements().size(); ++i)
if (t->elements().at(0)->duration().ticks() != t->elements().at(i)->duration().ticks())
return t->baseLen().ticks();
if (t->elements().size() != t->ratio().numerator())
return t->baseLen().ticks();
return 0;
}

Expand Down Expand Up @@ -2539,6 +2541,10 @@ void ExportMusicXml::chord(Chord* chord, int staff, const QList<Lyrics*>* ll, bo
}
if (rightParenthesis && leftParenthesis)
noteheadTagname += " parentheses=\"yes\"";
if (note->headType() == NoteHead::Type::HEAD_QUARTER)
noteheadTagname += " filled=\"yes\"";
else if ((note->headType() == NoteHead::Type::HEAD_HALF) || (note->headType() == NoteHead::Type::HEAD_WHOLE))
noteheadTagname += " filled=\"no\"";
if (note->headGroup() == NoteHead::Group::HEAD_SLASH)
xml.tag(noteheadTagname, "slash");
else if (note->headGroup() == NoteHead::Group::HEAD_TRIANGLE)
Expand Down Expand Up @@ -2567,6 +2573,8 @@ void ExportMusicXml::chord(Chord* chord, int staff, const QList<Lyrics*>* ll, bo
xml.tag(noteheadTagname, "normal");
else if (rightParenthesis && leftParenthesis)
xml.tag(noteheadTagname, "normal");
else if (note->headType() != NoteHead::Type::HEAD_AUTO)
xml.tag(noteheadTagname, "normal");

// LVIFIX: check move() handling
if (staff)
Expand Down
7 changes: 7 additions & 0 deletions mscore/importmxmlpass2.cpp
Expand Up @@ -4011,6 +4011,7 @@ Note* MusicXMLParserPass2::note(const QString& partId,
NoteHead::Group headGroup = NoteHead::Group::HEAD_NORMAL;
QColor noteheadColor = QColor::Invalid;
bool noteheadParentheses = false;
QString noteheadFilled;
int velocity = round(_e.attributes().value("dynamics").toDouble() * 0.9);
bool graceSlash = false;
bool printObject = _e.attributes().value("print-object") != "no";
Expand Down Expand Up @@ -4053,6 +4054,7 @@ Note* MusicXMLParserPass2::note(const QString& partId,
else if (_e.name() == "notehead") {
noteheadColor.setNamedColor(_e.attributes().value("color").toString());
noteheadParentheses = _e.attributes().value("parentheses") == "yes";
noteheadFilled = _e.attributes().value("filled").toString();
headGroup = convertNotehead(_e.readElementText());
}
else if (_e.name() == "pitch")
Expand Down Expand Up @@ -4298,6 +4300,11 @@ Note* MusicXMLParserPass2::note(const QString& partId,
_score->addElement(s);
}

if (noteheadFilled == "no")
note->setHeadType(NoteHead::Type::HEAD_HALF);
else if (noteheadFilled == "yes")
note->setHeadType(NoteHead::Type::HEAD_QUARTER);

if (velocity > 0) {
note->setVeloType(Note::ValueType::USER_VAL);
note->setVeloOffset(velocity);
Expand Down
Binary file added mtest/musicxml/io/testNoteheadsFilled.pdf
Binary file not shown.
237 changes: 237 additions & 0 deletions mtest/musicxml/io/testNoteheadsFilled.xml
@@ -0,0 +1,237 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise>
<work>
<work-title>Title</work-title>
</work>
<identification>
<creator type="composer">Composer</creator>
<encoding>
<software>MuseScore 0.7.0</software>
<encoding-date>2007-09-10</encoding-date>
<supports element="accidental" type="yes"/>
<supports element="beam" type="yes"/>
<supports element="print" attribute="new-page" type="no"/>
<supports element="print" attribute="new-system" type="no"/>
<supports element="stem" type="yes"/>
</encoding>
</identification>
<part-list>
<score-part id="P1">
<part-name>Piano</part-name>
<score-instrument id="P1-I1">
<instrument-name>Piano</instrument-name>
</score-instrument>
<midi-device id="P1-I1" port="1"></midi-device>
<midi-instrument id="P1-I1">
<midi-channel>1</midi-channel>
<midi-program>1</midi-program>
<volume>78.7402</volume>
<pan>0</pan>
</midi-instrument>
</score-part>
</part-list>
<part id="P1">
<measure number="1">
<attributes>
<divisions>1</divisions>
<key>
<fifths>0</fifths>
</key>
<time>
<beats>4</beats>
<beat-type>4</beat-type>
</time>
<clef>
<sign>G</sign>
<line>2</line>
</clef>
</attributes>
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>32nd</type>
<time-modification>
<actual-notes>1</actual-notes>
<normal-notes>8</normal-notes>
<normal-type>16th</normal-type>
</time-modification>
<stem>down</stem>
<notehead filled="no">normal</notehead>
<beam number="1">begin</beam>
<beam number="2">begin</beam>
<beam number="3">begin</beam>
<notations>
<tuplet type="start" bracket="no" show-number="none"/>
</notations>
</note>
<note>
<pitch>
<step>E</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>32nd</type>
<time-modification>
<actual-notes>1</actual-notes>
<normal-notes>8</normal-notes>
<normal-type>16th</normal-type>
</time-modification>
<stem>down</stem>
<notehead filled="no">normal</notehead>
<beam number="1">end</beam>
<beam number="2">end</beam>
<beam number="3">end</beam>
<notations>
<tuplet type="stop"/>
</notations>
</note>
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>16th</type>
<time-modification>
<actual-notes>1</actual-notes>
<normal-notes>4</normal-notes>
<normal-type>eighth</normal-type>
</time-modification>
<stem>down</stem>
<notehead filled="no">normal</notehead>
<beam number="1">begin</beam>
<beam number="2">begin</beam>
<notations>
<tuplet type="start" bracket="no" show-number="none"/>
</notations>
</note>
<note>
<pitch>
<step>E</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>16th</type>
<time-modification>
<actual-notes>1</actual-notes>
<normal-notes>4</normal-notes>
<normal-type>eighth</normal-type>
</time-modification>
<stem>down</stem>
<notehead filled="no">normal</notehead>
<beam number="1">end</beam>
<beam number="2">end</beam>
<notations>
<tuplet type="stop"/>
</notations>
</note>
</measure>
<measure number="2">
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>eighth</type>
<time-modification>
<actual-notes>1</actual-notes>
<normal-notes>2</normal-notes>
<normal-type>quarter</normal-type>
</time-modification>
<stem>down</stem>
<notehead filled="no">normal</notehead>
<beam number="1">begin</beam>
<notations>
<tuplet type="start" bracket="no" show-number="none"/>
</notations>
</note>
<note>
<pitch>
<step>E</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>eighth</type>
<time-modification>
<actual-notes>1</actual-notes>
<normal-notes>2</normal-notes>
<normal-type>quarter</normal-type>
</time-modification>
<stem>down</stem>
<notehead filled="no">normal</notehead>
<beam number="1">end</beam>
<notations>
<tuplet type="stop"/>
</notations>
</note>
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
<notehead>do</notehead>
</note>
<note>
<pitch>
<step>E</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
<notehead>diamond</notehead>
</note>
</measure>
<measure number="3">
<note>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>down</stem>
</note>
<note>
<chord/>
<pitch>
<step>E</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>down</stem>
<notehead filled="yes">normal</notehead>
</note>
<note>
<pitch>
<step>E</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>down</stem>
<notehead filled="yes">normal</notehead>
</note>
</measure>
</part>
</score-partwise>
1 change: 1 addition & 0 deletions mtest/musicxml/io/tst_mxml_io.cpp
Expand Up @@ -118,6 +118,7 @@ private slots:
void noteAttributes3() { mxmlIoTest("testNoteAttributes3"); }
void noteheadParentheses() { mxmlIoTest("testNoteheadParentheses"); }
void noteheads() { mxmlIoTest("testNoteheads"); }
void noteheadsFilled() { mxmlIoTest("testNoteheadsFilled"); }
void notesRests1() { mxmlIoTest("testNotesRests1"); }
void notesRests2() { mxmlIoTest("testNotesRests2"); }
void numberedLyrics() { mxmlIoTestRef("testNumberedLyrics"); }
Expand Down

0 comments on commit dde2ef2

Please sign in to comment.