Waiting for MIDIClient initialization in startup.scd

Hello all. I have an ongoing project where I use a Pisound running SuperCollider to control several MIDI-controlled oscillators in my AE Modular system (connected via USB, with a separate ttymidi instance bridging between MIDI and serial for each oscillator, since they can’t act as USB MIDI devices directly). I am trying to make setup as quick and easy as possible. Currently, I setup my environment by running several blocks of code. Those five blocks are in different .scd files in my home folder, and I have lines of code executing those files at the top of my template file, in order to manually wait for each operation to finish. This works fine, but I know I should probably use startup.scd instead, except I’m not sure how to wait for the MIDIClient to finish starting up and completing connections before moving on to the next stage of startup. How do I wait for MIDIClient to finish initializing, and for MIDIIn to finish connecting to all inputs? My apologies if I missed another post that has this information. Thanks!

I’m pretty sure MIDIClient.init is fully synchronous in all 3 OSes – it blocks the interpreter until it’s ready. So you shouldn’t have to do anything special to wait for it (actually you don’t have a choice about waiting for it).

hjh

Sorry for the delay, and thanks for your help! I realize now that it must be something else in my startup code which is causing the issue, will have to investigate more on my own.