fixed stereo option not persistent and added todos for ignore silence

This commit is contained in:
AlexandreRouma 2023-01-02 21:00:15 +01:00
parent 4d890e78ed
commit ffefd9cce8

View File

@ -24,6 +24,7 @@
#include "wav.h" #include "wav.h"
#define CONCAT(a, b) ((std::string(a) + b).c_str()) #define CONCAT(a, b) ((std::string(a) + b).c_str())
#define SILENCE_LVL 10e-20
SDRPP_MOD_INFO{ SDRPP_MOD_INFO{
/* Name: */ "recorder", /* Name: */ "recorder",
@ -74,6 +75,9 @@ public:
if (config.conf[name].contains("audioVolume")) { if (config.conf[name].contains("audioVolume")) {
audioVolume = config.conf[name]["audioVolume"]; audioVolume = config.conf[name]["audioVolume"];
} }
if (config.conf[name].contains("stereo")) {
stereo = config.conf[name]["stereo"];
}
if (config.conf[name].contains("ignoreSilence")) { if (config.conf[name].contains("ignoreSilence")) {
ignoreSilence = config.conf[name]["ignoreSilence"]; ignoreSilence = config.conf[name]["ignoreSilence"];
} }
@ -473,15 +477,19 @@ private:
} }
static void complexHandler(dsp::complex_t* data, int count, void* ctx) { 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) { 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) { static void monoHandler(float* data, int count, void* ctx) {
RecorderModule* _this = (RecorderModule*)ctx; RecorderModule* _this = (RecorderModule*)ctx;
// TODO: Ignore silence
_this->writer.write(data, count); _this->writer.write(data, count);
} }