I am guessing the needed functionality is in the Renderer class, but I just can’t figure out how to hook it all up correctly. Is it allowed to attempt to render an edit that is currently playing back in real time? If not, is there an easy way to make a temporary clone of the edit for the rendering?
My current code is as follows. Probably completely wrong, but the only way was to do guess work. The code fails when trying to create the rendering audio node, a nullptr is returned :
No, you can’t render an edit while it’s playing, mainly because there is only one copy of the plugins loaded, and they can’t be used for both playback and render at the same time.
The easiest way to do a render is with the static function Renderer::renderToFile
Renderer::renderToFile ("Render"), outputFile, edit, { start, end }, tracksToDo);
To create a copy of an edit, first I’d edit.flushState() and then edit.state.createCopy() and pass the ValueTree to a new edit.
If you don’t use a thread, it will render on the calling thread and you won’t be able to cancel or get progress to it in order to display to your users.
Hi, I’m having issues trying to do the same. Render works, but it only renders first track. Here’s how I’m setting tracks to render:
juce::BigInteger tracksToDo{ 0 };
for (auto i = 0; i < numOfTracks; i++) {
tracksToDo.setBit(i);
}
Literally the same way, just passing an int for the number of tracks instead of size of an array.
In debugging it shows that there’s indeed correct number of bits set to 1, but rendered file plays as if there’s only the first track.
You can choose to render only specific clips from a track.
It’s probably not useful in most cases though, if you did want to use it, just add the clips to the allowedClips member that you want to include. Everything else won’t appear in the render.
Just to clarify. I would have to create Renderer::Parameters with populated allowedClips, and use this function instead: static juce::File renderToFile (const juce::String& taskDescription, const Parameters& params); ? Or I can just pass an array of Clip* to this function: static bool renderToFile (const juce::String& taskDescription, const juce::File& outputFile, Edit& edit, EditTimeRange range, const juce::BigInteger& tracksToDo, bool usePlugins = true, juce::Array<Clip*> clips = {}, bool useThread = true); ?