From 65ac71a2aa41eb341ac3d2901d5229326c3cd500 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Wed, 17 Mar 2021 11:44:14 +0100 Subject: [PATCH] Add and remove timers only when a frame is active --- plugins/editor/src/editor/Editor.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/editor/src/editor/Editor.cpp b/plugins/editor/src/editor/Editor.cpp index fba6c418..b11c9e4c 100644 --- a/plugins/editor/src/editor/Editor.cpp +++ b/plugins/editor/src/editor/Editor.cpp @@ -245,11 +245,6 @@ Editor::Editor(EditorController& ctrl) ctrl.decorate(&impl); impl.createFrameContents(); - - uint32_t oscSendInterval = 1; // milliseconds - impl.oscSendQueueTimer_ = makeOwned( - [this](CVSTGUITimer* timer) { impl_->tickOSCQueue(timer); }, - oscSendInterval, false); } Editor::~Editor() @@ -275,6 +270,11 @@ void Editor::open(CFrame& frame) impl_->sendQueuedOSC("/mem/buffers", "", nullptr); }, 1000, true); + uint32_t oscSendInterval = 1; // milliseconds + impl.oscSendQueueTimer_ = makeOwned( + [this](CVSTGUITimer* timer) { impl_->tickOSCQueue(timer); }, + oscSendInterval, false); + // request the whole Key and CC information impl.sendQueuedOSC("/key/slots", "", nullptr); impl.sendQueuedOSC("/sw/last/slots", "", nullptr); @@ -286,6 +286,7 @@ void Editor::close() Impl& impl = *impl_; impl.clearQueuedOSC(); + impl.oscSendQueueTimer_ = nullptr; impl.memQueryTimer_ = nullptr;