Parameter is set, but is not being retrieved

In the pro-800 preset Electra One App, the characters of the name are being parsed and correctly set in virtual parameters 213…227. This can be seen and is verified on the ‘names’ page.
Yet, when requesting the values of parameters 213…217 with the function "changeChar ":

function changeChar (valueObject, value)
  local patchName = ""
  for i = 213, 227 do
    patchName = patchName .. string.char (parameterMap.get (deviceId, PT_VIRTUAL, i))

all their values found with parameterMap.get (deviceId, PT_VIRTUAL, i) are still at the default value of 32.

The function changeChar is called after the sysEx request is send to get the patch parameters :notes:

function selectPatch(valueObject, value)
some coding
    midi.sendControlChange(devPort, channel, 0, bank)
    midi.sendProgramChange(devPort, channel, progNum)
    progNumLSB = (bank*100+progNum)%128
    progNumMSB = (bank*100+progNum-progNumLSB)/128
    midi.sendSysex (devPort, {0x00,  0x20, 0x32, 0x00, 0x01, 0x24, 0x00, 0x77, progNumLSB, progNumMSB})

I would not recommend the above approach. It is very fragile. You do not have any guarantee that the incoming sysex messages will be received and processed by the controller in that 300msec window. I assume to send the message, sleep, and call changeChar() from within the function callback. I would, instead, use the patch.onResponse() to process the incoming sysex message and/or use it to access the parameterMap data after the sysex message is processed with the parsing rules.

I assume you are not proposing to perform all of the parsing via lua instead of using the predefined functions you foresaw? If indeed I use the out-of-the-box parsing , how should i use the patch.onResponse() to ascertain I only invoke the name change function after all of the parsing took place.?

correct, I mean to leave the parsing as it is. Just add an extra call to patch.onResponse(). The function is called after the JSON parsing was completed. You should have the data ready in the parameterMap by then.

1 Like

that looks exactly as what I need. I don’t recall seeing this before in the documentation. Is this fairly recent?

it has been around for a while. Starting v3.5 I made sure the Lua onResponse callback is called after the JSON parsing it completed.

1 Like