fixed build for volk 1.x

pull/1010/head
AlexandreRouma 2023-03-02 15:19:16 +01:00
rodzic 6f9dacdd53
commit 4283cacae6
1 zmienionych plików z 14 dodań i 10 usunięć

Wyświetl plik

@ -488,11 +488,14 @@ private:
static void stereoHandler(dsp::stereo_t* data, int count, void* ctx) { static void stereoHandler(dsp::stereo_t* data, int count, void* ctx) {
RecorderModule* _this = (RecorderModule*)ctx; RecorderModule* _this = (RecorderModule*)ctx;
if (_this->ignoreSilence) { if (_this->ignoreSilence) {
uint32_t minId = 0; float absMax = 0.0f;
uint32_t maxId = 0; float* _data = (float*)data;
volk_32f_index_min_32u(&minId, (float*)data, count * 2); int _count = count * 2;
volk_32f_index_max_32u(&maxId, (float*)data, count * 2); for (int i = 0; i < _count; i++) {
_this->ignoringSilence = (std::max<float>(fabsf(((float*)data)[minId]), fabsf(((float*)data)[maxId])) < SILENCE_LVL); float val = fabsf(_data[i]);
if (val > absMax) { absMax = val; }
}
_this->ignoringSilence = (absMax < SILENCE_LVL);
if (_this->ignoringSilence) { return; } if (_this->ignoringSilence) { return; }
} }
_this->writer.write((float*)data, count); _this->writer.write((float*)data, count);
@ -501,11 +504,12 @@ private:
static void monoHandler(float* data, int count, void* ctx) { static void monoHandler(float* data, int count, void* ctx) {
RecorderModule* _this = (RecorderModule*)ctx; RecorderModule* _this = (RecorderModule*)ctx;
if (_this->ignoreSilence) { if (_this->ignoreSilence) {
uint32_t minId = 0; float absMax = 0.0f;
uint32_t maxId = 0; for (int i = 0; i < count; i++) {
volk_32f_index_min_32u(&minId, data, count); float val = fabsf(data[i]);
volk_32f_index_max_32u(&maxId, data, count); if (val > absMax) { absMax = val; }
_this->ignoringSilence = (std::max<float>(fabsf(data[minId]), fabsf(data[maxId])) < SILENCE_LVL); }
_this->ignoringSilence = (absMax < SILENCE_LVL);
if (_this->ignoringSilence) { return; } if (_this->ignoringSilence) { return; }
} }
_this->writer.write(data, count); _this->writer.write(data, count);