mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2026-04-19 14:52:43 +00:00
new stuff
This commit is contained in:
@@ -151,27 +151,29 @@ namespace dsp {
|
||||
}
|
||||
|
||||
void bufferWorker() {
|
||||
complex_t* buf = new complex_t[_keep];
|
||||
T* buf = new T[_keep];
|
||||
bool delay = _skip < 0;
|
||||
|
||||
int readCount = std::min<int>(_keep + _skip, _keep);
|
||||
int skip = std::max<int>(_skip, 0);
|
||||
int delaySize = (-_skip) * sizeof(complex_t);
|
||||
int delaySize = (-_skip) * sizeof(T);
|
||||
int delayCount = (-_skip);
|
||||
|
||||
complex_t* start = &buf[std::max<int>(-_skip, 0)];
|
||||
complex_t* delayStart = &buf[_keep + _skip];
|
||||
T* start = &buf[std::max<int>(-_skip, 0)];
|
||||
T* delayStart = &buf[_keep + _skip];
|
||||
|
||||
while (true) {
|
||||
if (delay) {
|
||||
memmove(buf, delayStart, delaySize);
|
||||
for (int i = 0; i < delayCount; i++) {
|
||||
buf[i].i /= 10.0f;
|
||||
buf[i].q /= 10.0f;
|
||||
if constexpr (std::is_same_v<T, complex_t> || std::is_same_v<T, stereo_t>) {
|
||||
for (int i = 0; i < delayCount; i++) {
|
||||
buf[i].i /= 10.0f;
|
||||
buf[i].q /= 10.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ringBuf.readAndSkip(start, readCount, skip) < 0) { break; };
|
||||
memcpy(out.writeBuf, buf, _keep * sizeof(complex_t));
|
||||
memcpy(out.writeBuf, buf, _keep * sizeof(T));
|
||||
if (!out.swap(_keep)) { break; }
|
||||
}
|
||||
delete[] buf;
|
||||
|
||||
Reference in New Issue
Block a user