Login / Register 0 items | $0.00 New @ KVR
GuyOnKVR
KVRer
 
2 posts since 16 Apr, 2018

Postby GuyOnKVR; Mon Apr 16, 2018 2:30 am Creating multiple programs

Hey everyone,

Quite new to coding and creation of VSTs, but am making a set as part of my final project at uni. DSP is all working, but currently trying to add some presets, and can't seem to make anything play ball. Closest I've got so far is using the ADelay example in the VSTSDK (I'm using version 2.4) and the 'ADelayProgram function, but the documentation is useless on telling/showing how to make multiple presets/programs.

Can anyone point me to a useful guide or just point out where I'm being dense? I've tried using a switch function but just lead to the VST crashing my computer.

Cheers
Miles1981
KVRian
 
1355 posts since 26 Apr, 2004, from UK

Postby Miles1981; Mon Apr 16, 2018 5:00 am Re: Creating multiple programs

You may want to have a look at frameworks like WDL-OL and JUCE to simplify VST development. No need for you to suffer the pain of implementing all the APIs when there are tools to make your life easy.
User avatar
syntonica
KVRist
 
424 posts since 24 Sep, 2014, from Specific Northwest

Postby syntonica; Mon Apr 16, 2018 8:24 am Re: Creating multiple programs

Preset storage is a pain in VSTs. It's poorly documented and the host gets into everything...

My solution was to lock the host out of presets (by just specifying one on plugin instantiation) and manage them inside the plugin.

You can take a look at the frameworks out there to see how they handle the issue. There are a number of open-source VSTs out there you can study the code for. The one off the top of my head is Revitar.
mystran
KVRAF
 
4979 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Mon Apr 16, 2018 3:47 pm Re: Creating multiple programs

GuyOnKVR wrote:Can anyone point me to a useful guide or just point out where I'm being dense? I've tried using a switch function but just lead to the VST crashing my computer.


So basically, first of all there are two ways to store presets in VST2.4. If you don't do anything special the host will fetch all the parameter values (also looping through every program if it's storing the bank) and store them into the fxp/fxb (and then setParameterValue for each one of them when it restores the preset). Alternatively if you tell the host that "programsAreChunks" then it'll call getChunk/setChunk (with a flag to tell you whether you're supposed to store/load a preset or a bank) to let you write/read arbitrary binary chunks (as far as the host cares; you can obviously store text if you want) where you can store what you want.

The other part of the puzzle is the preset/bank model: essentially the way it's supposed to work is kinda like hardware where you have a fixed number of programs and setProgram sets which one of them is "active" at any given time. Pretty much everything else (eg. set/get parameter values and whatever) is supposed to refer to the "active" preset, whatever that might be.

It should also be noted that a lot of plugins (and that would be "most plugins" if you look at the commercial ones only) don't bother with the VST model of presets in banks and instead do their own preset management. If you want to do this, you essentially just declare that you have only one program. Then you implement your own preset browser and load/store logic directly to files (or whatever else you want to use as a backing store). Finally you declare that your programsAreChunks and hook the load/store functions (which can hopefully work with memory buffers) to getChunk/setChunk so that the current settings get saved with the project.

I don't know if this is detailed enough to solve your problem, but hopefully it'll give you a basic idea of what's going on.
Image <- plugins | forum
GuyOnKVR
KVRer
 
2 posts since 16 Apr, 2018

Postby GuyOnKVR; Sat Apr 21, 2018 2:12 am Re: Creating multiple programs

Thanks for all your help, mamaged to get them sorted in the end using just a simple function that wasn't explained well in the SDK, but collaborated with some other coursemates to get the full picture. Now to attempt UIs :hyper:

Moderator: KVR Moderators (Main)

Return to DSP and Plug-in Development