How should it work. E.g. for the mute button.
When I send the value 127 mute lights up. When I send 0 mute gets dark.
But I would expect, that whenever I send 127 that the mute button gets toggled. Is that correct?
We have two types of buttons as you most probably know: Gate and Toggle (I’m not referring to the way Cubase handles these, but to how WE have set them up).
In Gate mode, a button sends a 1 (say 127, upon press) and immediately after, a 0 (upon release). If your button works this way, you should set the setTypeToggle() if of course this is what you want to do, and obviously in the case of solo/mute indeed this is the way we should do it.
In Toggle mode, however, a button sends a 1 upon press/release and a 0 the next time we press/release. If your button is setup this way, then you shouldn’t set the setTypeToggle() because your control does this already, so Cubase receives the 1 (127) and 0 you send and behaves as expected (i.e. upon 1 it sets the value to ON and upon 0 to OFF).
That is exactly what I did. In the first place my button only send 127 upon press and no message on release at all. Then I adapted it to send 127 follow by sending a 0 immediately after 127. I used setTypeToggle(). But with no success. In both cases the Mute button light up but I could not deactivate it again.
Now, I remove the setTypeToggle() and tell the button to send what is necessary. So when Mute lights up, I send a 0 and when the Mute button is dark, I send 127. This is working.
But I did not manage to flip it on a 127[, 0] sequence. Then it was always on. Don’t know, if the time between 127 and 0 has an impect.
You may want to try giving some milliseconds space in between.
The strong point of using the gate approach is that you don’t have to memorize anything in your implementation (solo/mute states and so on). You just click and let DAW perform its task, this is why I’m suggesting you try the delay I’ve mentioned above.