VST instrument parameter recall
-
- KVRer
- Topic Starter
- 16 posts since 27 May, 2010 from Finland
Hi
I'm developing a VST2 instrument (Linux and Windows).
Everything works as expected but when I save plugin with the song and load the song, the parameters are not set by SetParameter calls by VST host and the user interface shows parameters in default positions when the editor is opened.
So I wonder if I should do GetParameter calls at some point when the instrument is initialized or how are saved parameters passed to the instrument by the host?
I'm developing a VST2 instrument (Linux and Windows).
Everything works as expected but when I save plugin with the song and load the song, the parameters are not set by SetParameter calls by VST host and the user interface shows parameters in default positions when the editor is opened.
So I wonder if I should do GetParameter calls at some point when the instrument is initialized or how are saved parameters passed to the instrument by the host?
- KVRAF
- 7852 posts since 12 Feb, 2006 from Helsinki, Finland
Depends on whether you advertise chunks or not. If you don't advertise programsAreChunks() then the host should indeed call setParameter() for every parameter to restore the plugin state.
That said, for debugging this stuff, one might want to trace the actual setParameter() calls. You might also want to trace for setProgram() calls, since there is this whole mess with the "current program" vs. presets and make sure you don't overwrite the newly set parameters with some stale preset data.
Another thing to check is that you call setParameterAutomated properly whenever the parameters are changed. Some hosts might ask you for the parameter values when saving, but others might use their own internal cached values, which won't ever update unless you notify the host properly.
There could also be any number of other possible issues, but these would be the most obvious I can think of.
-
- KVRer
- Topic Starter
- 16 posts since 27 May, 2010 from Finland
Thank you.
Do you know where to find documentation for effGetChunk/effSetChunk?
Can the chunk be just array of parameters?
effGetChunk:
float* chunk = (float*)malloc(numParams*sizeof(float))
for(unsigned int i=0;i<numParams;i++)
chunk = parameterValue;
*pointer = chunk;
return sizeof(float)*numParams;
If the above code is correct, who does free() the chunk?
—
cslr
Do you know where to find documentation for effGetChunk/effSetChunk?
Can the chunk be just array of parameters?
effGetChunk:
float* chunk = (float*)malloc(numParams*sizeof(float))
for(unsigned int i=0;i<numParams;i++)
chunk = parameterValue;
*pointer = chunk;
return sizeof(float)*numParams;
If the above code is correct, who does free() the chunk?
—
cslr
- KVRAF
- 7852 posts since 12 Feb, 2006 from Helsinki, Finland
Probably "nowhere" really, but these are the getChunk/setChunk methods if you have the SDK.
A chunk can be basically anything you want. As far as the host is concerned, it's just an opaque piece of binary data that you store and which is returned to you to restore the state.Can the chunk be just array of parameters?
That said, it is a good idea to add some structure to your chunks, at least so you can sanity check that they are indeed valid chunks for you plugin. Some people use things like XML, but even if you choose to use a binary format, you might still want to add some header.
Your plugin should free the chunks that you allocate at some later point in time. For C++ plugins, probably the easiest approach is to store your chunks in std::vector<uint8_t> or something similar, which you can easily resize as required and which will get automatically disposed when your plugin is unloaded.If the above code is correct, who does free() the chunk?