Prevent ctlIn defaulting to "All devices by Channel"
Hi I am using a ctlin and binding it to my hardware like so:
ctlin "SL MkII Port 2"
The problem I have is that if my hardware is not connected the ctlin will default to
"All devices by Channel" which is giving me a feedback loop in my patch. I'm guessing I have poll midiinfo and wait until I can see my port before wiring up ctlinfo. Has anyone built such a patch that is 'aware' of hardware connection states? Or maybe there is a more elegant way of doing this?
You can send the message
port "SL MkII Port 2"
to the ctlin object with a loadbang. You can also use a coll to globally access your controllers list.
Thanks for the reply. That looks like some good tidy code there. Would it prevent defaulting to all ins if my hardware isn't plugged in?
My latest thinking since I typed the post is to create a new "null" dummy port on load with
;#SM createinport null
define the ctlin mapped to it
ctlin null
then bang a port message into it. If the port message fails, my tests seem to suggest it will revert to the null port and therefore prevent feedback loops.
I'm having this same problem (nine years later lol). When a controller is no longer connected to my patch then having the ctlin / notein objects default to "All devices by Channel" is a real problem. I wish there was a way to have the inputs deactivate and wait for the controller to be present again. Is there a way to achieve this?
Thanks!
PS: I just realized that maybe I could check to see if the controller is present and if not send "port none"? The downside to this seems to be a lot of extra patching and cables. It would be great if we could set this as default behavior.
The objects actually understand the message 'none'. I think it's not documented.
Double-checked, and it is actually documented in the Reference.
Yeah, thanks Jean-Francois. I adjusted my patch to work that way, which is good.
I still think that there should be a choice in default behavior however ;)
The new matchport attibute could be a solution too.
AHHHHHH. That's it @pdelges thank you.
The setting is already there cheers.