# Easiest way to load own chunk into VST3 plugin

**URL:** <https://forum.juce.com/t/easiest-way-to-load-own-chunk-into-vst3-plugin/61930>\
**Category:** General JUCE discussion\
**Created:** [June 20, 2024, 9:08am UTC](https://forum.juce.com/t/easiest-way-to-load-own-chunk-into-vst3-plugin/61930 "2024-06-20T09:08:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [June 20, 2024, 9:08am UTC](https://forum.juce.com/t/easiest-way-to-load-own-chunk-into-vst3-plugin/61930/1 "2024-06-20T09:08:44Z")

</div>

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 🙂

Thanks !

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [June 20, 2024, 1:22pm UTC](https://forum.juce.com/t/easiest-way-to-load-own-chunk-into-vst3-plugin/61930/2 "2024-06-20T13:22:59Z")

</div>

I ended up doing something like that for those interrested

```auto
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);

```

---

<div class="post-metadata">

**Author:** ![eyalamir](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/eyalamir/32/2978_2.png) [@eyalamir](https://forum.juce.com/u/eyalamir)\
**Post date:** [June 23, 2024, 2:17pm UTC](https://forum.juce.com/t/easiest-way-to-load-own-chunk-into-vst3-plugin/61930/3 "2024-06-23T14:17:22Z")

</div>

How is this different from regular get/setStateInformation?

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [June 24, 2024, 6:56am UTC](https://forum.juce.com/t/easiest-way-to-load-own-chunk-into-vst3-plugin/61930/4 "2024-06-24T06:56:25Z")

</div>

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