How to disconnect midiBinding?

Does anyone know if I made a midiBinding like this:

control_element.mSurfaceValue .mMidiBinding.setInputPort(midiInput).bindToPitchBend(0)

how to disconnect this midiBinding?

Hi, not sure I understand this. You mean you want to set control_element to null?
What is the use case here, curious to know.

I want to recreate the state that existed before midiBinding, because I need this behavior beforehand.

I want to be able to undo the midiBinding.

If a simple switch is only there to switch a lamp on or off and midi remote ensures, for example, that the elevator goes up and down, I might also want to be able to use the switch to switch the lamp on or off again.

I am looking for something like:

I have made a few attempts with trial & error, but found nothing.

Ah, maybe now I understand better.
So you have pre-set a control_element to a binding to a fader as an example, but then while talking with the hardware, you see that it also has a button which can fit your needs, so in this case you want to disable the control_element, and? Use the button instead? What should happen after you disable the midiBinding? Please provide some pseudo-code, so that I can think about it too.

I am looking for a solution how to undo the midiBinding.
Everything else doesn’t matter.

I need a code snippet like:

control_element.mSurfaceValue.mMidiBinding = null

that works.

Sorry, I cannot think of a snippet/workaround while I have no idea about the context behind it, that’s just how my brain works. I totally understand however you don’t want to share the context, no worries. Hope other users may be of more help here.

I need a code snippet like:

control_element.mSurfaceValue.mMidiBinding = null

that works.

It is a generally question, that could have dozens of contexts.
I would basically like to know whether this is possible.
Then I’ll think about what I can do with it.

Some possibilities would be to use a controller either for MIDI Remote or as a data generator, or to block certain things, etc. - but it only makes sense to think about this in detail once you know whether midiBinding can be switched off at all.

It looks like nobody knows a solution, so it can’t be switched off once it’s switched on. It looks like once midiBinding is turned on it can only be changed. That means any solutions have to go in a direction where changes are made in such a way that they act like a disable. This is in line with what I suspected before I opened this post.