Have interval as constant, and set lower value
This commit is contained in:
parent
7b49e43275
commit
cf2832d462
1 changed files with 5 additions and 2 deletions
|
|
@ -14,6 +14,7 @@
|
|||
#include "pluginterfaces/vst/ivstevents.h"
|
||||
#include "pluginterfaces/vst/ivstparameterchanges.h"
|
||||
#include <ghc/fs_std.hpp>
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
|
||||
template<class T>
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue