This commit is contained in:
Ryzerth 2020-11-03 19:22:53 +01:00
parent cee6af1e14
commit 5d320fdd53
3 changed files with 17 additions and 19 deletions

View File

@ -69,7 +69,7 @@ namespace dsp {
} }
virtual void doStart() { virtual void doStart() {
workerThread = std::thread(&generic_block::workerLoop, this); workerThread = std::thread(&generic_block<BLOCK>::workerLoop, this);
} }
virtual void doStop() { virtual void doStop() {

View File

@ -92,6 +92,7 @@ namespace dsp {
taps[tapCount - i - 1] = taps[i] * (float)_interp; taps[tapCount - i - 1] = taps[i] * (float)_interp;
taps[i] = tap * (float)_interp; taps[i] = tap * (float)_interp;
} }
bufStart = &buffer[tapCount];
generic_block<PolyphaseResampler<T>>::tempStart(); generic_block<PolyphaseResampler<T>>::tempStart();
} }
@ -99,7 +100,7 @@ namespace dsp {
return (in * _interp) / _decim; return (in * _interp) / _decim;
} }
int run() { virtual int run() override {
count = _in->read(); count = _in->read();
if (count < 0) { if (count < 0) {
return -1; return -1;
@ -107,7 +108,7 @@ namespace dsp {
int outCount = calcOutSize(count); int outCount = calcOutSize(count);
memcpy(bufStart, _in->data, count * sizeof(T)); memcpy(&buffer[tapCount], _in->data, count * sizeof(T));
_in->flush(); _in->flush();
// Write to output // Write to output
@ -115,21 +116,19 @@ namespace dsp {
return -1; return -1;
} }
int outIndex = 0; int outIndex = 0;
// if constexpr (std::is_same_v<T, float>) { if constexpr (std::is_same_v<T, float>) {
// // for (int i = 0; outIndex < outCount; i += _decim) { for (int i = 0; i < count; i++) {
// // out.data[outIndex] = 0; buffer[tapCount + i] = 1.0f;
// // for (int j = i % _interp; j < tapCount; j += _interp) { }
// // out.data[outIndex] += buffer[((i - j) / _interp) + tapCount] * taps[j]; for (int i = 0; outIndex < outCount; i += _decim) {
// // } out.data[outIndex] = 0;
// // outIndex++; for (int j = i % _interp; j < tapCount; j += _interp) {
// // } out.data[outIndex] += buffer[((i - j) / _interp) + tapCount] * taps[j];
// for (int i = 0; i < outCount; i++) { }
// out.data[i] = 1.0f; outIndex++;
// } }
// } }
if constexpr (std::is_same_v<T, complex_t>) { if constexpr (std::is_same_v<T, complex_t>) {
static_assert(std::is_same_v<T, complex_t>);
spdlog::warn("{0}", outCount);
for (int i = 0; outIndex < outCount; i += _decim) { for (int i = 0; outIndex < outCount; i += _decim) {
out.data[outIndex].i = 0; out.data[outIndex].i = 0;
out.data[outIndex].q = 0; out.data[outIndex].q = 0;

View File

@ -287,7 +287,6 @@ private:
} }
static void _worker(SoapyModule* _this) { static void _worker(SoapyModule* _this) {
spdlog::info("SOAPY: WORKER STARTED {0}", _this->sampleRate);
int blockSize = _this->sampleRate / 200.0f; int blockSize = _this->sampleRate / 200.0f;
int flags = 0; int flags = 0;
long long timeMs = 0; long long timeMs = 0;