Skip to content

Commit 0677e32

Browse files
committed
Adjust backup scheduler rate, only run when GUI is visible
1 parent 90c2677 commit 0677e32

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Source/PluginProcessor.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,8 @@ void PluginProcessor::prepareToPlay(double const sampleRate, int const samplesPe
602602
smoothedGain.reset(AudioProcessor::getSampleRate(), 0.02);
603603

604604
if(!ProjectInfo::isStandalone) {
605-
backupRunLoopInterval = static_cast<int>((samplesPerBlock / sampleRate) * 4000.0);
606-
backupRunLoopInterval = jmax(32, backupRunLoopInterval);
605+
backupRunLoopInterval = static_cast<int>((samplesPerBlock / sampleRate) * 2000.0);
606+
backupRunLoopInterval = jmax(24, backupRunLoopInterval);
607607
backupRunLoop.startTimer(backupRunLoopInterval * 32);
608608
}
609609
}
@@ -1427,6 +1427,9 @@ void PluginProcessor::runBackupLoop()
14271427
{
14281428
if(ProjectInfo::isStandalone) return;
14291429

1430+
// Only run backup timer if GUI is visible
1431+
if(!getActiveEditor()) return;
1432+
14301433
int blocksToProcess = backupRunLoopInterval / (int)((DEFDACBLKSIZE / AudioProcessor::getSampleRate()) * 1000.0);
14311434
if(blocksToProcess < 1)
14321435
{

0 commit comments

Comments
 (0)