Integrating tracktion engine with an existing Juce audio application

Hi there,

Pretty sure this is a fairly straightforward thing those experienced in using Juce, but I’m a bit stumped with this.

If I have an existing Juce audio app (with it’s own audio device / audio device manager), can tracktion also work in this app?

This is based on my current understanding which is that a Juce audio app should (and can only have?) one audio device / device manager. From looking at the code for tracktion (great btw! Thanks!) it seems that the engine sets up it’s own device manager which makes me think that it’s not possible to have both the tracktion engine and another audio device/manager working in the same app.

So as a next step, I tried to see if it was possible to pass the engine a device manager to use as I thought that might be the answer to “sharing” a device manager. But I can’t see a way to do that.

Totally imagine I have misunderstood this, but I have honestly tried to work this out and read other posts before posting myself and I don’t think I can find an answer.

In essence I’m hoping to use the tracktion engine alongside other components that can also send audio out (via a device manager / AudioSourcePlayer etc).

Hope that makes sense. Any help greatly appreciated.

Checkout the EngineInPlugin demo: https://github.com/Tracktion/tracktion_engine/blob/develop/examples/EngineInPluginDemo.h

This is on the develop branch and still a WIP.

Get the hosted audio interface: engine.getDeviceManager().getHostedAudioDeviceInterface()

And then you can audioInterface.prepareToPlay (sampleRate, blockSize); and audioInterface.processBlock (buffer, midi);.

Since you are getting the audio from your own device manager and not a plugin like in the example, you’ll want to set fixedBlockSize to true so that you don’t get added latency.

1 Like

Thanks so much for this, I will check this out. And thanks for such a quick reply.

Can I ask your specific use case?
In Tracktion Engine, the Engine object is supposed be an RIAA instance that handles all the audio device setup/teardown etc. for simplicity.

Would it be easier if you removed your own AudioDeviceManager and used obtained the one from the Engine to use in the rest of your app?

Hi dave96, yes I was beginning to think the same thing. My specific use case is that I want to have a sequencer which lives alongside some components that are used for previewing source files and are used by a user to select a portion of a source, which will then be used in the sequencer.

Am I right in thinking that one instance of an engine can have multiple edits? If so, I could handle the source selection using separate edit instances? Or have I misunderstood?

Thanks

Yes, you can have multiple Edits open from a single Engine.
Using Edits for source selection might be the easiest option (you might be able to use the Engine clipboard for simplicity depending on your needs).

Thanks for clarifying. That definitely sounds like the easiest option. Thanks so much for help with this as I suspect this has saved me quite a lot of time trying out different solutions just to get back to this one! Nonetheless the info from G-Mon is also good to know for future reference.

Thanks both.