Loading a preset directly into the VST


#1

I can extract and store single presets from a soundbank on my harddisk (as .fxp) using Juce.
Also it’s possible to load such a preset from disk and apply it again to the VST at a certain preset slot using Juce.
What doesn’t work: having the VST open (in my case Sylenth1) and directly load such a preset from disk (without using Juce).
Either Juce generally doesn’t support storing presets in the format which the VST expects or i need to change my code when storing extracted presets from a sound bank:

    // instance is an AudioPluginInstance
    instance->setCurrentProgram(i);
    MemoryBlock mb1;
    VSTPluginFormat::saveToFXBFile(instance, mb1, false);
    File file1 (AppData::Paths::presetsPath + String(preset->itemId) + AppData::Presets::presetFileExtension);
    FileOutputStream out (file1);
    out.write(mb1.getData(), mb1.getSize());

Could someone please confirm or correct that? Thank you.


#2

This will just keep appending data to the end of the file rather than overwriting it, you know?


#3

No no it works fine: These 4 lines will generate a new File since preset->itemId is increased in a for loop.
I just shortened it for brevity.

SOLVED