Tracktion Engine Multi-Track Rendering

I’ve been successfully using Tracktion Engine to prepare and render an edit to a single output file. However, I’m having problems rendering multiple tracks in an edit to multiple output files simultaneously.

I start by setting up my render parameters:

te::Renderer::Parameters r(*edit);
r.tracksToDo = tracksToDo;
r.time = range;
r.audioFormat = edit.get()->engine.getAudioFileFormatManager().getWavFormat();
r.destFile = exportFile;
r.sampleRateForAudio = 44100;
r.separateTracks = true;

And then I start my render job.

te::Renderer::renderToFile ("export song", exportFile, *edit, range, tracksToDo, true, {}, true);

More recently, I’ve wished to set up multi-track rendering, with the aim of generating stems with little to no extra overhead.

    auto job = tracktion::EditRenderJob::getOrCreateRenderJob (edit->engine, r, false, false, false);
    jassert (job != nullptr);
    edit->engine.getUIBehaviour().runTaskWithProgressBar (*job);

However, this only generates empty tracks with respect to the sends.

Have I misunderstood something about the rendering system?

1 Like

You need to include send and return tracks in the tracksToDo.

Also, I’m not sure it’s wise to render the same Edit concurrently, I’m surprised if that would work at all as there’s probably a lot of state in there that is shared.

I do have the following set up prior to setting up the render task.

    juce::BigInteger tracksToDo{ 0 };

    juce::Array<tracktion_engine::Clip*> clips;

    for (auto i = 0; i < te::getAllTracks(*edit).size(); i++)
        auto track = te::getAllTracks(*edit)[i];
        if (track->canContainAudio())

What would the alternative approach be? To render tracks in completely different passes?

Would it be possible to render the submix tracks (passed through the FX) into separate tracks, and to use those tracks to generate the final render?

If you user the “renderMultipleTracks” option, it will just render each track that you’ve passed it separately. Obviously if you’ve got sub mixes/aux busses etc that’s not what you want.

For these cases I’d just create the tracks you want to render together and render each of them in turn with different passes.