From 4f43b9f2b0176a2e0d667782097497b79adbae70 Mon Sep 17 00:00:00 2001 From: Mark Adams Date: Sun, 12 Jan 2025 19:23:16 -0500 Subject: [PATCH] Bugfix/dont realloc active kit rows (#3275) * only reallocate if were saving a reasonable amount of space * dont free the active row memory when drums stop playing, limit note ons a bit more at high direness --- src/deluge/dsp/delay/delay.cpp | 2 +- src/deluge/model/instrument/kit.cpp | 1 + src/deluge/processing/engines/audio_engine.cpp | 4 +++- src/deluge/storage/audio/audio_file.cpp | 2 -- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/deluge/dsp/delay/delay.cpp b/src/deluge/dsp/delay/delay.cpp index 2e68c2d77f..9870fd83ab 100644 --- a/src/deluge/dsp/delay/delay.cpp +++ b/src/deluge/dsp/delay/delay.cpp @@ -254,7 +254,7 @@ void Delay::process(std::span buffer, const State& delayWorkingSta // If spinning below native rate, the quality's going to be suffering, so make a new buffer whose native // rate is half our current rate (double the quality) - else if (delayWorkingState.userDelayRate < primaryBuffer.nativeRate()) { + else if (delayWorkingState.userDelayRate < primaryBuffer.nativeRate() >> 1) { initializeSecondaryBuffer(delayWorkingState.userDelayRate >> 1, false); } } diff --git a/src/deluge/model/instrument/kit.cpp b/src/deluge/model/instrument/kit.cpp index 0d60d6bae5..49534db6ac 100644 --- a/src/deluge/model/instrument/kit.cpp +++ b/src/deluge/model/instrument/kit.cpp @@ -50,6 +50,7 @@ namespace params = deluge::modulation::params; Kit::Kit() : Instrument(OutputType::KIT), drumsWithRenderingActive(sizeof(Drum*)) { firstDrum = nullptr; selectedDrum = nullptr; + drumsWithRenderingActive.emptyingShouldFreeMemory = false; } Kit::~Kit() { diff --git a/src/deluge/processing/engines/audio_engine.cpp b/src/deluge/processing/engines/audio_engine.cpp index 947fd50a2b..3ebfa3f944 100644 --- a/src/deluge/processing/engines/audio_engine.cpp +++ b/src/deluge/processing/engines/audio_engine.cpp @@ -1062,7 +1062,9 @@ void routine() { audioRoutineLocked = true; numRoutines = 0; - voicesStartedThisRender = 0; + voicesStartedThisRender = std::max( + cpuDireness - 12, + 0); // if we're at high direness then we pretend a couple have already been started to limit note ons if (!stemExport.processStarted || (stemExport.processStarted && !stemExport.renderOffline)) { while (doSomeOutputting() && numRoutines < 2) { diff --git a/src/deluge/storage/audio/audio_file.cpp b/src/deluge/storage/audio/audio_file.cpp index 70e8cc47f8..83669577dd 100644 --- a/src/deluge/storage/audio/audio_file.cpp +++ b/src/deluge/storage/audio/audio_file.cpp @@ -230,8 +230,6 @@ Error AudioFile::loadFile(AudioFileReader* reader, bool isAiff, bool makeWaveTab D_PRINTLN("play count: %d", loopData[5]); } } - - D_PRINTLN(""); } break; }