fix #301340: dynamic playback after repeats does not match with score

This commit is contained in:
James Thistlewood 2020-02-19 19:09:37 +00:00
parent 6bea8e24ae
commit 0dcbf2af0f
5 changed files with 603 additions and 3 deletions

View file

@ -314,6 +314,7 @@ static void collectNote(EventMap* events, int channel, const Note* note, qreal v
// Get the velocity used for this note from the staff
// This allows correct playback of tremolos even without SND enabled.
int velo;
Fraction nonUnwoundTick = Fraction::fromTicks(on - tickOffset);
if (config.useSND) {
switch (config.method) {
case DynamicsRenderMethod::FIXED_MAX:
@ -321,12 +322,12 @@ static void collectNote(EventMap* events, int channel, const Note* note, qreal v
break;
case DynamicsRenderMethod::SEG_START:
default:
velo = staff->velocities().val(Fraction::fromTicks(on));
velo = staff->velocities().val(nonUnwoundTick);
break;
}
}
else {
velo = staff->velocities().val(Fraction::fromTicks(on));
velo = staff->velocities().val(nonUnwoundTick);
}
velo *= velocityMultiplier;

View file

@ -0,0 +1,122 @@
Tick = 0 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 0 Type = 176 Pitch = 2 Velocity = 112 Channel = 0
Tick = 0 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 0 Type = 3 Pitch = 0 Velocity = 127 Channel = 0
Tick = 455 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 479 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 480 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 480 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 480 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 935 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 959 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 960 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 960 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 960 Type = 4 Pitch = 0 Velocity = 127 Channel = 0
Tick = 1415 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 1439 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 1440 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 1440 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 1440 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 1895 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 1919 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 1920 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 1920 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 1920 Type = 3 Pitch = 0 Velocity = 127 Channel = 0
Tick = 2375 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 2399 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 2400 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 2400 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 2400 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 2855 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 2879 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 2880 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 2880 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 2880 Type = 4 Pitch = 0 Velocity = 127 Channel = 0
Tick = 3335 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 3359 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 3360 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 3360 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 3360 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 3815 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 3839 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 3840 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 3840 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 3840 Type = 3 Pitch = 0 Velocity = 127 Channel = 0
Tick = 4295 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 4319 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 4320 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 4320 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 4320 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 4775 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 4799 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 4800 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 4800 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 4800 Type = 4 Pitch = 0 Velocity = 127 Channel = 0
Tick = 5255 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 5279 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 5280 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 5280 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 5280 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 5735 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 5759 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 5760 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 5760 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 5760 Type = 3 Pitch = 0 Velocity = 127 Channel = 0
Tick = 6215 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 6239 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 6240 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 6240 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 6240 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 6695 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 6719 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 6720 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 6720 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 6720 Type = 4 Pitch = 0 Velocity = 127 Channel = 0
Tick = 7175 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 7199 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 7200 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 7200 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 7200 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 7655 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 7679 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 7680 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 7680 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 7680 Type = 3 Pitch = 0 Velocity = 127 Channel = 0
Tick = 8135 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 8159 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 8160 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 8160 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 8160 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 8615 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 8639 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 8640 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 8640 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 8640 Type = 4 Pitch = 0 Velocity = 127 Channel = 0
Tick = 9095 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 9119 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 9120 Type = 144 Pitch = 66 Velocity = 112 Channel = 0
Tick = 9120 Type = 144 Pitch = 62 Velocity = 112 Channel = 1
Tick = 9120 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 9575 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 9599 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 9600 Type = 176 Pitch = 2 Velocity = 49 Channel = 0
Tick = 9600 Type = 144 Pitch = 66 Velocity = 49 Channel = 0
Tick = 9600 Type = 144 Pitch = 62 Velocity = 49 Channel = 1
Tick = 9600 Type = 3 Pitch = 0 Velocity = 127 Channel = 0
Tick = 10055 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 10079 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 10080 Type = 144 Pitch = 66 Velocity = 49 Channel = 0
Tick = 10080 Type = 144 Pitch = 62 Velocity = 49 Channel = 1
Tick = 10080 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 10535 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 10559 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 10560 Type = 144 Pitch = 66 Velocity = 49 Channel = 0
Tick = 10560 Type = 144 Pitch = 62 Velocity = 49 Channel = 1
Tick = 10560 Type = 4 Pitch = 0 Velocity = 127 Channel = 0
Tick = 11015 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 11039 Type = 144 Pitch = 66 Velocity = 0 Channel = 0
Tick = 11040 Type = 144 Pitch = 66 Velocity = 49 Channel = 0
Tick = 11040 Type = 144 Pitch = 62 Velocity = 49 Channel = 1
Tick = 11040 Type = 4 Pitch = 0 Velocity = 80 Channel = 0
Tick = 11495 Type = 144 Pitch = 62 Velocity = 0 Channel = 1
Tick = 11519 Type = 144 Pitch = 66 Velocity = 0 Channel = 0

View file

@ -0,0 +1,476 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="3.01">
<programVersion>3.5.0</programVersion>
<programRevision>3543170</programRevision>
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<pageWidth>8.27</pageWidth>
<pageHeight>11.69</pageHeight>
<pagePrintableWidth>7.4826</pagePrintableWidth>
<Spatium>1.76389</Spatium>
</Style>
<showInvisible>1</showInvisible>
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<metaTag name="arranger"></metaTag>
<metaTag name="composer"></metaTag>
<metaTag name="copyright"></metaTag>
<metaTag name="creationDate">2020-02-19</metaTag>
<metaTag name="lyricist"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
<metaTag name="platform">Linux</metaTag>
<metaTag name="poet"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="translator"></metaTag>
<metaTag name="workNumber"></metaTag>
<metaTag name="workTitle">repeats</metaTag>
<Part>
<Staff id="1">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
<defaultClef>F</defaultClef>
</Staff>
<trackName>Trombone</trackName>
<Instrument>
<longName>Trombone</longName>
<shortName>Tbn.</shortName>
<trackName>Trombone</trackName>
<minPitchP>36</minPitchP>
<maxPitchP>74</maxPitchP>
<minPitchA>40</minPitchA>
<maxPitchA>71</maxPitchA>
<instrumentId>brass.trombone</instrumentId>
<clef>F</clef>
<Articulation>
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="staccatissimo">
<velocity>100</velocity>
<gateTime>33</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="portato">
<velocity>100</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="marcato">
<velocity>120</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>150</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="sforzatoStaccato">
<velocity>150</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="marcatoStaccato">
<velocity>120</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="marcatoTenuto">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<controller ctrl="0" value="0"/>
<controller ctrl="32" value="17"/>
<program value="57"/>
<synti>Fluid</synti>
</Channel>
</Instrument>
</Part>
<Part>
<Staff id="2">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
</Staff>
<trackName>Piano</trackName>
<Instrument>
<longName>Piano</longName>
<shortName>Pno.</shortName>
<trackName>Piano</trackName>
<minPitchP>21</minPitchP>
<maxPitchP>108</maxPitchP>
<minPitchA>21</minPitchA>
<maxPitchA>108</maxPitchA>
<instrumentId>keyboard.piano</instrumentId>
<clef staff="2">F</clef>
<Articulation>
<velocity>100</velocity>
<gateTime>95</gateTime>
</Articulation>
<Articulation name="staccatissimo">
<velocity>100</velocity>
<gateTime>33</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="portato">
<velocity>100</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="marcato">
<velocity>120</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>150</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="sforzatoStaccato">
<velocity>150</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="marcatoStaccato">
<velocity>120</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="marcatoTenuto">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="0"/>
<synti>Fluid</synti>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<VBox>
<height>10</height>
<Text>
<style>Title</style>
<text>repeats</text>
</Text>
</VBox>
<!-- Measure 1 -->
<Measure>
<endRepeat>2</endRepeat>
<voice>
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
</TimeSig>
<Dynamic>
<subtype>ff</subtype>
<velocity>112</velocity>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
<Note>
<Accidental>
<subtype>accidentalSharp</subtype>
</Accidental>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
</voice>
</Measure>
<!-- Measure 2 -->
<Measure>
<startRepeat/>
<endRepeat>2</endRepeat>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<Accidental>
<subtype>accidentalSharp</subtype>
</Accidental>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
</voice>
</Measure>
<!-- Measure 3 -->
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<Accidental>
<subtype>accidentalSharp</subtype>
</Accidental>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
</voice>
</Measure>
<!-- Measure 4 -->
<Measure>
<voice>
<Dynamic>
<subtype>p</subtype>
<velocity>49</velocity>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
<Note>
<Accidental>
<subtype>accidentalSharp</subtype>
</Accidental>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>66</pitch>
<tpc>20</tpc>
</Note>
</Chord>
</voice>
</Measure>
</Staff>
<Staff id="2">
<!-- Measure 1 -->
<Measure>
<voice>
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
</TimeSig>
<Dynamic>
<subtype>ff</subtype>
<velocity>112</velocity>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
</voice>
</Measure>
<!-- Measure 2 -->
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
</voice>
</Measure>
<!-- Measure 3 -->
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
</voice>
</Measure>
<!-- Measure 4 -->
<Measure>
<voice>
<Dynamic>
<subtype>p</subtype>
<velocity>49</velocity>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
</voice>
</Measure>
</Staff>
</Score>
</museScore>

View file

@ -143,6 +143,7 @@ void TestMidi::events_data()
QTest::newRow("testGuitarTrem") << "testGuitarTrem";
QTest::newRow("testPlayArticulation") << "testPlayArticulation";
QTest::newRow("testTremoloDynamics") << "testTremoloDynamics";
QTest::newRow("testRepeatsDynamics") << "testRepeatsDynamics";
}
//---------------------------------------------------------
@ -511,7 +512,7 @@ void TestMidi::midiTimeStretchFermataTempoEditContinuousView()
}
//---------------------------------------------------------
// midiTimeStretchFermata
// midiSingleNoteDynamics
//---------------------------------------------------------
void TestMidi::midiSingleNoteDynamics()