Hi, on my host I used the same algorithm to restore layout of plugins I used, but while (WITH THE SAME CODE) restoring a plugin like kontakt saved with 4 LR bus in input and 4 LR bus in output in AudioPluginHost works fine in my app readBusLayoutFromXml returns after ** if (! plugin.addBus (isInput))
This is the xml passed on both func (mine and of audioPluginHost) for plugin KONTAKT:
<LAYOUT>
<INPUTS>
<BUS index="0" layout="L R"/>
<BUS index="1" layout="L R"/>
<BUS index="2" layout="L R"/>
<BUS index="3" layout="L R"/>
</INPUTS>
<OUTPUTS>
<BUS index="0" layout="L R"/>
<BUS index="1" layout="L R"/>
<BUS index="2" layout="L R"/>
<BUS index="3" layout="L R"/>
</OUTPUTS>
</LAYOUT>
As you can see code is exactly the same:
static void readBusLayoutFromXml (AudioProcessor::BusesLayout& busesLayout, AudioProcessor& plugin,
const XmlElement& xml, bool isInput)
{
auto& targetBuses = (isInput ? busesLayout.inputBuses
: busesLayout.outputBuses);
int maxNumBuses = 0;
if (auto* buses = xml.getChildByName (isInput ? "INPUTS" : "OUTPUTS"))
{
if (buses->hasTagName("INPUTS")) { DBG("INPUTS"); } else { DBG("OUTPUTS"); }
for (auto* e : buses->getChildWithTagNameIterator ("BUS"))
{
const int busIdx = e->getIntAttribute ("index");
maxNumBuses = jmax (maxNumBuses, busIdx + 1);
for (int actualIdx = plugin.getBusCount (isInput) - 1; actualIdx < busIdx; ++actualIdx)
if (! plugin.addBus (isInput))
return; //this is called after evaluating "index 1"
for (int actualIdx = targetBuses.size() - 1; actualIdx < busIdx; ++actualIdx)
targetBuses.add (plugin.getChannelLayoutOfBus (isInput, busIdx));
auto layout = e->getStringAttribute ("layout");
if (layout.isNotEmpty())
targetBuses.getReference (busIdx) = AudioChannelSet::fromAbbreviatedString (layout);
}
}
while (maxNumBuses < targetBuses.size())
{
if (! plugin.removeBus (isInput))
return;
targetBuses.removeLast();
}
}
there’s something I’m missing on plugin to set before passing it to this func?
