Segment Button doesn't update on preset change

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!

Which SDK version and which vstgui version?

Today i compiled it with the newest SDK version (3.7.5) and sadly it was acting the same

I don’t know where to check the exact version of vstgui included in the newest SDK, but i guess it’s enough information (it’s 4 for sure)

previously i was using 3.7 VST SDK and the vstgui provided with it (4 as well)

Are the values in the range zero…one?

Yes, I was debugging it and made sure that the values are normalized properly to (0, 0.125, 0.25, 0.375…, 1) because there are 9 segments. It updates properly when the state is loaded for the first time (for example opening a project). It only doesn’t update if the preset is changed.

I can send the whole code if that can help, it’s not a big project

Yes, source code will help. A link to a git repository containing the code would be sufficient.

Here’s a link to git repository: GitHub - marekbobrowski/sync-stereo-delay: A VST3 plugin working as stereo feedback delay; synchronized with the host's tempo.

I just checked this, and I don’t see anything obvious. Loading presets work as expected in a few hosts I have installed. FL Studio is not part of it and after installing I’m unsure how to locate your plug-in in there. Not my host :wink:

Alright, so it’s probably an issue with my host. Plugins can be made visible in FL Studio by selecting in Menu: Options → Manage Plugins → Find more plugins. If sync-stereo-delay is not visible you can try to scan with “verify plugins” option disabled. If it works, then in the mixer (F9) click on some slot → more plugins → select sync-stereo-delay. Sorry for delayed reply, and thank you for checking the plugin in other hosts!