|
|
@@ -103,13 +103,20 @@ struct MIDI_Map : Module { |
|
|
|
if (!filterInitialized[id]) { |
|
|
|
valueFilters[id].out = paramQuantity->getScaledValue(); |
|
|
|
filterInitialized[id] = true; |
|
|
|
continue; |
|
|
|
} |
|
|
|
// Set param if value has been initialized |
|
|
|
if (values[cc] >= 0) { |
|
|
|
float v = values[cc] / 127.f; |
|
|
|
v = valueFilters[id].process(args.sampleTime * divider.getDivision(), v); |
|
|
|
paramQuantity->setScaledValue(v); |
|
|
|
float value = values[cc] / 127.f; |
|
|
|
// Detect behavior from MIDI buttons. |
|
|
|
if (std::fabs(valueFilters[id].out - value) >= 1.f) { |
|
|
|
// Jump value |
|
|
|
valueFilters[id].out = value; |
|
|
|
} |
|
|
|
else { |
|
|
|
// Smooth value with filter |
|
|
|
valueFilters[id].process(args.sampleTime * divider.getDivision(), value); |
|
|
|
} |
|
|
|
paramQuantity->setScaledValue(valueFilters[id].out); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|