1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-17 00:44:19 +00:00

Fixes for the operator= implementations of the AudioParameterXXX classes

This commit is contained in:
jules 2016-02-18 10:30:17 +00:00
parent 613aaa765a
commit 8622ec4004

View file

@ -59,10 +59,8 @@ String AudioParameterFloat::getText (float v, int length) const
AudioParameterFloat& AudioParameterFloat::operator= (float newValue)
{
const float normalisedValue = range.convertTo0to1 (newValue);
if (value != normalisedValue)
setValueNotifyingHost (normalisedValue);
if (value != newValue)
setValueNotifyingHost (range.convertTo0to1 (newValue));
return *this;
}
@ -92,10 +90,8 @@ String AudioParameterInt::getText (float v, int /*length*/) const { retur
AudioParameterInt& AudioParameterInt::operator= (int newValue)
{
const float normalisedValue = convertTo0to1 (newValue);
if (value != normalisedValue)
setValueNotifyingHost (normalisedValue);
if (get() != newValue)
setValueNotifyingHost (convertTo0to1 (newValue));
return *this;
}
@ -120,10 +116,8 @@ String AudioParameterBool::getText (float v, int /*length*/) const { retur
AudioParameterBool& AudioParameterBool::operator= (bool newValue)
{
const float normalisedValue = newValue ? 1.0f : 0.0f;
if (value != normalisedValue)
setValueNotifyingHost (normalisedValue);
if (get() != newValue)
setValueNotifyingHost (newValue ? 1.0f : 0.0f);
return *this;
}
@ -153,10 +147,8 @@ String AudioParameterChoice::getText (float v, int /*length*/) const { retur
AudioParameterChoice& AudioParameterChoice::operator= (int newValue)
{
const float normalisedValue = convertTo0to1 (newValue);
if (value != normalisedValue)
setValueNotifyingHost (normalisedValue);
if (getIndex() != newValue)
setValueNotifyingHost (convertTo0to1 (newValue));
return *this;
}