From d8d956562e7553790198c94760421ae8e07d0e24 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Wed, 1 Jul 2020 14:14:09 +0200 Subject: [PATCH 1/3] Unclamp the initial volume; we need to remove these clampings... --- src/sfizz/Defaults.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sfizz/Defaults.h b/src/sfizz/Defaults.h index f5edae7f..0846c370 100644 --- a/src/sfizz/Defaults.h +++ b/src/sfizz/Defaults.h @@ -111,7 +111,7 @@ namespace Default // Performance parameters: amplifier constexpr float globalVolume { -7.35f }; constexpr float volume { 0.0f }; - constexpr Range volumeRange { -144.0, 6.0 }; + constexpr Range volumeRange { -144.0, 48.0 }; constexpr Range volumeCCRange { -144.0, 48.0 }; constexpr float amplitude { 100.0 }; constexpr Range amplitudeRange { 0.0, 100.0 }; From ae0ac8d63243354299c3be3438c45115e21b9139 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Wed, 1 Jul 2020 14:14:45 +0200 Subject: [PATCH 2/3] Properly set the initial value for the smoothers Take into account the curve --- src/sfizz/Voice.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sfizz/Voice.cpp b/src/sfizz/Voice.cpp index 66a46d99..df3a46b6 100644 --- a/src/sfizz/Voice.cpp +++ b/src/sfizz/Voice.cpp @@ -136,21 +136,24 @@ void sfz::Voice::startVoice(Region* region, int delay, int number, float value, for (auto& modId : allModifiers) { ASSERT(modifierSmoothers[modId].size() >= region->modifiers[modId].size()); forEachWithSmoother(modId, [modId, this](const CCData& mod, Smoother& smoother) { + const auto ccValue = resources.midiState.getCCValue(mod.cc); + const auto curve = resources.curves.getCurve(mod.data.curve); + const auto finalValue = curve.evalNormalized(ccValue) * mod.data.value; switch (modId) { case Mod::volume: - smoother.reset(db2mag(resources.midiState.getCCValue(mod.cc) * mod.data.value)); + smoother.reset(db2mag(finalValue)); break; case Mod::pitch: - smoother.reset(centsFactor(resources.midiState.getCCValue(mod.cc) * mod.data.value)); + smoother.reset(centsFactor(finalValue)); break; case Mod::amplitude: case Mod::pan: case Mod::width: case Mod::position: - smoother.reset(normalizePercents(resources.midiState.getCCValue(mod.cc) * mod.data.value)); + smoother.reset(normalizePercents(finalValue)); break; default: - smoother.reset(resources.midiState.getCCValue(mod.cc) * mod.data.value); + smoother.reset(finalValue); break; } smoother.setSmoothing(mod.data.smooth, sampleRate); From 5463f143e07440f3042f6ade265512373153952e Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Wed, 1 Jul 2020 14:41:27 +0200 Subject: [PATCH 3/3] correct a bounds test --- tests/RegionT.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/RegionT.cpp b/tests/RegionT.cpp index e4a9c09d..b8470fec 100644 --- a/tests/RegionT.cpp +++ b/tests/RegionT.cpp @@ -522,8 +522,8 @@ TEST_CASE("[Region] Parsing opcodes") REQUIRE(region.volume == -123.0f); region.parseOpcode({ "volume", "-185" }); REQUIRE(region.volume == -144.0f); - region.parseOpcode({ "volume", "19" }); - REQUIRE(region.volume == 6.0f); + region.parseOpcode({ "volume", "79" }); + REQUIRE(region.volume == 48.0f); } SECTION("pan")