From 844b45057f78ecab6edf42b51fc13bb039d7ccea Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 26 Mar 2025 21:31:32 -0400 Subject: [PATCH] MIDI-Map: Set param value without Engine smoothing, since MIDI-Map already filters it. --- src/core/MIDIMap.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/core/MIDIMap.cpp b/src/core/MIDIMap.cpp index 70f7431a..4bed567f 100644 --- a/src/core/MIDIMap.cpp +++ b/src/core/MIDIMap.cpp @@ -115,16 +115,23 @@ struct MIDIMap : Module { if (values[cc] < 0) continue; float value = values[cc] / 127.f; - // Detect behavior from MIDI buttons. + + // Detect MIDI CC buttons if (smooth && std::fabs(valueFilters[id].out - value) < 1.f) { // Smooth value with filter - valueFilters[id].process(args.sampleTime * divider.getDivision(), value); + value = valueFilters[id].process(args.sampleTime * divider.getDivision(), value); } else { - // Jump value + // Jump filter value, don't filter valueFilters[id].out = value; } - paramQuantity->setScaledValue(valueFilters[id].out); + + // Scale and snap value based on ParamQuantity + value = paramQuantity->fromScaled(value); + if (paramQuantity->snapEnabled) + value = std::round(value); + // Set param value without Engine smoothing, since it is already filtered. + APP->engine->setParamValue(module, paramId, value); } }