Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Source/AlphaTab.Test/Importer/AlphaTexImporterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,28 @@ public void TestDynamicsAuto()
Assert.AreEqual(DynamicValue.MP, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[3].Dynamics);
}

[TestMethod]
public void TestDynamicsAutoResetOnTrack()
{
var tex = @"1.1.4{dy ppp} 1.1 \track ""Second"" 1.1.4";
var score = ParseTex(tex);
Assert.AreEqual(DynamicValue.PPP, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Dynamics);
Assert.AreEqual(DynamicValue.PPP, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].Dynamics);

Assert.AreEqual(DynamicValue.F, score.Tracks[1].Staves[0].Bars[0].Voices[0].Beats[0].Dynamics);
}

[TestMethod]
public void TestDynamicsAutoResetOnStaff()
{
var tex = @"1.1.4{dy ppp} 1.1 \staff 1.1.4";
var score = ParseTex(tex);
Assert.AreEqual(DynamicValue.PPP, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Dynamics);
Assert.AreEqual(DynamicValue.PPP, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].Dynamics);

Assert.AreEqual(DynamicValue.F, score.Tracks[0].Staves[1].Bars[0].Voices[0].Beats[0].Dynamics);
}


[TestMethod]
public void TestCrescendo()
Expand Down
2 changes: 2 additions & 0 deletions Source/AlphaTab/Importer/AlphaTexImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ private void NewTrack()

_score.AddTrack(_currentTrack);
_lyrics[_currentTrack.Index] = new FastList<Lyrics>();
_currentDynamics = DynamicValue.F;
}

/// <summary>
Expand Down Expand Up @@ -1021,6 +1022,7 @@ private void TrackStaffMeta()
_currentTrack.EnsureStaveCount(_currentTrack.Staves.Count + 1);

_currentStaff = _currentTrack.Staves[_currentTrack.Staves.Count - 1];
_currentDynamics = DynamicValue.F;
}

StaffProperties();
Expand Down