Skip to content

Commit 26e443c

Browse files
committed
Merge pull request #2600 from lvinken/107936-divisions-too-late
fix #107936 - [MusicXML] crash when divisions is defined in second me…
2 parents 9ff12be + 4005c79 commit 26e443c

9 files changed

+451
-4
lines changed

mscore/importmxmlpass1.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,8 +2765,11 @@ void MusicXMLParserPass1::note(const QString& partId,
27652765
dura = calcDura; // overrule dura
27662766
}
27672767
}
2768-
else
2769-
errorStr = "calculated and specified duration invalid";
2768+
else {
2769+
errorStr = "calculated and specified duration invalid, using 4/4";
2770+
dura = Fraction(4, 4);
2771+
}
2772+
27702773
if (errorStr != "")
27712774
logError(errorStr);
27722775

mscore/importmxmlpass2.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4199,8 +4199,11 @@ Note* MusicXMLParserPass2::note(const QString& partId,
41994199
dura = calcDura; // overrule dura
42004200
}
42014201
}
4202-
else
4203-
errorStr = "calculated and specified duration invalid";
4202+
else {
4203+
errorStr = "calculated and specified duration invalid, using 4/4";
4204+
dura = Fraction(4, 4);
4205+
}
4206+
42044207
if (errorStr != "")
42054208
logError(errorStr);
42064209

9.58 KB
Binary file not shown.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
3+
<score-partwise>
4+
<work>
5+
<work-number>MuseScore testfile</work-number>
6+
<work-title>Divisions defined too late 1</work-title>
7+
</work>
8+
<identification>
9+
<creator type="composer">Leon Vinken</creator>
10+
<encoding>
11+
<software>MuseScore 0.7.0</software>
12+
<encoding-date>2007-09-10</encoding-date>
13+
<supports element="accidental" type="yes"/>
14+
<supports element="beam" type="yes"/>
15+
<supports element="print" attribute="new-page" type="no"/>
16+
<supports element="print" attribute="new-system" type="no"/>
17+
<supports element="stem" type="yes"/>
18+
</encoding>
19+
<miscellaneous>
20+
<miscellaneous-field name="description">
21+
Logic Pro X may export notes before duration is defined.
22+
This happens when a part starts with a whole measure rest.
23+
Attributes are exported in the first non-rest measure.
24+
MuseScore will convert the whole measure to a four quarter rest.
25+
Note that by reading further ahead, it could be concluded
26+
that three quarters are actually needed.
27+
</miscellaneous-field>
28+
</miscellaneous>
29+
</identification>
30+
<part-list>
31+
<score-part id="P1">
32+
<part-name>Piano</part-name>
33+
<part-abbreviation>Pno.</part-abbreviation>
34+
<score-instrument id="P1-I1">
35+
<instrument-name>Piano</instrument-name>
36+
</score-instrument>
37+
<midi-device id="P1-I1" port="1"></midi-device>
38+
<midi-instrument id="P1-I1">
39+
<midi-channel>1</midi-channel>
40+
<midi-program>1</midi-program>
41+
<volume>78.7402</volume>
42+
<pan>0</pan>
43+
</midi-instrument>
44+
</score-part>
45+
</part-list>
46+
<part id="P1">
47+
<measure number="1">
48+
<note>
49+
<rest/>
50+
<duration>3</duration>
51+
<voice>1</voice>
52+
</note>
53+
</measure>
54+
<measure number="2">
55+
<attributes>
56+
<divisions>1</divisions>
57+
<key>
58+
<fifths>-3</fifths>
59+
</key>
60+
<time>
61+
<beats>3</beats>
62+
<beat-type>4</beat-type>
63+
</time>
64+
<clef>
65+
<sign>G</sign>
66+
<line>2</line>
67+
</clef>
68+
</attributes>
69+
<note>
70+
<pitch>
71+
<step>G</step>
72+
<octave>4</octave>
73+
</pitch>
74+
<duration>3</duration>
75+
<voice>1</voice>
76+
<type>half</type>
77+
<dot/>
78+
<stem>up</stem>
79+
</note>
80+
</measure>
81+
</part>
82+
</score-partwise>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
3+
<score-partwise>
4+
<work>
5+
<work-number>MuseScore testfile</work-number>
6+
<work-title>Divisions defined too late 1</work-title>
7+
</work>
8+
<identification>
9+
<creator type="composer">Leon Vinken</creator>
10+
<encoding>
11+
<software>MuseScore 0.7.0</software>
12+
<encoding-date>2007-09-10</encoding-date>
13+
<supports element="accidental" type="yes"/>
14+
<supports element="beam" type="yes"/>
15+
<supports element="print" attribute="new-page" type="no"/>
16+
<supports element="print" attribute="new-system" type="no"/>
17+
<supports element="stem" type="yes"/>
18+
</encoding>
19+
</identification>
20+
<part-list>
21+
<score-part id="P1">
22+
<part-name>Piano</part-name>
23+
<part-abbreviation>Pno.</part-abbreviation>
24+
<score-instrument id="P1-I1">
25+
<instrument-name>Piano</instrument-name>
26+
</score-instrument>
27+
<midi-device id="P1-I1" port="1"></midi-device>
28+
<midi-instrument id="P1-I1">
29+
<midi-channel>1</midi-channel>
30+
<midi-program>1</midi-program>
31+
<volume>78.7402</volume>
32+
<pan>0</pan>
33+
</midi-instrument>
34+
</score-part>
35+
</part-list>
36+
<part id="P1">
37+
<measure number="1">
38+
<attributes>
39+
<divisions>1</divisions>
40+
<key>
41+
<fifths>0</fifths>
42+
</key>
43+
<clef>
44+
<sign>G</sign>
45+
<line>2</line>
46+
</clef>
47+
</attributes>
48+
<note>
49+
<rest/>
50+
<duration>4</duration>
51+
<voice>1</voice>
52+
</note>
53+
</measure>
54+
<measure number="2">
55+
<attributes>
56+
<key>
57+
<fifths>-3</fifths>
58+
</key>
59+
<time>
60+
<beats>3</beats>
61+
<beat-type>4</beat-type>
62+
</time>
63+
<clef>
64+
<sign>G</sign>
65+
<line>2</line>
66+
</clef>
67+
</attributes>
68+
<note>
69+
<pitch>
70+
<step>G</step>
71+
<octave>4</octave>
72+
</pitch>
73+
<duration>3</duration>
74+
<voice>1</voice>
75+
<type>half</type>
76+
<dot/>
77+
<stem>up</stem>
78+
</note>
79+
</measure>
80+
</part>
81+
</score-partwise>
9.95 KB
Binary file not shown.
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
3+
<score-partwise>
4+
<work>
5+
<work-number>MuseScore testfile</work-number>
6+
<work-title>Divisions defined too late 2</work-title>
7+
</work>
8+
<identification>
9+
<creator type="composer">Leon Vinken</creator>
10+
<encoding>
11+
<software>MuseScore 0.7.0</software>
12+
<encoding-date>2007-09-10</encoding-date>
13+
<supports element="accidental" type="yes"/>
14+
<supports element="beam" type="yes"/>
15+
<supports element="print" attribute="new-page" type="no"/>
16+
<supports element="print" attribute="new-system" type="no"/>
17+
<supports element="stem" type="yes"/>
18+
</encoding>
19+
<miscellaneous>
20+
<miscellaneous-field name="description">
21+
Logic Pro X may export notes before duration is defined.
22+
This happens when a part starts with a whole measure rest.
23+
Attributes are exported in the first non-rest measure.
24+
MuseScore will convert the whole measure to a four quarter rest.
25+
Note that by reading further ahead, it could be concluded
26+
that two quarters are actually needed.
27+
</miscellaneous-field>
28+
</miscellaneous>
29+
</identification>
30+
<part-list>
31+
<part-group type="start" number="1">
32+
<group-symbol>bracket</group-symbol>
33+
</part-group>
34+
<score-part id="P1">
35+
<part-name>Soprano</part-name>
36+
<score-instrument id="P1-I1">
37+
<instrument-name>Soprano</instrument-name>
38+
</score-instrument>
39+
<midi-device id="P1-I1" port="1"></midi-device>
40+
<midi-instrument id="P1-I1">
41+
<midi-channel>1</midi-channel>
42+
<midi-program>53</midi-program>
43+
<volume>78.7402</volume>
44+
<pan>0</pan>
45+
</midi-instrument>
46+
</score-part>
47+
<score-part id="P2">
48+
<part-name>Tenor</part-name>
49+
<score-instrument id="P2-I1">
50+
<instrument-name>Tenor</instrument-name>
51+
</score-instrument>
52+
<midi-device id="P2-I1" port="1"></midi-device>
53+
<midi-instrument id="P2-I1">
54+
<midi-channel>2</midi-channel>
55+
<midi-program>53</midi-program>
56+
<volume>78.7402</volume>
57+
<pan>0</pan>
58+
</midi-instrument>
59+
</score-part>
60+
<part-group type="stop" number="1"/>
61+
</part-list>
62+
<part id="P1">
63+
<measure number="1">
64+
<note>
65+
<rest/>
66+
<duration>2</duration>
67+
<voice>1</voice>
68+
</note>
69+
</measure>
70+
<measure number="2">
71+
<attributes>
72+
<divisions>1</divisions>
73+
<key>
74+
<fifths>0</fifths>
75+
</key>
76+
<time>
77+
<beats>2</beats>
78+
<beat-type>4</beat-type>
79+
</time>
80+
<clef>
81+
<sign>G</sign>
82+
<line>2</line>
83+
</clef>
84+
</attributes>
85+
<note>
86+
<pitch>
87+
<step>G</step>
88+
<octave>4</octave>
89+
</pitch>
90+
<duration>2</duration>
91+
<voice>1</voice>
92+
<type>half</type>
93+
<stem>up</stem>
94+
</note>
95+
</measure>
96+
</part>
97+
<part id="P2">
98+
<measure number="1">
99+
<attributes>
100+
<divisions>1</divisions>
101+
<key>
102+
<fifths>0</fifths>
103+
</key>
104+
<time>
105+
<beats>2</beats>
106+
<beat-type>4</beat-type>
107+
</time>
108+
<clef>
109+
<sign>F</sign>
110+
<line>4</line>
111+
</clef>
112+
</attributes>
113+
<note>
114+
<pitch>
115+
<step>G</step>
116+
<octave>3</octave>
117+
</pitch>
118+
<duration>2</duration>
119+
<voice>1</voice>
120+
<type>half</type>
121+
<stem>down</stem>
122+
</note>
123+
</measure>
124+
<measure number="2">
125+
<note>
126+
<pitch>
127+
<step>G</step>
128+
<octave>3</octave>
129+
</pitch>
130+
<duration>2</duration>
131+
<voice>1</voice>
132+
<type>half</type>
133+
<stem>down</stem>
134+
</note>
135+
</measure>
136+
</part>
137+
</score-partwise>

0 commit comments

Comments
 (0)