Playing a midi file using the instrument on the track of aumi plugin

I’m generating a midi file successfully and have implemented some drag and drop functionality to pull that midi file into my project (I’m using logic).

The thing that I’m stuck on right now is I want to play that midi sequence in the plugin before I go ahead and drag over onto the track. I’ve seen examples of people playing midi files with an instrument registered in the plugin, but I’d ideally like to hear how the midi sounds with the track’s midi instrument. Can someone point me in the right direction here? I’ve done lots of research but haven’t had any success. Maybe I’m just confused, but it seems like all the examples deal with live playback against the track itself. I’d like to have this play via the instrument without making the full project playback. Think logic’s musical typing, but with a series of pre-defined midi notes rather than one individual note.

I see some posts like this that say it requires overriding the host.

Others seem to show something akin to the ability to override the getNextAudioBlock method, but I would think that’s only called playing back the project, yeah?

Just looking for some direction on how to approach it. Thanks!

I found some posts surrounding the “MidiOutput” class, and it seems like it might work as a way to send the midi messages along. Trying it out, to make sure that will send the right sound though. :man_shrugging:

I’m still searching for an answer here. It looks MidiOutput is specifically for sending to external midi devices whereas I’m trying to send midi events back to the host. This is normally done by the ProcessBlock method. The problem I’m seeing is that this block is only called back by the host during playback whereas I’m trying to do it asynchronously. Logic’s musical typing does something similar so I know it’s possible, I just can’t quite put my finger on how.
Can I manually trigger the processBlock somehow? Do I need to wire my events back to the host manually? Do I need to override the host to start playing when I click the button?
I feel like someone out there has to have tried this before, but all the questions seem okay with waiting till playback, which is most plugins use case, but not mine.

I looked more closely at “overriding the host” as tomto66 called it. Yeah, that’s not gonna cut it. He’s simply creating a form of control once the processBlock has been called. Alas, how do I how obtain a processBlock without playing the actual DAW? It seems pretty much impossible since we need the callback from the DAW (logic in my case).

I started investigating forcing playback… that seems pretty much hopeless too. My most likely solution would be to switch the window focus to the DAW and triggering a spacebar keypress, which seems painful from my research. :pensive: I hope I’m wrong about this and people correct me.

Anyone? :sweat_smile:

I eventually gave up on this and just registered my own synth instrument and playback the midi notes through the synth, then the user has the option to import them into the DAW.