void FloatParameter::setNormalizedValue (float nonNormalizedValue)
{
    float newValue = mNormalizableRange.convertTo0to1 (nonNormalizedValue);
    newValue = std::min (newValue, 1.0f);
    newValue = std::max (newValue, 0.0f);
    setValueNotifyingHost (newValue);
}
void ZenDecibelParameter::setValueFromDecibelsNotifyingHost(float inDBValue)
{
	float normValue = DecibelConversions::mapDecibelsToProperNormalizedValue(
		inDBValue, range.start, range.end, midValue);
	setValueNotifyingHost(normValue);
	setValueInGainFromNormalised(value.load());
}
AudioParameterFloat& AudioParameterFloat::operator= (float newValue)
{
    if (value != newValue)
        setValueNotifyingHost (range.convertTo0to1 (newValue));

    return *this;
}
AudioParameterChoice& AudioParameterChoice::operator= (int newValue)
{
    if (getIndex() != newValue)
        setValueNotifyingHost (convertTo0to1 (newValue));

    return *this;
}
AudioParameterBool& AudioParameterBool::operator= (bool newValue)
{
    if (get() != newValue)
        setValueNotifyingHost (newValue ? 1.0f : 0.0f);

    return *this;
}
AudioParameterInt& AudioParameterInt::operator= (int newValue)
{
    if (get() != newValue)
        setValueNotifyingHost (convertTo0to1 (newValue));

    return *this;
}
AudioParameterInt& AudioParameterInt::operator= (int newValue)
{
    const float normalisedValue = convertTo0to1 (newValue);

    if (value != normalisedValue)
        setValueNotifyingHost (normalisedValue);

    return *this;
}
AudioParameterBool& AudioParameterBool::operator= (bool newValue)
{
    const float normalisedValue = newValue ? 1.0f : 0.0f;

    if (value != normalisedValue)
        setValueNotifyingHost (normalisedValue);

    return *this;
}
void ZenDecibelParameter::setUnnormalisedValue(float newUnnormalisedValue)
{
	////DBG("In setUnnormalizedvalue of " << this->paramID << " calling setValueNotifyingHost(decibelValueIn) with: " << newUnnormalisedValue);
	if (value.load() != newUnnormalisedValue)
	{
		const float newValue = DecibelConversions::mapDecibelsToProperNormalizedValue
			(newUnnormalisedValue, range.start, range.end, midValue);
		
		setValueNotifyingHost(newValue);
	}
}
void ZenDecibelParameter::setValueFromGainNotifyingHost(float inGainValue)
{
	float dbValue = getClamped(Decibels::gainToDecibels(inGainValue), range.start, range.end);
	float newNormValue = DecibelConversions::mapDecibelsToProperNormalizedValue(
		dbValue, range.start, range.end, midValue);
	//DBG("In ZenDecibelParameter::setValueFromGainNotifyingHost(inValue) of " << this->paramID << " with invalue: " << inGainValue << " and calling setValueNotifyingHost with value: " << newNormValue);
	
	setValueNotifyingHost(newNormValue);
	setGainValue(inGainValue);

}