diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index ed6924ef..7cde0c04 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -610,6 +610,7 @@ void OscirenderAudioProcessor::processBlock(juce::AudioBuffer& buffer, ju volumeBuffer[volumeBufferIndex] = (left * left + right * right) / 2; squaredVolume += volumeBuffer[volumeBufferIndex] / volumeBuffer.size(); currentVolume = std::sqrt(squaredVolume); + currentVolume = juce::jlimit(0.0, 1.0, currentVolume); Vector2 channels; if (totalNumOutputChannels >= 2) { diff --git a/Source/audio/EffectParameter.h b/Source/audio/EffectParameter.h index 3027a7b5..88fc2aaa 100644 --- a/Source/audio/EffectParameter.h +++ b/Source/audio/EffectParameter.h @@ -111,9 +111,6 @@ public: // opt to not change any values if not found void load(juce::XmlElement* xml) { - if (xml->hasAttribute("value")) { - setUnnormalisedValueNotifyingHost(xml->getDoubleAttribute("value")); - } if (xml->hasAttribute("min")) { min = xml->getDoubleAttribute("min"); } @@ -123,6 +120,9 @@ public: if (xml->hasAttribute("step")) { step = xml->getDoubleAttribute("step"); } + if (xml->hasAttribute("value")) { + setUnnormalisedValueNotifyingHost(xml->getDoubleAttribute("value")); + } } private: @@ -237,15 +237,15 @@ public: // opt to not change any values if not found void load(juce::XmlElement* xml) { - if (xml->hasAttribute("value")) { - setUnnormalisedValueNotifyingHost(xml->getIntAttribute("value")); - } if (xml->hasAttribute("min")) { min = xml->getIntAttribute("min"); } if (xml->hasAttribute("max")) { max = xml->getIntAttribute("max"); } + if (xml->hasAttribute("value")) { + setUnnormalisedValueNotifyingHost(xml->getIntAttribute("value")); + } } private: diff --git a/osci-render.jucer b/osci-render.jucer index 0505817c..be5b4768 100644 --- a/osci-render.jucer +++ b/osci-render.jucer @@ -5,7 +5,7 @@ pluginCharacteristicsValue="pluginProducesMidiOut,pluginWantsMidiIn" pluginManufacturer="jameshball" aaxIdentifier="sh.ball.oscirender" cppLanguageStandard="20" projectLineFeed=" " headerPath="./include" - version="2.0.4" companyName="James H Ball" companyWebsite="https://osci-render.com" + version="2.0.5" companyName="James H Ball" companyWebsite="https://osci-render.com" companyEmail="james@ball.sh">