pull/40/head
Ryzerth 2020-11-03 19:22:53 +01:00
rodzic cee6af1e14
commit 5d320fdd53
3 zmienionych plików z 17 dodań i 19 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -287,7 +287,6 @@ private:
}
static void _worker(SoapyModule* _this) {
spdlog::info("SOAPY: WORKER STARTED {0}", _this->sampleRate);
int blockSize = _this->sampleRate / 200.0f;
int flags = 0;
long long timeMs = 0;
@ -297,7 +296,7 @@ private:
int res = _this->dev->readStream(_this->devStream, (void**)&_this->stream.data, blockSize, flags, timeMs);
if (res < 1) {
continue;
}
}
_this->stream.write(res);
}
}