# Pluginval failure with serialization of boolean parameters

**URL:** <https://forum.juce.com/t/pluginval-failure-with-serialization-of-boolean-parameters/59321>\
**Category:** Audio Plugins\
**Created:** [December 30, 2023, 3:32am UTC](https://forum.juce.com/t/pluginval-failure-with-serialization-of-boolean-parameters/59321 "2023-12-30T03:32:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![benvining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/benvining/32/9922_2.png) [@benvining](https://forum.juce.com/u/benvining)\
**Post date:** [December 30, 2023, 3:32am UTC](https://forum.juce.com/t/pluginval-failure-with-serialization-of-boolean-parameters/59321/1 "2023-12-30T03:32:22Z")

</div>

My plugin has several boolean toggle parameters, which in my code I’m dealing with as `juce::AudioParameterBool` objects. I noticed that if I “quantize” the float values (ie, saving the value as a boolean and reloading to either 0.f or 1.f), then pluginval tests fail (on strictness level 10) with output saying it tried to save values such as 0.2 or 0.7 but they got recalled as 0.f and 1.f. I suppose this is somewhat understandable from pluginval’s perspective, but I’m wondering if it’s a flawed approach to “quantize” the values to 0 and 1 in this way – saving the exact floating point value seems somewhat irrelevant if it functions as a boolean toggle to the plugin?

---

<div class="post-metadata">

**Author:** ![sudara](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sudara/32/8071_2.png) [@sudara](https://forum.juce.com/u/sudara)\
**Post date:** [December 31, 2023, 1:40am UTC](https://forum.juce.com/t/pluginval-failure-with-serialization-of-boolean-parameters/59321/2 "2023-12-31T01:40:02Z")

</div>

Cross-linking as it might be relevant: [Basic AudioProcessorValueTreeState plugin won't pass PluginVal - #5 by lalala](https://forum.juce.com/t/basic-audioprocessorvaluetreestate-plugin-wont-pass-pluginval/39543/5)

---

<div class="post-metadata">

**Author:** ![hugoderwolf](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/hugoderwolf/32/14039_2.png) [@hugoderwolf](https://forum.juce.com/u/hugoderwolf)\
**Post date:** [January 1, 2024, 6:37pm UTC](https://forum.juce.com/t/pluginval-failure-with-serialization-of-boolean-parameters/59321/3 "2024-01-01T18:37:21Z")

</div>

See also here:

> [@Pluginval can set an AudioParameterBools to odd values](https://forum.juce.com/t/pluginval-can-set-an-audioparameterbools-to-odd-values/50971/1):
>
> I’m debugging a strange issue that sometimes leads to Pluginval’s state restoration test to fail. This is with an AU plugin, I’m not sure yet if it also happens with the VST3. The test checks if the sum of parameter values is the same before and after a state restore. Under some circumstances, when the test starts, the two AudioParameterBools that the plugin uses have random values that are not 0.f or 1.f. After saving and restoring the state they are correctly set to either 0.f or 1.f, and thu…

It’s been a while, and I ended up with a custom AudioParameterBool implementation that includes the fix as proposed in the thread. Then forgot about it and didn’t follow through to get this rather simple fix into mainline JUCE.
