Disable specific MIDI inputs/outputs when launching a patcher

Nicolas Bazoge's icon

Hey there,
I would like to automatically and systematically disable specific MIDI inputs/outputs in the main window of Max when launching a patcher. I can't find nothing about it, sorry. Would anyone know a way to do this ? Maybe with [ThisPatcher] ?
Thanks for your help,
Nicolas

Source Audio's icon

message #SM deleteinport or deleteoutport will do that.

Check it here :

https://docs.cycling74.com/max8/vignettes/messages_to_max

under MIDI Configuration Messages

Nicolas Bazoge's icon

Thank you for your answer.
The #SM deleteinport (or deleteoutport) seems to work only for the ports created in Max with the createoutport message.
What I would like to do is disable hardware MIDI ports, or virtual MIDI ports created out of Max.

Source Audio's icon

I see, well there is an option
to disable midi ports by portenable message.
Problem is that disabled port is still visible
in midiinfo list, it just stops to work.
For example, if midiport Tascam existed,
one could disable midiout using message :
;
#SM portenable Tascam 0 1
or enable it :
;
#SM portenable Tascam 1 1
the second argument specifies if in (0), or out (1) is
targeted.
To remove it from midilist,
one would have to delete it from the umenu,
and disalow doubleclicking on any midi object.
P.S. I edited this post, I reversed the arguments.

Roman Thilenius's icon

for umenu it is simple as you said :) but for that object-owned dialog it is probably impossible to have entries removed.

Nicolas Bazoge's icon

Sorry for the excessively late response!
The solution with portenable works great (with ";max" instead of "#SM", and with the use of quotation marks for some MIDI port names containing spaces ) !

For example :
;max midi portenable "UCX Midi Port 1" 0 0

Thank you both !

Klangschmied's icon

..and you have to open/close/open the "Options/ MIDI setup" to see the effect..