From 8622ec40044f315c7516cb897b3bcf5e3cdcd47e Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 18 Feb 2016 10:30:17 +0000 Subject: [PATCH] Fixes for the operator= implementations of the AudioParameterXXX classes --- .../juce_AudioProcessorParameters.cpp | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/modules/juce_audio_processors/utilities/juce_AudioProcessorParameters.cpp b/modules/juce_audio_processors/utilities/juce_AudioProcessorParameters.cpp index 5cb8c8c891..858a396b98 100644 --- a/modules/juce_audio_processors/utilities/juce_AudioProcessorParameters.cpp +++ b/modules/juce_audio_processors/utilities/juce_AudioProcessorParameters.cpp @@ -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; }