diff --git a/core/src/dsp/resampling.h b/core/src/dsp/resampling.h index 9aff95b..bd761e6 100644 --- a/core/src/dsp/resampling.h +++ b/core/src/dsp/resampling.h @@ -83,14 +83,14 @@ namespace dsp { void updateWindow(dsp::filter_window::generic_window* window) { std::lock_guard lck(generic_block>::ctrlMtx); - //generic_block>::tempStop(); + generic_block>::tempStop(); _window = window; volk_free(taps); tapCount = window->getTapCount(); taps = (float*)volk_malloc(tapCount * sizeof(float), volk_get_alignment()); window->createTaps(taps, tapCount, _interp); buildTapPhases(); - //generic_block>::tempStart(); + generic_block>::tempStart(); } int calcOutSize(int in) { @@ -103,35 +103,30 @@ namespace dsp { return -1; } - { - std::lock_guard lck(generic_block>::ctrlMtx); - int outCount = calcOutSize(count); - memcpy(&buffer[tapsPerPhase], _in->readBuf, count * sizeof(T)); - _in->flush(); + int outCount = calcOutSize(count); + memcpy(&buffer[tapsPerPhase], _in->readBuf, count * sizeof(T)); + _in->flush(); - // Write to output - int outIndex = 0; - int _interp_m_1 = _interp - 1; - if constexpr (std::is_same_v) { - for (int i = 0; outIndex < outCount; i += _decim) { - int phase = i % _interp; - volk_32f_x2_dot_prod_32f(&out.writeBuf[outIndex], &buffer[i / _interp], tapPhases[phase], tapsPerPhase); - outIndex++; - } + // Write to output + int outIndex = 0; + int _interp_m_1 = _interp - 1; + if constexpr (std::is_same_v) { + for (int i = 0; outIndex < outCount; i += _decim) { + int phase = i % _interp; + volk_32f_x2_dot_prod_32f(&out.writeBuf[outIndex], &buffer[i / _interp], tapPhases[phase], tapsPerPhase); + outIndex++; } - if constexpr (std::is_same_v || std::is_same_v) { - for (int i = 0; outIndex < outCount; i += _decim) { - int phase = i % _interp; - volk_32fc_32f_dot_prod_32fc((lv_32fc_t*)&out.writeBuf[outIndex], (lv_32fc_t*)&buffer[(i / _interp)], tapPhases[phase], tapsPerPhase); - outIndex++; - } - } - if (!out.swap(outCount)) { - return -1; - } - - memmove(buffer, &buffer[count], tapsPerPhase * sizeof(T)); } + if constexpr (std::is_same_v || std::is_same_v) { + for (int i = 0; outIndex < outCount; i += _decim) { + int phase = i % _interp; + volk_32fc_32f_dot_prod_32fc((lv_32fc_t*)&out.writeBuf[outIndex], (lv_32fc_t*)&buffer[(i / _interp)], tapPhases[phase], tapsPerPhase); + outIndex++; + } + } + if (!out.swap(outCount)) { return -1; } + + memmove(buffer, &buffer[count], tapsPerPhase * sizeof(T)); return count; }