I wrote a simple delay plugin. It’s GUI consist of 4 knobs and 1 segment button. When I save and open an FL Studio project that contains an instance of my plugin, the plugin’s state loads properly (both the view and the processor’s internal variables). However, when I change the preset of my plugin, only the knobs update and the segment button stays the same (the segment button is for choosing the delay time; the delay time updates, but the segment button doesn’t).
Here’s the setComponentState method of my Controller class:
tresult PLUGIN_API Controller::setComponentState(IBStream* state)
{
if (!state)
return kResultFalse;
IBStreamer streamer(state, kLittleEndian);
// read the dry value
float dry = 0;
if (streamer.readFloat(dry) == false)
return kResultFalse;
setParamNormalized(Params::dry, dry);
float wet = 0;
// read the wet value
if (streamer.readFloat(wet) == false)
return kResultFalse;
setParamNormalized(Params::wet, wet);
float feedback = 0;
// read the feedback value
if (streamer.readFloat(feedback) == false)
return kResultFalse;
setParamNormalized(Params::feedback, feedback);
float width = 0;
// read the width value
if (streamer.readFloat(width) == false)
return kResultFalse;
setParamNormalized(Params::width, width);
float time = 0;
// read the time value
if (streamer.readFloat(time) == false)
return kResultFalse;
// normalize time value
time = time * 2 - 0.125;
setParamNormalized(Params::delayTime, time);
return kResultOk;
}
The parameter connected to the segment button is Params::delayTime (it’s at the bottom).
Is there some obvious reason why my segment button doesn’t update only on preset change? I assume that i normalize the parameter’s value properly because it always works when the plugin’s state is loaded for the 1st time (e. g. when loading a project or creating a new instance). Or maybe that’s a bug in VSTGUI/FL Studio?
I would appreciate any help with fixing this!