Set multiple controls at once back to their default state?

Hi all,

I want to implement an init instruction, that would send an init Sysex dump into a synth’s memory. Simultaneously there will be a set onf controls in the E1 I should set back to its default state (I can’t have the synth sent back the patch settings it has in its memory, so using the parsing is not an option).
Assuming I have a table with all controls or parameters that must be set back to their default state, it there a way to do this without having to define the default states again in lua?

there is a parameterMap resetDevice() as well as keep() and recall() that might be useful. You’d have to store the defaults in some kind of table or something, but that might work for you.

1 Like

Thanks. I found a workable way thuogh, using the virtual parameters I wanted to reset. There’s usually a logical order to it, so it wasn’t to difficult to make a loop that calls them one by one and then executes the following routine:

function setDefault(virtParNum)
  local valueObjects = parameterMap.getValues(deviceId, PT_VIRTUAL, virtParNum)
  local default = 0
  for i, valueObject in ipairs(valueObjects) do
    default = valueObject:getDefault()
    if default == 0 and valueObject:getMin() < 0  then default = - valueObject:getMin() end
    parameterMap.set(deviceId, PT_VIRTUAL, virtParNum, default)
  end
end

The getMin is checked in cause of negative minimum display values, which indicate a parameter that runs from -x to + x. Since the default value I set in the parameter must be the MIDI value, not the displayed value, this should then not be 0 but rather -(-x).

1 Like