Using the Tracktion engine within a plugin?

Is it possible to use the Tracktion engine in a plugin?
Specifically I would like to trigger the playback of tracks using incoming midi inside a plugin. I cannot see a way to do this, is it even possible?

Currently not easily, but this is what we expect to be a common workflow, so I want to improve it asap. I’ll try and get a demo together for this.

The biggest issue is that Tracktion Engine expects a fixed size block, where plugins have to be able to deal with any block size. So it means adding a bit of delay and a fifo so you can always pass fixed size blocks to the engine. I think the engine should work will variable sized blocks if you don’t use sends/return or racks.

The idea is you need to subclass AudioIODevice, my example was InternalAudioDevice and then

dm.deviceManager.addAudioDeviceType (new InternalAudioDeviceType());
dm.deviceManager.setCurrentAudioDeviceType ("Internal Device", true);

And then pass the plugin audio to your internal audio device. I have this 80% written, I’ll try and get it cleaned up and posted by next week some time.

Thanks. Yes using the engine within a plugin will be a very common workflow I think.

Some basic example code would definitely be very helpful.

At least now I know where to start in getting it to work, thanks again.

G-Mon was able to assist me in getting the engine going as a plugin a while back. A couple of major issues for me after doing so were handling midi and syncing to the host transport. Hopefully those 2 things can be addressed.

I’ve started working on this and I have a proof of concept working:
https://github.com/Tracktion/tracktion_engine/blob/develop/examples/EngineInPluginDemo.h (This should get pushed to public repo in the next few hours)

To give the demo a try, once you create the project from the PIP, you’ll need to edit the plugin settings to enable midi in. This demo create an engine, adds a track, puts the midi in on the track and a synth plugin.

Audio in/out is working and live midi in is working.

There are still several issues to fix / things to implement. I still need to implement midi recording , midi out, and syncing to playhead. Also need to clean up some singletons.

2 Likes

Any updates on syncing to playhead?

1 Like