I’m trying to add multiple plugin racks to an edit. I’m able to load one plugin rack in the edit, but as soon as I add multiple ones, then the audio goes wrong (there is only an internal sampler placed at the end of the plugin list).
I’m experimenting with a rack containing only the internal midiModifier, I exported it from Waveform.
Here’s the setup function I use to add the rack to a given audio track:
void AudioEngine::appendTransposeRackPlugin(int trackIndex)
{
auto xmlPreset = juce::String::createStringFromData(BinaryData::midiTranspose_trkpreset, BinaryData::midiTranspose_trkpresetSize);
auto vt = juce::ValueTree::fromXml(xmlPreset);
auto rackVT = vt.getChildWithName(te::IDs::RACK);
edit.getRackList().addRackTypeFrom(rackVT);
auto rackFx = dynamic_cast<te::RackInstance*> (edit.getPluginCache().createNewPlugin(te::RackInstance::xmlTypeName, {}).get());
if (rackFx)
{
auto track = getOrInsertAudioTrackAt (edit, trackIndex);
auto index = track->pluginList.size();
track->pluginList.insertPlugin (*rackFx, index, nullptr);
}
}
Calling this function once works, but if I place several racks successively in the plugin list, by doing:
appendTransposeRackPlugin(0);
appendTransposeRackPlugin(0);
Then the audio output is garbage.
Here is the XML for the exported rack (it purposefully doesn’t do anything except bypass midi events) :
<?xml version="1.0" encoding="UTF-8"?>
<PRESET name="New Rack" tags="Rack">
<RACK id="1006" name="New Rack">
<MACROPARAMETERS id="1011"/>
<WINDOWSTATE windowPos="109 125 600 500" active="1" windowLocked="1"/>
<OUTPUT name="midi output"/>
<OUTPUT name="output 1 (left)"/>
<OUTPUT name="output 2 (right)"/>
<INPUT name="midi input"/>
<INPUT name="input 1 (left)"/>
<INPUT name="input 2 (right)"/>
<MODIFIERS/>
<FACEPLATE width="8" height="4" autoSize="1">
<RESOURCES/>
</FACEPLATE>
<PLUGININSTANCE x="0.5409836065573771" y="0.3451327433628318">
<PLUGIN type="midiModifier" windowLocked="1" id="1033" enabled="1" presetDirty="1"
semitonesUp="0.0" windowX="189" windowY="205">
<MACROPARAMETERS id="1036"/>
<MODIFIERASSIGNMENTS/>
<FACEPLATE width="8" height="4" autoSize="1">
<RESOURCES/>
</FACEPLATE>
</PLUGIN>
</PLUGININSTANCE>
<CONNECTION src="0" dst="1033" srcPin="0" dstPin="0"/>
<CONNECTION src="1033" dst="0" srcPin="0" dstPin="0"/>
</RACK>
</PRESET>
I’m probably doing something wrong in the appendTransposeRackPlugin function, but I can’t figure out what…
