I wrote a function duplicatePlugin() that is supposed to make a 1:1 copy of a plugin (without the editor, but including its state):
[code]AudioPluginInstance* duplicatePlugin(AudioPluginInstance *plugin)
{
if (plugin==0) return 0;
PluginDescription description;
plugin->fillInPluginDescription(description);
AudioPluginInstance* instance=AudioPluginFormatManager::getInstance()->createPluginInstance(description,String("Could not create plugin instance!"));
if (instance!=0)
{
MemoryBlock memBlock;
plugin->getStateInformation(memBlock);
instance->setStateInformation(memBlock.getData(), memBlock.getSize());
}
return instance;
}[/code]
I must have forgotten something, because when I call the process() method of the duplicated plugin (VSTi), no sound is coming out, whereas the first one (the original) produces sound.
Oh, and just to say, I did not forget to call prepareToPlay() on the second plugin, so that’s not the problem.