Fixed stall

This commit is contained in:
Ryzerth
2020-11-02 17:48:17 +01:00
parent fc9bc496cb
commit 35c7f0e3cf
11 changed files with 36 additions and 31 deletions

View File

@@ -1,8 +1,7 @@
#pragma once
#include <dsp/block.h>
#include <dsp/window.h>
#include <spdlog/spdlog.h>
#include <numeric>
namespace dsp {
template <class T>
@@ -46,7 +45,9 @@ namespace dsp {
void setInput(stream<T>* in) {
std::lock_guard<std::mutex> lck(generic_block<PolyphaseResampler<T>>::ctrlMtx);
generic_block<PolyphaseResampler<T>>::tempStop();
generic_block<PolyphaseResampler<T>>::unregisterInput(_in);
_in = in;
generic_block<PolyphaseResampler<T>>::registerInput(_in);
generic_block<PolyphaseResampler<T>>::tempStart();
}
@@ -96,9 +97,10 @@ namespace dsp {
}
int run() {
if constexpr (std::is_same_v<T, float>) { spdlog::warn("======= RESAMP WAITING ========"); }
if constexpr (std::is_same_v<T, float>) { spdlog::warn("--------- RESAMP START --------"); }
count = _in->read();
if (count < 0) {
if constexpr (std::is_same_v<T, float>) { spdlog::warn("--------- RESAMP STOP --------"); }
return -1;
}
@@ -107,8 +109,6 @@ namespace dsp {
memcpy(bufStart, _in->data, count * sizeof(T));
_in->flush();
if constexpr (std::is_same_v<T, float>) { spdlog::warn("======= RESAMP GOT DATA ========"); }
// Write to output
if (out.aquire() < 0) {
return -1;
@@ -136,8 +136,6 @@ namespace dsp {
}
out.write(count);
if constexpr (std::is_same_v<T, float>) { spdlog::warn("======= RESAMP WRITTEN ========"); }
memmove(buffer, &buffer[count], tapCount * sizeof(T));
return count;