Quering which MIDI device/port is selected for a "midiin"???
Hey guys,
I want to know if there is some message or something I can send to a "midiin" object so I can retrive the selected MIDI device/port on a "message" object.
Thanks!
I'm not aware of such a message. If this is important, then you should probably use midiinfo to get the list of all available ports, feed it into a umenu (say) and then only change ports through that umenu. That way you would be able to keep track.
Yeap, I have donne that way.
The problem is that in case of device disconnection, device/port changes inside the MIDIin and as far as I know there is no way yo know to wich one till you double click on MIDIin (I know that it is the first available port)
I already did an alarm system that holds last selection on a variable, then check device existence 1 time per second, in case of non existence it changes te "umenu" to red, and text to "Alarm", anyway I thought that may be there could be some way to know automatically wich port was selected after last selection disappeared.
Thanks anyway!
Hey gbravetti - I have the same problem, with a lot of USB hardware that may 'disappear' or not be available and who knows where your control signals will end up.
I also ended up with a midiinfo list, matching the required ports and sending an alarm message if the port doesn't exist.
At initialisation though I create a 'dummy' virtual midi port, midi objects are set to this dummy (doesn't go anywhere) when the actual device they should connect to cannot be found.
You could also use the enable 0/1 command into your midi objects to just switch them off when your port is not found - but (see discussion elsewhere) even though 'enable 0/1' works, it's not documented and may not work in the future.
Finally - I think the midi objects always default to the top one in the list if the port they are 'set' to does not exist.
Hi GBravetti
Kinda new to max and looking to set up an alarm for an expensive midi controller in a public installation.
I want the system to set off an alarm sound when and if the usb controller gets disconnected.
This patch of yours sounds like it could be easily modified this way? If you still have it do you mind sharing?
Jayo, here is a simple alarm that will bang if MIDI port doesn't exists. Let me know if you need something else.
Thanks GBravetti.
That's wonderful, and very simple I see how this can work now.
I was trying to work it out with a gate object and having difficulty, but yours does it so more efficiently.
Now to find a frightening alarm sound to include and secure my controller!