From ffefd9cce89e1fb176ec11ddc48c3b1fa9fe94ee Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 2 Jan 2023 21:00:15 +0100 Subject: [PATCH] fixed stereo option not persistent and added todos for ignore silence --- misc_modules/recorder/src/main.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/misc_modules/recorder/src/main.cpp b/misc_modules/recorder/src/main.cpp index 62cf656d..2d92253b 100644 --- a/misc_modules/recorder/src/main.cpp +++ b/misc_modules/recorder/src/main.cpp @@ -24,6 +24,7 @@ #include "wav.h" #define CONCAT(a, b) ((std::string(a) + b).c_str()) +#define SILENCE_LVL 10e-20 SDRPP_MOD_INFO{ /* Name: */ "recorder", @@ -74,6 +75,9 @@ public: if (config.conf[name].contains("audioVolume")) { audioVolume = config.conf[name]["audioVolume"]; } + if (config.conf[name].contains("stereo")) { + stereo = config.conf[name]["stereo"]; + } if (config.conf[name].contains("ignoreSilence")) { ignoreSilence = config.conf[name]["ignoreSilence"]; } @@ -473,15 +477,19 @@ private: } static void complexHandler(dsp::complex_t* data, int count, void* ctx) { - monoHandler((float*)data, count, ctx); + RecorderModule* _this = (RecorderModule*)ctx; + _this->writer.write((float*)data, count); } static void stereoHandler(dsp::stereo_t* data, int count, void* ctx) { - monoHandler((float*)data, count, ctx); + RecorderModule* _this = (RecorderModule*)ctx; + // TODO: Ignore silence + _this->writer.write((float*)data, count); } static void monoHandler(float* data, int count, void* ctx) { RecorderModule* _this = (RecorderModule*)ctx; + // TODO: Ignore silence _this->writer.write(data, count); }