We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi All,
I'm using TheMIDIBus library for my project, although I believe this to be a generic .list question. I have this line that connects to the MIDI device:
MidiBus.list();
myBus = new MidiBus(this, "DEVICE NAME", 0);
This is great, however I want to be able to use my GUI whether the MIDI device is plugged in or not, but when it's connected to my PC, the GUI sends a "Device Found" message and enables some of its features. Is there a way I can continuously check the list for "DEVICE NAME" until it's found? Haven't been able to come up with anything on my own, so I'm hoping there's an easy solution out there. Thanks in advance!
Pat
Answers
You should create a parallel Thread in order to keep attempting instantiating a
new
MidiBus until success!For that, you can use the following Processing's undocumented function called thread(""). (*)
It invokes a function w/ the same name as its String argument as a separate Thread.
You just need to arrange a loop there which breaks itself once a MidiBus object is created.
Check it out my example below: B-)
P.S.: Since I've never used this library before, got no idea how to check whether a device is valid!
It's up to you to modify this attempt in order to do your bid! :p