Skip to content

Commit

Permalink
fix #239826 by ignoring lyrics on grace notes
Browse files Browse the repository at this point in the history
  • Loading branch information
lvinken authored and lasconic committed Aug 16, 2017
1 parent 9375add commit 437001d
Show file tree
Hide file tree
Showing 5 changed files with 342 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mscore/importmxmlpass2.cpp
Expand Up @@ -4503,8 +4503,15 @@ Note* MusicXMLParserPass2::note(const QString& partId,
while (_e.tokenType() == QXmlStreamReader::StartElement) {

//qDebug("in second loop element '%s'", qPrintable(_e.name().toString()));
if (_e.name() == "lyric")
lyric(numberedLyrics, defaultyLyrics, unNumberedLyrics, extendedLyrics); // TODO: move track handling to addlyric
if (_e.name() == "lyric") {
// lyrics on grace notes not (yet) supported by MuseScore
if (!grace)
lyric(numberedLyrics, defaultyLyrics, unNumberedLyrics, extendedLyrics); // TODO: move track handling to addlyric
else {
logDebugInfo("ignoring lyrics on grace notes");
skipLogCurrElem();
}
}
else if (_e.name() == "notations")
notations(note, cr, noteStartTime.ticks(), tupletDesc, lastGraceAFter);
else
Expand Down
Binary file added mtest/musicxml/io/testLyrics1.pdf
Binary file not shown.
175 changes: 175 additions & 0 deletions mtest/musicxml/io/testLyrics1.xml
@@ -0,0 +1,175 @@
<?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-number>MuseScore testfile</work-number>
<work-title>Lyrics 1</work-title>
</work>
<identification>
<creator type="composer">Leon Vinken</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>
<miscellaneous>
<miscellaneous-field name="description">
Test lyrics on normal and grace notes, with and without extension line.
As MuseScore does not support lyrics on grace notes, lyrics number three
and five will be missing.
Furthermore, this file crashes some MuseScore versions (2.1, master
of about July 2017).
</miscellaneous-field>
</miscellaneous>
</identification>
<part-list>
<score-part id="P1">
<part-name>Music</part-name>
<score-instrument id="P1-I1">
<instrument-name>Music</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>4</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
<lyric number="1">
<syllabic>single</syllabic>
<text>Lyr1</text>
</lyric>
</note>
</measure>
<measure number="2">
<note>
<pitch>
<step>C</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
<lyric number="1">
<syllabic>single</syllabic>
<text>lyr2</text>
<extend/>
</lyric>
</note>
<note>
<pitch>
<step>C</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
</note>
</measure>
<measure number="3">
<note>
<grace slash="yes"/>
<pitch>
<step>D</step>
<octave>4</octave>
</pitch>
<voice>1</voice>
<type>eighth</type>
<stem>up</stem>
<lyric number="1">
<syllabic>single</syllabic>
<text>lyr3</text>
</lyric>
</note>
<note>
<pitch>
<step>C</step>
<octave>4</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
<lyric number="1">
<syllabic>single</syllabic>
<text>lyr4</text>
</lyric>
</note>
</measure>
<measure number="4">
<note>
<grace slash="yes"/>
<pitch>
<step>D</step>
<octave>4</octave>
</pitch>
<voice>1</voice>
<type>eighth</type>
<stem>up</stem>
<lyric number="1">
<syllabic>single</syllabic>
<text>lyr5</text>
<extend/>
</lyric>
</note>
<note>
<pitch>
<step>C</step>
<octave>4</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
</note>
</measure>
<measure number="5">
<note>
<pitch>
<step>C</step>
<octave>4</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
<lyric number="1">
<syllabic>single</syllabic>
<text>lyr6</text>
</lyric>
</note>
<barline location="right">
<bar-style>light-heavy</bar-style>
</barline>
</measure>
</part>
</score-partwise>
157 changes: 157 additions & 0 deletions mtest/musicxml/io/testLyrics1_ref.xml
@@ -0,0 +1,157 @@
<?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-number>MuseScore testfile</work-number>
<work-title>Lyrics 1</work-title>
</work>
<identification>
<creator type="composer">Leon Vinken</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>Music</part-name>
<score-instrument id="P1-I1">
<instrument-name>Music</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>4</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
<lyric number="1">
<syllabic>single</syllabic>
<text>Lyr1</text>
</lyric>
</note>
</measure>
<measure number="2">
<note>
<pitch>
<step>C</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
<lyric number="1">
<syllabic>single</syllabic>
<text>lyr2</text>
<extend/>
</lyric>
</note>
<note>
<pitch>
<step>C</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
</note>
</measure>
<measure number="3">
<note>
<grace slash="yes"/>
<pitch>
<step>D</step>
<octave>4</octave>
</pitch>
<voice>1</voice>
<type>eighth</type>
<stem>up</stem>
</note>
<note>
<pitch>
<step>C</step>
<octave>4</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
<lyric number="1">
<syllabic>single</syllabic>
<text>lyr4</text>
</lyric>
</note>
</measure>
<measure number="4">
<note>
<grace slash="yes"/>
<pitch>
<step>D</step>
<octave>4</octave>
</pitch>
<voice>1</voice>
<type>eighth</type>
<stem>up</stem>
</note>
<note>
<pitch>
<step>C</step>
<octave>4</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
</note>
</measure>
<measure number="5">
<note>
<pitch>
<step>C</step>
<octave>4</octave>
</pitch>
<duration>4</duration>
<voice>1</voice>
<type>whole</type>
<lyric number="1">
<syllabic>single</syllabic>
<text>lyr6</text>
</lyric>
</note>
<barline location="right">
<bar-style>light-heavy</bar-style>
</barline>
</measure>
</part>
</score-partwise>
1 change: 1 addition & 0 deletions mtest/musicxml/io/tst_mxml_io.cpp
Expand Up @@ -104,6 +104,7 @@ private slots:
void keysig2() { mxmlIoTest("testKeysig2"); }
void lines1() { mxmlIoTest("testLines1"); }
void lines2() { mxmlIoTest("testLines2"); }
void lyrics1() { mxmlIoTestRef("testLyrics1"); }
void lyricsVoice2a() { mxmlIoTest("testLyricsVoice2a"); }
void lyricsVoice2b() { mxmlIoTestRef("testLyricsVoice2b"); }
void manualBreaks() { mxmlIoTest("testManualBreaks"); }
Expand Down

0 comments on commit 437001d

Please sign in to comment.