Skip to content

Commit 2e47e8a

Browse files
committed
Merge pull request #1049 from shredpub/27846-bettersolution
Fixing 27841 and 27846
2 parents d389ab2 + ebeba97 commit 2e47e8a

File tree

6 files changed

+958
-4
lines changed

6 files changed

+958
-4
lines changed

libmscore/rendermidi.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,18 @@ void Score::renderStaff(EventMap* events, Staff* staff)
567567

568568
void Score::swingAdjustParams(Chord* chord, int& gateTime, int& ontime, int swingUnit, int swingRatio)
569569
{
570-
int tick = chord->tick();
570+
int tick = chord->rtick();
571+
// adjust for anacrusis
572+
Measure* cm = chord->measure();
573+
MeasureBase* pm = cm->prev();
574+
Element::Type pt = pm ? pm->type() : Element::Type::INVALID;
575+
if (!pm || pm->lineBreak() || pm->pageBreak() || pm->sectionBreak()
576+
|| pt == Element::Type::VBOX || pt == Element::Type::HBOX
577+
|| pt == Element::Type::FBOX || pt == Element::Type::TBOX) {
578+
int offset = (cm->timesig() - cm->len()).ticks();
579+
if (offset > 0)
580+
tick += offset;
581+
}
571582
int swingBeat = swingUnit * 2;
572583
qreal ticksDuration = (qreal)chord->actualTicks();
573584
qreal swingTickAdjust = ((qreal)swingBeat) * (((qreal)(swingRatio-50))/100.0);
@@ -593,9 +604,10 @@ void Score::swingAdjustParams(Chord* chord, int& gateTime, int& ontime, int swin
593604

594605
bool Score::isSubdivided(ChordRest* chord, int swingUnit)
595606
{
607+
if (!chord)
608+
return false;
596609
ChordRest* prev = prevChordRest(chord);
597-
598-
if (chord->actualTicks() < swingUnit || prev->actualTicks() < swingUnit)
610+
if (chord->actualTicks() < swingUnit || (prev && prev->actualTicks() < swingUnit))
599611
return true;
600612
else
601613
return false;
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Tick = 0 Type = 144 Pitch = 72 Velocity = 80 Channel = 0
2+
Tick = 0 Type = 3 Pitch = 0 Velocity = 0 Channel = 0
3+
Tick = 240 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
4+
Tick = 287 Type = 144 Pitch = 72 Velocity = 0 Channel = 0
5+
Tick = 288 Type = 144 Pitch = 71 Velocity = 80 Channel = 0
6+
Tick = 479 Type = 144 Pitch = 71 Velocity = 0 Channel = 0
7+
Tick = 480 Type = 144 Pitch = 69 Velocity = 80 Channel = 0
8+
Tick = 480 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
9+
Tick = 720 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
10+
Tick = 767 Type = 144 Pitch = 69 Velocity = 0 Channel = 0
11+
Tick = 768 Type = 144 Pitch = 67 Velocity = 80 Channel = 0
12+
Tick = 959 Type = 144 Pitch = 67 Velocity = 0 Channel = 0
13+
Tick = 960 Type = 144 Pitch = 65 Velocity = 80 Channel = 0
14+
Tick = 960 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
15+
Tick = 1200 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
16+
Tick = 1247 Type = 144 Pitch = 65 Velocity = 0 Channel = 0
17+
Tick = 1248 Type = 144 Pitch = 64 Velocity = 80 Channel = 0
18+
Tick = 1439 Type = 144 Pitch = 64 Velocity = 0 Channel = 0
19+
Tick = 1440 Type = 144 Pitch = 62 Velocity = 80 Channel = 0
20+
Tick = 1440 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
21+
Tick = 1680 Type = 144 Pitch = 60 Velocity = 80 Channel = 0
22+
Tick = 1680 Type = 3 Pitch = 0 Velocity = 0 Channel = 0
23+
Tick = 1727 Type = 144 Pitch = 62 Velocity = 0 Channel = 0
24+
Tick = 1920 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
25+
Tick = 1967 Type = 144 Pitch = 60 Velocity = 0 Channel = 0
26+
Tick = 1968 Type = 144 Pitch = 62 Velocity = 80 Channel = 0
27+
Tick = 2159 Type = 144 Pitch = 62 Velocity = 0 Channel = 0
28+
Tick = 2160 Type = 144 Pitch = 64 Velocity = 80 Channel = 0
29+
Tick = 2160 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
30+
Tick = 2400 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
31+
Tick = 2447 Type = 144 Pitch = 64 Velocity = 0 Channel = 0
32+
Tick = 2448 Type = 144 Pitch = 65 Velocity = 80 Channel = 0
33+
Tick = 2639 Type = 144 Pitch = 65 Velocity = 0 Channel = 0
34+
Tick = 2640 Type = 144 Pitch = 67 Velocity = 80 Channel = 0
35+
Tick = 2640 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
36+
Tick = 2880 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
37+
Tick = 2927 Type = 144 Pitch = 67 Velocity = 0 Channel = 0
38+
Tick = 2928 Type = 144 Pitch = 69 Velocity = 80 Channel = 0
39+
Tick = 3119 Type = 144 Pitch = 69 Velocity = 0 Channel = 0
40+
Tick = 3120 Type = 144 Pitch = 71 Velocity = 80 Channel = 0
41+
Tick = 3120 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
42+
Tick = 3360 Type = 144 Pitch = 72 Velocity = 80 Channel = 0
43+
Tick = 3360 Type = 3 Pitch = 0 Velocity = 0 Channel = 0
44+
Tick = 3407 Type = 144 Pitch = 71 Velocity = 0 Channel = 0
45+
Tick = 3600 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
46+
Tick = 3647 Type = 144 Pitch = 72 Velocity = 0 Channel = 0
47+
Tick = 3648 Type = 144 Pitch = 71 Velocity = 80 Channel = 0
48+
Tick = 3839 Type = 144 Pitch = 71 Velocity = 0 Channel = 0
49+
Tick = 3840 Type = 144 Pitch = 69 Velocity = 80 Channel = 0
50+
Tick = 3840 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
51+
Tick = 4080 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
52+
Tick = 4127 Type = 144 Pitch = 69 Velocity = 0 Channel = 0
53+
Tick = 4128 Type = 144 Pitch = 67 Velocity = 80 Channel = 0
54+
Tick = 4319 Type = 144 Pitch = 67 Velocity = 0 Channel = 0
55+
Tick = 4320 Type = 144 Pitch = 65 Velocity = 80 Channel = 0
56+
Tick = 4320 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
57+
Tick = 4560 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
58+
Tick = 4607 Type = 144 Pitch = 65 Velocity = 0 Channel = 0
59+
Tick = 4608 Type = 144 Pitch = 64 Velocity = 80 Channel = 0
60+
Tick = 4799 Type = 144 Pitch = 64 Velocity = 0 Channel = 0
61+
Tick = 4800 Type = 144 Pitch = 62 Velocity = 80 Channel = 0
62+
Tick = 4800 Type = 4 Pitch = 0 Velocity = 0 Channel = 0
63+
Tick = 5087 Type = 144 Pitch = 62 Velocity = 0 Channel = 0
Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<museScore version="1.24">
3+
<programVersion>2.0.0</programVersion>
4+
<programRevision>8cc66dd</programRevision>
5+
<Score>
6+
<LayerTag id="0" tag="default"></LayerTag>
7+
<currentLayer>0</currentLayer>
8+
<Synthesizer>
9+
</Synthesizer>
10+
<Division>480</Division>
11+
<Style>
12+
<figuredBassFontFamily>MScoreBC</figuredBassFontFamily>
13+
<beamMinLen>1.32</beamMinLen>
14+
<beamNoSlope>0</beamNoSlope>
15+
<swingUnit>240</swingUnit>
16+
<page-layout>
17+
<page-height>1584</page-height>
18+
<page-width>1224</page-width>
19+
<page-margins type="even">
20+
<left-margin>56.6929</left-margin>
21+
<right-margin>90.1417</right-margin>
22+
<top-margin>56.6929</top-margin>
23+
<bottom-margin>113.386</bottom-margin>
24+
</page-margins>
25+
<page-margins type="odd">
26+
<left-margin>56.6929</left-margin>
27+
<right-margin>90.1417</right-margin>
28+
<top-margin>56.6929</top-margin>
29+
<bottom-margin>113.386</bottom-margin>
30+
</page-margins>
31+
</page-layout>
32+
<Spatium>1.76389</Spatium>
33+
</Style>
34+
<showInvisible>1</showInvisible>
35+
<showUnprintable>1</showUnprintable>
36+
<showFrames>1</showFrames>
37+
<showMargins>0</showMargins>
38+
<metaTag name="arranger"></metaTag>
39+
<metaTag name="composer"></metaTag>
40+
<metaTag name="copyright"></metaTag>
41+
<metaTag name="creationDate">2014-07-17</metaTag>
42+
<metaTag name="lyricist"></metaTag>
43+
<metaTag name="movementNumber"></metaTag>
44+
<metaTag name="movementTitle"></metaTag>
45+
<metaTag name="platform">Linux</metaTag>
46+
<metaTag name="poet"></metaTag>
47+
<metaTag name="source"></metaTag>
48+
<metaTag name="translator"></metaTag>
49+
<metaTag name="workNumber"></metaTag>
50+
<metaTag name="workTitle"></metaTag>
51+
<PageList>
52+
<Page>
53+
<System>
54+
</System>
55+
</Page>
56+
</PageList>
57+
<Part>
58+
<Staff id="1">
59+
<StaffType group="pitched">
60+
<name>Standard</name>
61+
</StaffType>
62+
<bracket type="-1" span="0"/>
63+
</Staff>
64+
<trackName>B♭ Trumpet</trackName>
65+
<Instrument>
66+
<longName pos="0">B♭ Trumpet</longName>
67+
<shortName pos="0">B♭ Tpt.</shortName>
68+
<trackName>B♭ Trumpet</trackName>
69+
<minPitchP>52</minPitchP>
70+
<maxPitchP>85</maxPitchP>
71+
<minPitchA>52</minPitchA>
72+
<maxPitchA>80</maxPitchA>
73+
<transposeDiatonic>-1</transposeDiatonic>
74+
<transposeChromatic>-2</transposeChromatic>
75+
<Articulation>
76+
<velocity>100</velocity>
77+
<gateTime>100</gateTime>
78+
</Articulation>
79+
<Articulation name="staccato">
80+
<velocity>100</velocity>
81+
<gateTime>50</gateTime>
82+
</Articulation>
83+
<Articulation name="tenuto">
84+
<velocity>100</velocity>
85+
<gateTime>100</gateTime>
86+
</Articulation>
87+
<Articulation name="sforzato">
88+
<velocity>120</velocity>
89+
<gateTime>100</gateTime>
90+
</Articulation>
91+
<Channel>
92+
<program value="56"/>
93+
<synti>Fluid</synti>
94+
</Channel>
95+
<Channel name="mute">
96+
<program value="59"/>
97+
<synti>Fluid</synti>
98+
</Channel>
99+
</Instrument>
100+
</Part>
101+
<Staff id="1">
102+
<Measure number="1">
103+
<Clef>
104+
<concertClefType>G</concertClefType>
105+
<transposingClefType>G</transposingClefType>
106+
</Clef>
107+
<KeySig>
108+
<accidental>2</accidental>
109+
</KeySig>
110+
<TimeSig>
111+
<sigN>7</sigN>
112+
<sigD>8</sigD>
113+
<showCourtesySig>1</showCourtesySig>
114+
</TimeSig>
115+
<Chord>
116+
<durationType>eighth</durationType>
117+
<Note>
118+
<pitch>72</pitch>
119+
<tpc>14</tpc>
120+
<tpc2>16</tpc2>
121+
</Note>
122+
</Chord>
123+
<Chord>
124+
<durationType>eighth</durationType>
125+
<Note>
126+
<pitch>71</pitch>
127+
<tpc>19</tpc>
128+
<tpc2>21</tpc2>
129+
</Note>
130+
</Chord>
131+
<Chord>
132+
<durationType>eighth</durationType>
133+
<Note>
134+
<pitch>69</pitch>
135+
<tpc>17</tpc>
136+
<tpc2>19</tpc2>
137+
</Note>
138+
</Chord>
139+
<Chord>
140+
<durationType>eighth</durationType>
141+
<Note>
142+
<pitch>67</pitch>
143+
<tpc>15</tpc>
144+
<tpc2>17</tpc2>
145+
</Note>
146+
</Chord>
147+
<Chord>
148+
<durationType>eighth</durationType>
149+
<Note>
150+
<pitch>65</pitch>
151+
<tpc>13</tpc>
152+
<tpc2>15</tpc2>
153+
</Note>
154+
</Chord>
155+
<Chord>
156+
<durationType>eighth</durationType>
157+
<Note>
158+
<pitch>64</pitch>
159+
<tpc>18</tpc>
160+
<tpc2>20</tpc2>
161+
</Note>
162+
</Chord>
163+
<Chord>
164+
<durationType>eighth</durationType>
165+
<Note>
166+
<pitch>62</pitch>
167+
<tpc>16</tpc>
168+
<tpc2>18</tpc2>
169+
</Note>
170+
</Chord>
171+
<BarLine>
172+
<subtype>normal</subtype>
173+
<span>1</span>
174+
</BarLine>
175+
</Measure>
176+
<Measure number="2">
177+
<Chord>
178+
<durationType>eighth</durationType>
179+
<Note>
180+
<pitch>60</pitch>
181+
<tpc>14</tpc>
182+
<tpc2>16</tpc2>
183+
</Note>
184+
</Chord>
185+
<Chord>
186+
<durationType>eighth</durationType>
187+
<Note>
188+
<pitch>62</pitch>
189+
<tpc>16</tpc>
190+
<tpc2>18</tpc2>
191+
</Note>
192+
</Chord>
193+
<Chord>
194+
<durationType>eighth</durationType>
195+
<Note>
196+
<pitch>64</pitch>
197+
<tpc>18</tpc>
198+
<tpc2>20</tpc2>
199+
</Note>
200+
</Chord>
201+
<Chord>
202+
<durationType>eighth</durationType>
203+
<Note>
204+
<pitch>65</pitch>
205+
<tpc>13</tpc>
206+
<tpc2>15</tpc2>
207+
</Note>
208+
</Chord>
209+
<Chord>
210+
<durationType>eighth</durationType>
211+
<Note>
212+
<pitch>67</pitch>
213+
<tpc>15</tpc>
214+
<tpc2>17</tpc2>
215+
</Note>
216+
</Chord>
217+
<Chord>
218+
<durationType>eighth</durationType>
219+
<Note>
220+
<pitch>69</pitch>
221+
<tpc>17</tpc>
222+
<tpc2>19</tpc2>
223+
</Note>
224+
</Chord>
225+
<Chord>
226+
<durationType>eighth</durationType>
227+
<Note>
228+
<pitch>71</pitch>
229+
<tpc>19</tpc>
230+
<tpc2>21</tpc2>
231+
</Note>
232+
</Chord>
233+
<BarLine>
234+
<subtype>normal</subtype>
235+
<span>1</span>
236+
</BarLine>
237+
</Measure>
238+
<Measure number="3">
239+
<Chord>
240+
<durationType>eighth</durationType>
241+
<Note>
242+
<pitch>72</pitch>
243+
<tpc>14</tpc>
244+
<tpc2>16</tpc2>
245+
</Note>
246+
</Chord>
247+
<Chord>
248+
<durationType>eighth</durationType>
249+
<Note>
250+
<pitch>71</pitch>
251+
<tpc>19</tpc>
252+
<tpc2>21</tpc2>
253+
</Note>
254+
</Chord>
255+
<Chord>
256+
<durationType>eighth</durationType>
257+
<Note>
258+
<pitch>69</pitch>
259+
<tpc>17</tpc>
260+
<tpc2>19</tpc2>
261+
</Note>
262+
</Chord>
263+
<Chord>
264+
<durationType>eighth</durationType>
265+
<Note>
266+
<pitch>67</pitch>
267+
<tpc>15</tpc>
268+
<tpc2>17</tpc2>
269+
</Note>
270+
</Chord>
271+
<Chord>
272+
<durationType>eighth</durationType>
273+
<Note>
274+
<pitch>65</pitch>
275+
<tpc>13</tpc>
276+
<tpc2>15</tpc2>
277+
</Note>
278+
</Chord>
279+
<Chord>
280+
<durationType>eighth</durationType>
281+
<Note>
282+
<pitch>64</pitch>
283+
<tpc>18</tpc>
284+
<tpc2>20</tpc2>
285+
</Note>
286+
</Chord>
287+
<Chord>
288+
<durationType>eighth</durationType>
289+
<Note>
290+
<pitch>62</pitch>
291+
<tpc>16</tpc>
292+
<tpc2>18</tpc2>
293+
</Note>
294+
</Chord>
295+
<BarLine>
296+
<subtype>end</subtype>
297+
<span>1</span>
298+
</BarLine>
299+
</Measure>
300+
</Staff>
301+
</Score>
302+
</museScore>

0 commit comments

Comments
 (0)