Browse Source

MIDI-Map: Jump value for MIDI CC buttons.

tags/v1.1.5
Andrew Belt 4 years ago
parent
commit
07099e9ccb
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      src/core/MIDI_Map.cpp

+ 11
- 4
src/core/MIDI_Map.cpp View File

@@ -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);
}
}
}


Loading…
Cancel
Save