From 5aa93592363bda71147281e973466d2b10a34b1d Mon Sep 17 00:00:00 2001 From: Ryzerth Date: Sun, 18 Apr 2021 00:13:32 +0200 Subject: [PATCH] Fixed FM bug --- core/src/dsp/demodulator.h | 3 --- core/src/dsp/filter.h | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/dsp/demodulator.h b/core/src/dsp/demodulator.h index 67126c5..26dd040 100644 --- a/core/src/dsp/demodulator.h +++ b/core/src/dsp/demodulator.h @@ -145,11 +145,8 @@ namespace dsp { } void setDeviation(float deviation) { - std::lock_guard lck(generic_block::ctrlMtx); - generic_block::tempStop(); _deviation = deviation; phasorSpeed = (2 * FL_M_PI) / (_sampleRate / _deviation); - generic_block::tempStart(); } float getDeviation() { diff --git a/core/src/dsp/filter.h b/core/src/dsp/filter.h index b77ac1f..e02bd71 100644 --- a/core/src/dsp/filter.h +++ b/core/src/dsp/filter.h @@ -41,10 +41,12 @@ namespace dsp { } void updateWindow(dsp::filter_window::generic_window* window) { + std::lock_guard lck(generic_block>::ctrlMtx); _window = window; volk_free(taps); tapCount = window->getTapCount(); taps = (float*)volk_malloc(tapCount * sizeof(float), volk_get_alignment()); + bufStart = &buffer[tapCount]; window->createTaps(taps, tapCount); } @@ -52,6 +54,8 @@ namespace dsp { int count = _in->read(); if (count < 0) { return -1; } + generic_block>::ctrlMtx.lock(); + memcpy(bufStart, _in->readBuf, count * sizeof(T)); _in->flush(); @@ -70,6 +74,8 @@ namespace dsp { memmove(buffer, &buffer[count], tapCount * sizeof(T)); + generic_block>::ctrlMtx.unlock(); + return count; }