From 618454e7c07b83c392216be288030eb6266c9c5c Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 22 Sep 2019 17:17:13 -0400 Subject: [PATCH] Stop engine wprker threads when engine is paused. --- CHANGELOG.md | 2 ++ src/engine/Engine.cpp | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eddb5de4..9b9f3416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ In this document, Mod is Ctrl on Windows/Linux and Cmd on Mac. - Swap order of tags and brands in Module Browser. - Disable smoothing for MIDI CC buttons in MIDI-Map. - Automatically unzip update on Mac. +- Core + - Fix sustain pedal release bug when using polyphonic mode in MIDI-CV. - API - Add libsamplerate library. diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index 82c22915..ee0e64b8 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -429,12 +429,12 @@ static void Engine_run(Engine* that) { aheadTime = 0.0; } - // Launch workers - if (internal->threadCount != settings::threadCount || internal->realTime != settings::realTime) { - Engine_relaunchWorkers(that, settings::threadCount, settings::realTime); - } - if (!internal->paused) { + // Launch workers + if (internal->threadCount != settings::threadCount || internal->realTime != settings::realTime) { + Engine_relaunchWorkers(that, settings::threadCount, settings::realTime); + } + std::lock_guard lock(internal->mutex); // Update expander pointers @@ -448,6 +448,12 @@ static void Engine_run(Engine* that) { Engine_step(that); } } + else { + // Stop workers while closed + if (internal->threadCount != 1) { + Engine_relaunchWorkers(that, 1, settings::realTime); + } + } double stepTime = mutexSteps * internal->sampleTime; aheadTime += stepTime;