From 1a4724ff2178ea6df9b120dfe5ce652a7a5308ea Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Fri, 19 Mar 2021 20:01:15 +0100 Subject: [PATCH] Fix audio tab not supporting mono audio output. (#145) --- src/headers/switch-audio.hpp | 3 ++- src/switch-audio.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/headers/switch-audio.hpp b/src/headers/switch-audio.hpp index c881250f..7eeace18 100644 --- a/src/headers/switch-audio.hpp +++ b/src/headers/switch-audio.hpp @@ -1,5 +1,6 @@ #pragma once #include +#include #include "switch-generic.hpp" #include "volume-control.hpp" @@ -20,7 +21,7 @@ struct AudioSwitch : virtual SceneSwitcherEntry { double duration = 0; bool ignoreInactiveSource = true; unsigned int matchCount = 0; - float peak = -1; + float peak = -std::numeric_limits::infinity(); obs_volmeter_t *volmeter = nullptr; const char *getType() { return "audio"; } diff --git a/src/switch-audio.cpp b/src/switch-audio.cpp index f5177b26..a6ee7b28 100644 --- a/src/switch-audio.cpp +++ b/src/switch-audio.cpp @@ -257,7 +257,7 @@ void AudioSwitch::setVolumeLevel(void *data, UNUSED_PARAMETER(inputPeak); AudioSwitch *s = static_cast(data); - for (int i = 1; i < MAX_AUDIO_CHANNELS; i++) { + for (int i = 0; i < MAX_AUDIO_CHANNELS; i++) { if (peak[i] > s->peak) { s->peak = peak[i]; }