How do I repopulate a umenu MIDI device list while keeping current MIDI Device selected?


    Jul 15 2019 | 11:34 pm
    Hello all,
    I am wanting to have a umenu MIDI device list repopulate after plugging in a new MIDI device or removing a unused MIDI device, but I want the list to stay on the current selected MIDI Device. Currently the device list will repopulate, but the MIDI device at the top of the list will be auto-selected after plugging in or removing a device. In my setup I usually have 4 or 5 MIDI devices connected to my win 10 system.
    Help please! :)

    • Jul 16 2019 | 12:32 am
      If You want to keep selected midi device, don't repopulate the menu. If You want to select new plugged midi device, repopulate and select it
    • Jul 16 2019 | 4:03 am
      Hi Source,
      Yeah, I understand that. Maybe umenu can't do what I want it to do. I want the MIDI device list to update in the background after hot-swapping devices. In the pasted max patch you'll notice that I have a button used for manual re-population of the umenu. I was hoping to be able to get around a manual refresh of device list.
    • Jul 16 2019 | 7:26 am
      This aute detect devices is a new thing, introduced in Max 8, which I don't use. But here is a way I usually store and recall selected midi devices after populating umenu.
      See if it can be of any help. Last selected midi device gets stored into value object, and whenever midiinfo outputs something, it recalls that menu item (if it is still available)
    • Jul 16 2019 | 7:30 am
      Yes you can do it! Just save the selected item in the value object, then retrieve it after the umenu has been repopulated:
    • Jul 16 2019 | 9:06 pm
      Thanks Source and Floating! Both of your examples helped me greatly. :)