Pluginval can set an AudioParameterBools to odd values

I think there’s definitely an inconsistency in that both AudioParameterInt and AudioParameterChoice implement getValue and setValue as

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

but AudioParameterBool just does

float getValue() const         { return value; }
void setValue (float newValue) { value = newValue; valueChanged (get()); }

Maybe this would fix it:

void setValue (float newValue)
    { value = (newValue >= 0.5f ? 1.0f : 0.0f); valueChanged (get()); }

This was already discussed here, btw.

(edit) And the fix was already proposed here, 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?

2 Likes