Merge pull request #437 from paulfd/default-attack-release

Default attack release
This commit is contained in:
Paul Ferrand 2020-09-23 14:47:01 +02:00 committed by GitHub
commit 6f3422a172
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 1 deletions

View file

@ -231,6 +231,7 @@ namespace Default
constexpr float delayEG { 0 };
constexpr float hold { 0 };
constexpr float release { 0 };
constexpr float ampegRelease { 0.001 }; // Default release to avoid clicks
constexpr float vel2release { 0.0f };
constexpr float start { 0.0 };
constexpr float sustain { 100.0 };

View file

@ -50,6 +50,9 @@ struct Region {
gainToEffect.reserve(5); // sufficient room for main and fx1-4
gainToEffect.push_back(1.0); // contribute 100% into the main bus
// Default amplitude release
amplitudeEG.release = Default::ampegRelease;
}
Region(const Region&) = default;
~Region() = default;

View file

@ -1045,7 +1045,7 @@ TEST_CASE("[Region] Parsing opcodes")
REQUIRE(region.amplitudeEG.decay == 0.0f);
REQUIRE(region.amplitudeEG.delay == 0.0f);
REQUIRE(region.amplitudeEG.hold == 0.0f);
REQUIRE(region.amplitudeEG.release == 0.0f);
REQUIRE(region.amplitudeEG.release == 0.001f);
REQUIRE(region.amplitudeEG.start == 0.0f);
REQUIRE(region.amplitudeEG.sustain == 100.0f);
REQUIRE(region.amplitudeEG.depth == 0);

View file

@ -1369,3 +1369,14 @@ TEST_CASE("[Synth] Initial values of CC")
REQUIRE(synth.getHdccInit(111) == Approx(0.1234f));
REQUIRE(synth.getHdccInit(112) == Approx(77.0f / 127));
}
TEST_CASE("[Synth] Default ampeg_release")
{
sfz::Synth synth;
synth.loadSfzString(fs::current_path() / "default_release.sfz", R"(
<region> sample=*sine
)");
REQUIRE(synth.getRegionView(0)->amplitudeEG.release > 0.0005f);
}