Added a bypass parameter button with the flag Vst::ParameterInfo::kIsBypass, get test error

Hi

I’ve added a parameter in the initialize function in the controller of an effect plugin…

parameters.addParameter(STR16("Bypass"), nullptr, 1, 0, Vst::ParameterInfo::kCanAutomate | Vst::ParameterInfo::kIsBypass, kBypass);

Where the kBypass is the ID from my enum

enum
{
	kDry = 0,
	kSatHigh,
	kSat,
	kSatGain,
	kMasterGainIn,
	kMasterGainOut,
	kVu1,
	kVu2,
	kVu3,
	kVu4,
	kFactoryPresets,
	kBypass,
	kOSamp
};

When I’m trying to compile the project the test process breaks with the error “The bypass parameter is not in sync in the controller!”
This seems when looking in the code be coming from the BypassPersistenceTest::run

Because my normalized value returned by the bypass parameter is 0
Code from the bypasspersistence

if (controller->getParamNormalized (bypassId) < 1)
	{
		testResult->addErrorMessage (
		    STR ("The bypass parameter is not in sync in the controller!"));
		return false;
	}

What is this supposed to do, I don’t understand the test sequence.
What could be the problem?

Thanks in advance.

EDIT: It seems that I should add something in my ::setComponentState (IBStream* state) function??

So I’ve added the following code into the setComponentState function.

// Here you get the state of the component (Processor part)
		if (!state)
			return kResultFalse;

		IBStreamer streamer(state, kLittleEndian);

		// read the bypass
		int32 bypassState = 0;
		if (streamer.readInt32(bypassState) == false)
			return kResultFalse;
		setParamNormalized(kBypass, bypassState ? 1 : 0);

		return kResultOk;

But still got the same error message :confused:

Oh my!?

I’m not knowing what the functions does, but after a while of guessing I 've found that it fails because the streamer.readInt32 (bypassState) returns false

Hi agin, I’ve read the documentation and now I do understand, everything is working now.
I didn’t save any states the right way, but now I do.

Sorry for the inconvenience

1 Like