Dynamically change switch label

Hi there, I would like to dynamically change the labels of a switch with incoming OSC messages.
What would be the easiest way to do that ?

"OSC{/fxParBankLbl_1, 1}" for the label seems not to work - like in "buttons" ?

Kind regards, mj

I assume you want to change the content of the switch's values property dynamically. This property expects an object so the default value 1 won't work, you'll need something like this (from the docs)

JS{
    return OSC{/fxParBankLbl_1} || {
        "key a": 1,
        "key b": 2
    }
}

Then you'll be able to change the values by sending a different object in a string form to the address /fxParBankLbl_1, for instance:

/fxParBankLbl_1 '{"foo": 1, "bar": 2}'

Hi Jean-Emmanuel, thank you for the examples. I'll look into that. Regards, mj

Update:
I couldn't make it work with Reaper's CSI. Then I found another hint in the forum and that does what I was looking for. In the "values" field of a switch write:

{
"labels": [ "OSC{/fx/1/name, ---}", "OSC{/fx/2/name, ---}", "OSC{/fx/3/name, ---}" ],
"values": [ 1, 2, 3]
}

Regards, mj

1 Like