VST3PluginFormat::setStateFromVSTPresetFile deprecated

So any clues on how to use the new ExtensionsVisitor structure and setPreset() ?

else if (fPath.getFileExtension().equalsIgnoreCase (".VSTPRESET") && m_szPluginFormatName == "VST3")  // VST3
        {
        fPath.loadFileAsData (mb);
        
        if (AudioPluginInstance* const plugin = dynamic_cast<AudioPluginInstance*> (m_pPluginProcessor))
            {
            ExtensionsVisitor visitor;
                
            plugin->getExtensions (visitor);
                
            // ????  -- Need to replace the next line...
                
            VST3PluginFormat::setStateFromVSTPresetFile (plugin, mb);
            
            return true;
            }
        }

The deprecated comments seem โ€˜offโ€™ BTW

Rail

Something like this should work:

struct Visitor : ExtensionsVisitor
{
    Visitor (const MemoryBlock& b) : block (b) {}
    void visitVST3Client (const VST3Client& c) override { c.setPreset (block); }
    const MemoryBlock& block;
};

Visitor visitor { mb };
plugin->getExtensions (visitor);
1 Like

Thanks!

Rail