I can’t seem to be able to find any documentation or examples for creating basic rack.
This is what i managed to put together, it compiles and runs however there is no audio output:
void MainComponent::createPluginRack()
{
if (auto masterTrack = edit.getMasterTrack())
{
// Add the rack type to the edit
auto rackType = edit.getRackList().addNewRack();
if (rackType != nullptr)
{
// Create and add the rack instance with the rack type ID
juce::ValueTree rackValueTree(te::IDs::PLUGIN);
rackValueTree.setProperty(te::IDs::type, te::RackInstance::xmlTypeName, nullptr);
rackValueTree.setProperty(te::IDs::rackType, rackType->itemID, nullptr);
auto rackInstancePlugin = edit.getPluginCache().createNewPlugin(rackValueTree);
if (rackInstancePlugin != nullptr)
{
masterTrack->pluginList.insertPlugin(rackInstancePlugin, -1, nullptr);
DBG("Successfully created rack");
}
}
}
}
I can see in the logs that the rack as created successfully. If i remove this line then the audio works again:
From what i can tell in the documentation the rack should automatically create input and output nodes, i don’t need to configure that? I should just be able to call addPlugin on the rack type to start adding plugins.
P.S. I’m using a plugin rack on the master to get around the limit of 4 plugins for the master track.
I get this error when i’m trying to add the rack to the plugins list of the master track:
/Applications/JUCE/modules/juce_core/memory/juce_ReferenceCountedObject.h:310:11 Cannot initialize a member subobject of type 'ReferencedType *' (aka 'tracktion::Plugin *') with an rvalue of type 'ReferencedType *' (aka 'tracktion::RackType *')
When the assertion triggers, can you check which part of it is failing?
What is numSamples and what is destAudio.getNumFrames()? You can check the latter just by examining the destAudio members.
If i modify the ConnectedNode::process function to use pc.numSamples then it compiles and plays audio with them being processed through the effects rack as expected. But not sure what side effects that has.
I’ve tried to follow it but i’m not really the best at debugging c++ but I see that the process function is called in certain places. the EditPlaybackContext being one of them.
I do use time stretching (setTempoAdjustment) in my application, and after disabling all the time stretching functionality then the rack works as expected (but without time stretch of course).