Easiest way to load own chunk into VST3 plugin

Hi,

What would be the easiest way to load my own chunk into my own VST3 plugin ?

Basically I made a simple VST3 host to load my own VST3 plugin and I would like to be able to load my own chunk loaded from my own preset file into my VST3 plugin.

I checked the setPreset thing from VST3Extension but it requires to create a VSTPreset…
Is there a simpler method ?

I was thinking about adding a VST3 extension to my plugin which would allow to read a file path but I didn’t see how to do this on the host side.

Any input are welcomed :slight_smile:

Thanks !

I ended up doing something like that for those interrested

struct Visitor : juce::ExtensionsVisitor
        {
          Visitor (const juce::MemoryBlock& b) : block (b) {}
          void visitVST3Client (const VST3Client& c) override
          {
            Steinberg::MemoryStream iStream;
            Steinberg::int32 numBytesWritten;
            iStream.write((void*)block.getData(), block.getSize(), &numBytesWritten);
            c.getIComponentPtr()->setState(&iStream);
          }
          
          const juce::MemoryBlock& block;
        };
        
        juce::MemoryBlock info(&data[0], data.size());
        Visitor visitor(info);
        hostProcessor.getPlugin()->getExtensions(visitor);

How is this different from regular get/setStateInformation?

setStateInformation will not call the AudioProcessor::setStateInformation but the one from the pluginformat which may require some additional info/wrapping