mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:27:48 +02:00
Save the "Mute Microphone" setting
This commit is contained in:
parent
29d5574d93
commit
7780db813d
1 changed files with 12 additions and 0 deletions
|
@ -25,6 +25,8 @@ QString Audio::DESKTOP { "Desktop" };
|
||||||
QString Audio::HMD { "VR" };
|
QString Audio::HMD { "VR" };
|
||||||
|
|
||||||
Setting::Handle<bool> enableNoiseReductionSetting { QStringList { Audio::AUDIO, "NoiseReduction" }, true };
|
Setting::Handle<bool> enableNoiseReductionSetting { QStringList { Audio::AUDIO, "NoiseReduction" }, true };
|
||||||
|
Setting::Handle<bool> mutedSetting { QStringList{ Audio::AUDIO, "MuteMicrophone" }, false };
|
||||||
|
|
||||||
|
|
||||||
float Audio::loudnessToLevel(float loudness) {
|
float Audio::loudnessToLevel(float loudness) {
|
||||||
float level = loudness * (1/32768.0f); // level in [0, 1]
|
float level = loudness * (1/32768.0f); // level in [0, 1]
|
||||||
|
@ -42,6 +44,7 @@ Audio::Audio() : _devices(_contextIsHMD) {
|
||||||
connect(this, &Audio::contextChanged, &_devices, &AudioDevices::onContextChanged);
|
connect(this, &Audio::contextChanged, &_devices, &AudioDevices::onContextChanged);
|
||||||
enableNoiseReduction(enableNoiseReductionSetting.get());
|
enableNoiseReduction(enableNoiseReductionSetting.get());
|
||||||
onContextChanged();
|
onContextChanged();
|
||||||
|
setMuted(mutedSetting.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Audio::startRecording(const QString& filepath) {
|
bool Audio::startRecording(const QString& filepath) {
|
||||||
|
@ -89,6 +92,15 @@ bool Audio::noiseReductionEnabled() const {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Audio::onMutedChanged() {
|
||||||
|
bool isMuted = DependencyManager::get<AudioClient>()->isMuted();
|
||||||
|
if (_isMuted != isMuted) {
|
||||||
|
_isMuted = isMuted;
|
||||||
|
mutedSetting.set(_isMuted);
|
||||||
|
emit mutedChanged(_isMuted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Audio::enableNoiseReduction(bool enable) {
|
void Audio::enableNoiseReduction(bool enable) {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
|
|
Loading…
Reference in a new issue