AudioPluginFormatManager::createPluginInstance

Hi JUCE team,

I can see here that function AudioPluginFormatManager::createPluginInstance runs over all existing formats until one of them return a non null result as follows:

for (int i = 0; i < formats.size(); ++i)
        if (AudioPluginInstance* result = formats.getUnchecked(i)->createInstanceFromDescription (description, rate, blockSize))
            return result;

That means that any format, at plug-in instanciation, can get a request to open a plug-in that is not its...

What surprises me a little bit is that the format is already known in the description, so what not use it and call
createInstanceFromDescription only for the relevant format?

Thanks

 

Nathaniel
 

All of the plug-in formats check the plug-in type inside their versions of createInstanceFromDescription, so the function should never return a plug-in which does not match the requested format.

right!

Thanks

Nathaniel