From 834890b69ad19f17b86fdfc8c11dc004e344a0ea Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 20 Jun 2022 19:55:13 +0200 Subject: [PATCH] maybe macOS fixes and other --- core/src/dsp/channel/rx_vfo.h | 6 ++++++ core/src/dsp/correction/dc_blocker.h | 7 ++++++- core/src/dsp/multirate/rational_resampler.h | 6 ++++++ core/src/dsp/noise_reduction/squelch.h | 1 + core/src/dsp/sink/ring_buffer.h | 2 +- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/core/src/dsp/channel/rx_vfo.h b/core/src/dsp/channel/rx_vfo.h index b1311b43..66292f0e 100644 --- a/core/src/dsp/channel/rx_vfo.h +++ b/core/src/dsp/channel/rx_vfo.h @@ -10,6 +10,12 @@ namespace dsp::channel { RxVFO(stream* in, double inSamplerate, double outSamplerate, double bandwidth, double offset) { init(in, inSamplerate, outSamplerate, bandwidth, offset); } + ~RxVFO() { + if (!base_type::_block_init) { return; } + base_type::stop(); + taps::free(ftaps); + } + void init(stream* in, double inSamplerate, double outSamplerate, double bandwidth, double offset) { _inSamplerate = inSamplerate; _outSamplerate = outSamplerate; diff --git a/core/src/dsp/correction/dc_blocker.h b/core/src/dsp/correction/dc_blocker.h index 7fcd4975..18ca4c54 100644 --- a/core/src/dsp/correction/dc_blocker.h +++ b/core/src/dsp/correction/dc_blocker.h @@ -14,7 +14,12 @@ namespace dsp::correction { void init(stream* in, double rate) { _rate = rate; - reset(); + if constexpr (std::is_same_v) { + offset = 0.0f; + } + if constexpr (std::is_same_v || std::is_same_v) { + offset = { 0.0f, 0.0f }; + } base_type::init(in); } diff --git a/core/src/dsp/multirate/rational_resampler.h b/core/src/dsp/multirate/rational_resampler.h index 2f61db2a..0b1286ed 100644 --- a/core/src/dsp/multirate/rational_resampler.h +++ b/core/src/dsp/multirate/rational_resampler.h @@ -18,6 +18,12 @@ namespace dsp::multirate { RationalResampler(stream* in, double inSamplerate, double outSamplerate) { init(in, inSamplerate, outSamplerate); } + ~RationalResampler() { + if (!base_type::_block_init) { return; } + base_type::stop(); + taps::free(rtaps); + } + void init(stream* in, double inSamplerate, double outSamplerate) { _inSamplerate = inSamplerate; _outSamplerate = outSamplerate; diff --git a/core/src/dsp/noise_reduction/squelch.h b/core/src/dsp/noise_reduction/squelch.h index 47e56feb..c4ddbee9 100644 --- a/core/src/dsp/noise_reduction/squelch.h +++ b/core/src/dsp/noise_reduction/squelch.h @@ -12,6 +12,7 @@ namespace dsp::noise_reduction { ~Squelch() { if (!base_type::_block_init) { return; } + base_type::stop(); buffer::free(normBuffer); } diff --git a/core/src/dsp/sink/ring_buffer.h b/core/src/dsp/sink/ring_buffer.h index 425d28d1..e6bdbc9a 100644 --- a/core/src/dsp/sink/ring_buffer.h +++ b/core/src/dsp/sink/ring_buffer.h @@ -17,7 +17,7 @@ namespace dsp::sink { int count = base_type::_in->read(); if (count < 0) { return -1; } - + if (data.write(_in->readBuf, count) < 0) { return -1; } base_type::_in->flush(); return count;