Added persistent recorder volume

This commit is contained in:
AlexandreRouma 2021-11-23 22:35:09 +01:00
parent fc7d902c1d
commit e394b64ad3
2 changed files with 11 additions and 1 deletions

View File

@ -288,6 +288,7 @@ namespace dsp {
void init(stream<T>* in, float volume) { void init(stream<T>* in, float volume) {
_in = in; _in = in;
_volume = volume; _volume = volume;
level = powf(_volume, 2);
generic_block<Volume<T>>::registerInput(_in); generic_block<Volume<T>>::registerInput(_in);
generic_block<Volume<T>>::registerOutput(&out); generic_block<Volume<T>>::registerOutput(&out);
generic_block<Volume<T>>::_block_init = true; generic_block<Volume<T>>::_block_init = true;

View File

@ -60,16 +60,22 @@ public:
config.conf[name]["mode"] = RECORDER_MODE_AUDIO; config.conf[name]["mode"] = RECORDER_MODE_AUDIO;
config.conf[name]["recPath"] = "%ROOT%/recordings"; config.conf[name]["recPath"] = "%ROOT%/recordings";
config.conf[name]["audioStream"] = "Radio"; config.conf[name]["audioStream"] = "Radio";
config.conf[name]["audioVolume"] = 1.0;
created = true; created = true;
} }
if (!config.conf[name].contains("audioVolume")) {
config.conf[name]["audioVolume"] = 1.0;
}
recMode = config.conf[name]["mode"]; recMode = config.conf[name]["mode"];
folderSelect.setPath(config.conf[name]["recPath"]); folderSelect.setPath(config.conf[name]["recPath"]);
selectedStreamName = config.conf[name]["audioStream"]; selectedStreamName = config.conf[name]["audioStream"];
audioVolume = config.conf[name]["audioVolume"];
config.release(created); config.release(created);
// Init audio path // Init audio path
vol.init(&dummyStream, 1.0f); vol.init(&dummyStream, audioVolume);
audioSplit.init(&vol.out); audioSplit.init(&vol.out);
audioSplit.bindStream(&meterStream); audioSplit.bindStream(&meterStream);
meter.init(&meterStream); meter.init(&meterStream);
@ -278,6 +284,9 @@ private:
if (ImGui::SliderFloat(CONCAT("##_recorder_vol_", name), &audioVolume, 0, 1, "")) { if (ImGui::SliderFloat(CONCAT("##_recorder_vol_", name), &audioVolume, 0, 1, "")) {
vol.setVolume(audioVolume); vol.setVolume(audioVolume);
config.acquire();
config.conf[name]["audioVolume"] = audioVolume;
config.release(true);
} }
ImGui::PopItemWidth(); ImGui::PopItemWidth();