From 246b0c7fb99e64e2788b6e3f44553cb9c2c5486f Mon Sep 17 00:00:00 2001 From: Danielku15 Date: Sat, 15 Feb 2020 18:50:26 +0100 Subject: [PATCH 1/2] Added crescendo/decrescendo parsing to alphaTex --- .../AlphaTab.Test/Importer/AlphaTexImporterTest.cs | 10 ++++++++++ Source/AlphaTab/Importer/AlphaTexImporter.cs | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Source/AlphaTab.Test/Importer/AlphaTexImporterTest.cs b/Source/AlphaTab.Test/Importer/AlphaTexImporterTest.cs index 6d58f1582..3cf4042c1 100644 --- a/Source/AlphaTab.Test/Importer/AlphaTexImporterTest.cs +++ b/Source/AlphaTab.Test/Importer/AlphaTexImporterTest.cs @@ -967,5 +967,15 @@ public void TestDynamics() } + [TestMethod] + public void TestCrescendo() + { + var tex = @"1.1.4{dec} 1.1{dec} 1.1{cre} 1.1{cre}"; + var score = ParseTex(tex); + Assert.AreEqual(CrescendoType.Decrescendo, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Crescendo); + Assert.AreEqual(CrescendoType.Decrescendo, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].Crescendo); + Assert.AreEqual(CrescendoType.Crescendo, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[2].Crescendo); + Assert.AreEqual(CrescendoType.Crescendo, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[3].Crescendo); + } } } diff --git a/Source/AlphaTab/Importer/AlphaTexImporter.cs b/Source/AlphaTab/Importer/AlphaTexImporter.cs index 427bcf006..e2c3d5405 100644 --- a/Source/AlphaTab/Importer/AlphaTexImporter.cs +++ b/Source/AlphaTab/Importer/AlphaTexImporter.cs @@ -1535,6 +1535,20 @@ private bool ApplyBeatEffect(Beat beat) return true; } + if (syData == "cre") + { + beat.Crescendo = CrescendoType.Crescendo; + NewSy(); + return true; + } + + if (syData == "dec") + { + beat.Crescendo = CrescendoType.Decrescendo; + NewSy(); + return true; + } + if (syData == "tp") { NewSy(); From 3c77552f83bc9ddaf67984e33046d4f681177d71 Mon Sep 17 00:00:00 2001 From: Danielku15 Date: Sat, 15 Feb 2020 18:55:00 +0100 Subject: [PATCH 2/2] Added docs for crescendo --- Documentation/input/alphatex/beat-effects.cshtml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/input/alphatex/beat-effects.cshtml b/Documentation/input/alphatex/beat-effects.cshtml index 2371165df..d16c89bb1 100644 --- a/Documentation/input/alphatex/beat-effects.cshtml +++ b/Documentation/input/alphatex/beat-effects.cshtml @@ -6,7 +6,7 @@ TexSample: true

There are various effects that can be applied to a beat. All beat effects are specified in braces after the beat. - Beat{Effects} + Beat{Effects} Multiple effects are simple separated by spaces like 3.3 {f v}

Simple Effects

@@ -48,6 +48,9 @@ TexSample: true | // tremolo picking (`tp duration` where duration can be 8,16 or 32) 3.3{tp 8} 3.3{tp 16} 3.3{tp 32} +| +// Crescendo / Decrescendo +3.3{cre} 3.3{cre} 3.3{dec} 3.3{dec}