From 8b1b85565440034798f4e0cd8ef79cc88d358e98 Mon Sep 17 00:00:00 2001 From: hogliux Date: Tue, 12 Jul 2016 12:33:36 +0100 Subject: [PATCH] Throttle repaints when repainting in a plug-in to avoid steppy automation --- .../native/juce_mac_NSViewComponentPeer.mm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index a19e2b8bd2..341eb1006f 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -877,9 +877,16 @@ public: void handleAsyncUpdate() override { + #if JucePlugin_Build_AAX || JucePlugin_Build_RTAS || JucePlugin_Build_AUv3 || JucePlugin_Build_AU || JucePlugin_Build_VST3 || JucePlugin_Build_VST + const bool shouldThrottle = true; + #else + const bool shouldThrottle = areAnyWindowsInLiveResize(); + #endif + // When windows are being resized, artificially throttling high-frequency repaints helps - // to stop the event queue getting clogged, and keeps everything working smoothly - if (areAnyWindowsInLiveResize() + // to stop the event queue getting clogged, and keeps everything working smoothly. + // For some reason Logic also needs this throttling to recored parameter events correctly. + if (shouldThrottle && Time::getCurrentTime() < lastRepaintTime + RelativeTime::milliseconds (1000 / 30)) { triggerAsyncUpdate();