Start MIDI file playback from a plugin



When I play audio files in my DAW, I load the file into an AudioTransportSource and get audio blocks in my processBlock function. When I want to actually start playing the audio file that’s loaded in my transport source, I call “transportPlay()”. Now I would like to do the same thing with MIDI files. I have created a plugin which can load a MIDI file and play it using a soundfont through a synth but in order to actually begin playback I have to press the play button in my DAW. I have tried calling transportPlay() after loading a MIDI file but nothing happens. Is there a way I can start/stop playing a MIDI file from within the plugin?



I have a series of (open source) plugins that do just that. They have a transport object that can override the host/DAW. When the host is overriden I can start stop the transport in the plugin; in that case the plugin just ignores transport commands coming from the host.

Code here:
Manual with pics that explains the host override here: