MIDI Output from a Standalone App

I’m writing a standalone app that generates MIDI. Currently my implementation looks like the standalone implementation at the end of this tutorial:

My question is, if I’m using an audio callback to process / generate MIDI data in this way, how do I route MIDI out to the devices I manage with my AudioDeviceManager ?

From what I’ve found, it seems as though I may have to set the MIDI output for the AudioProcessorPlayer explicitly, and that I may need to start a background thread for the MIDI output (?).

You would need to send the MIDI messages directly with a MidiOutput instance.

Adding MIDI messages in the audio callback makes sense when you need to pass timed MIDI events between audio processors, or to/from a plugin host.