Hey all,
I am using a few audio processor parameter classes and I think I have found a problem or am not understanding something. I noticed this with my AudioProcessorParameterInt however looking at the code I think this exists in all types.
In the operator= function for each parameter this block of code exists:
const float normalisedValue = range.convertTo0to1 (newValue); if (value != normalisedValue) setValueNotifyingHost (normalisedValue);
This makes sense as the incoming value gets made into a 0 to 1 float and compared against the value member which is (supposedly) a 0 to 1 float. However, if you look where the value variable is set:
setValue (float newValue) { value = range.convertFrom0to1 (newValue); }
so the value variable is actually converted from a 0 to 1 into whatever the object is. This is still fine because we are using setvaluenotifyinghost however it does render the != operator meaningless (because value is not 0 to 1 and normalised value is 0 to 1). This is very aparent in the AudioParameterInt class when you try to change from 1 to the maximum value, it will not change because in that case, value == normalisedValue. An easy fix for this is to change the operator= function to this:
const float normalisedValue = range.convertTo0to1 (newValue); if (range.convert0to1(value) != normalisedValue) setValueNotifyingHost (normalisedValue);
or compare value and newValue.
I notice this problem is simmilar with the other types of processor parameters however int is the most likely to run into the problem as it is discrete quantities.