From bd744d07baf0cb6f4d7fcb477b07ff9836dac550 Mon Sep 17 00:00:00 2001 From: Ryzerth Date: Mon, 26 Jul 2021 22:16:31 +0200 Subject: [PATCH] Final fix for the linux crash --- core/src/signal_path/dsp.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/signal_path/dsp.cpp b/core/src/signal_path/dsp.cpp index 3584c15c..6dfa553b 100644 --- a/core/src/signal_path/dsp.cpp +++ b/core/src/signal_path/dsp.cpp @@ -135,11 +135,14 @@ void SignalPath::setBuffering(bool enabled) { void SignalPath::setDecimation(int dec) { decimation = dec; + if (running) { split.stop(); } // Stop existing decimators if (!decimators.empty()) { for (auto& decimator : decimators) { decimator->stop(); + } + for (auto& decimator : decimators) { delete decimator; } } @@ -148,12 +151,12 @@ void SignalPath::setDecimation(int dec) { // If no decimation, reconnect if (!dec) { split.setInput(&inputBuffer.out); + if (running) { split.start(); } core::setInputSampleRate(sourceSampleRate); return; } // Create new decimators - if (running) { split.stop(); } for (int i = 0; i < dec; i++) { dsp::HalfDecimator* decimator = new dsp::HalfDecimator((i == 0) ? &inputBuffer.out : &decimators[i-1]->out, &halfBandWindow); if (running) { decimator->start(); }