diff --git a/plugins/vst/SfizzVstProcessor.cpp b/plugins/vst/SfizzVstProcessor.cpp index 711aa049..b1707fb7 100644 --- a/plugins/vst/SfizzVstProcessor.cpp +++ b/plugins/vst/SfizzVstProcessor.cpp @@ -14,6 +14,7 @@ #include "pluginterfaces/vst/ivstevents.h" #include "pluginterfaces/vst/ivstparameterchanges.h" #include +#include #include template @@ -41,6 +42,8 @@ static const char* kMsgIdNotifyPlayState = "NotifyPlayState"; static const char* kMsgIdReceiveMessage = "ReceiveMessage"; static const char* kMsgIdNoteEvents = "NoteEvents"; +static constexpr std::chrono::milliseconds kBackgroundIdleInterval { 500 }; + SfizzVstProcessor::SfizzVstProcessor() : _fifoToWorker(64 * 1024), _fifoMessageFromUi(64 * 1024), _oscTemp(new uint8_t[kOscTempSize]) @@ -637,7 +640,7 @@ void SfizzVstProcessor::doBackgroundWork() Clock::time_point lastIdleWorkTime; for (;;) { - bool isNotified = _semaToWorker.timed_wait(1000); + bool isNotified = _semaToWorker.timed_wait(kBackgroundIdleInterval.count()); if (!_workRunning) break; @@ -690,7 +693,7 @@ void SfizzVstProcessor::doBackgroundWork() } Clock::time_point currentTime = Clock::now(); - if (!haveDoneIdleWork || currentTime - lastIdleWorkTime > std::chrono::seconds(1)) { + if (!haveDoneIdleWork || currentTime - lastIdleWorkTime > kBackgroundIdleInterval) { doBackgroundIdle(); haveDoneIdleWork = true; lastIdleWorkTime = currentTime;