From ceb601af64d5c4de41b0ebf61cd59adb6a4b188f Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 1 Aug 2022 16:53:20 +0100 Subject: [PATCH] LV2 Host: For parameters with scale points, correctly convert values to text --- .../format_types/juce_LV2PluginFormat.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp index 9ac149d798..cc27e250a9 100644 --- a/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp @@ -2507,7 +2507,7 @@ public: // In this case, we find the closest label by searching the midpoints of the scale // point values. const auto index = std::distance (midPoints.begin(), - std::lower_bound (midPoints.begin(), midPoints.end(), normalisedValue)); + std::lower_bound (midPoints.begin(), midPoints.end(), denormalised)); jassert (isPositiveAndBelow (index, info.scalePoints.size())); return info.scalePoints[(size_t) index].label; } @@ -2549,6 +2549,7 @@ private: return {}; std::vector result; + result.reserve (set.size() - 1); for (auto it = std::next (set.begin()); it != set.end(); ++it) result.push_back ((std::prev (it)->value + it->value) * 0.5f);