From 1df59f74697fa143ac41dde6fdd2913500c43731 Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 6 May 2021 19:51:18 +0100 Subject: [PATCH] VST3 Host: Only send updates for modified parameters --- .../juce_audio_processors/format_types/juce_VST3Common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/juce_audio_processors/format_types/juce_VST3Common.h b/modules/juce_audio_processors/format_types/juce_VST3Common.h index 99355fdc6f..b90722e5d8 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3Common.h +++ b/modules/juce_audio_processors/format_types/juce_VST3Common.h @@ -942,9 +942,9 @@ public: void set (size_t index, float value) { jassert (index < size()); - values[index].store (value, std::memory_order_relaxed); - flags[index / numFlagBits].fetch_or ((FlagType) 1 << (index % numFlagBits), - std::memory_order_acq_rel); + const auto previous = values[index].exchange (value, std::memory_order_relaxed); + const auto bit = previous == value ? ((FlagType) 0) : ((FlagType) 1 << (index % numFlagBits)); + flags[index / numFlagBits].fetch_or (bit, std::memory_order_acq_rel); } float get (size_t index) const noexcept