# Pluginval can set an AudioParameterBools to odd values

**URL:** <https://forum.juce.com/t/pluginval-can-set-an-audioparameterbools-to-odd-values/50971>\
**Category:** General JUCE discussion\
**Created:** [April 11, 2022, 9:57am UTC](https://forum.juce.com/t/pluginval-can-set-an-audioparameterbools-to-odd-values/50971 "2022-04-11T09:57:18Z")\
**Posts on this page:** 1\
**Showing post:** 32

<div class="post-metadata">

**Author:** ![dave96](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/dave96/32/8487_2.png) [@dave96](https://forum.juce.com/u/dave96)\
**Post date:** [June 10, 2024, 11:21am UTC](https://forum.juce.com/t/pluginval-can-set-an-audioparameterbools-to-odd-values/50971/32 "2024-06-10T11:21:41Z")

</div>

> [@kamedin](#):
>
> (edit) And the fix was already proposed [here](https://forum.juce.com/t/pluginval-can-set-an-audioparameterbools-to-odd-values/50971/2), in this thread… I think the confusion was caused by
> 
> > @dave96 mentions in the other thread that it might be required by auval that a parameter set to some odd value should return that odd value.
> 
> which doesn’t make sense to me (it already doesn’t happen for any type other than Bool), and is also contradicted by Dave himself here
> 
> > As far as I can remember, there is no test in pluginval that sets a random parameter value and expects to be able to read that same value back is there?

This is only a contradiction in terms of different tools, `auval` vs `pluginval`. And like I said, I can’t remember _exactly_ what `auval` tests for, maybe it doesn’t do this test and if so that’s good, `pluginval` doesn’t either and that’s consistent.

* * *

Can I clarify if it is only `AudioParameterBool`’s that are causing this failure?  
If so, yes I think this would fix it:

> [@kamedin](#):
>
> Maybe this would fix it:
> 
> ```auto
> void setValue (float newValue)
> { value = (newValue >= 0.5f ? 1.0f : 0.0f); valueChanged (get()); }
> 
> ```

Or even using the `range` member and the same body as the `AudioParameterInt`/`AudioParameterChoice`. E.g. (not tested):

```auto
float getValue() const
    { return range.convertTo0to1 (value); }
void setValue (float newValue)
    { value = range.convertFrom0to1 (newValue); valueChanged (get()); }

```

Does making that local change fix the problem for everyone here? If so, maybe we can propose this to the juce team?

---

_[View the full topic](https://forum.juce.com/t/pluginval-can-set-an-audioparameterbools-to-odd-values/50971)._
