UI: Default mixer volume meter to two channels

If OBS is set to mono, it will still default to mono.
Also corrects a somewhat related comment (which was also wrong before
this change)
This commit is contained in:
gxalpha 2022-04-15 19:13:14 +02:00 committed by Matt Gajownik
parent 283f7edfd7
commit 2422deb78a

View File

@ -750,6 +750,14 @@ inline void VolumeMeter::resetLevels()
bool VolumeMeter::needLayoutChange()
{
int currentNrAudioChannels = obs_volmeter_get_nr_channels(obs_volmeter);
if (!currentNrAudioChannels) {
struct obs_audio_info oai;
obs_get_audio_info(&oai);
currentNrAudioChannels = (oai.speakers == SPEAKERS_MONO) ? 1
: 2;
}
if (displayNrAudioChannels != currentNrAudioChannels) {
displayNrAudioChannels = currentNrAudioChannels;
recalculateLayout = true;
@ -758,8 +766,9 @@ bool VolumeMeter::needLayoutChange()
return recalculateLayout;
}
// When this is called from the constructor, obs_volmeter_get_nr_channels returns 1
// and Q_PROPERTY settings have not yet been read from the stylesheet.
// When this is called from the constructor, obs_volmeter_get_nr_channels has not
// yet been called and Q_PROPERTY settings have not yet been read from the
// stylesheet.
inline void VolumeMeter::doLayout()
{
QMutexLocker locker(&dataMutex);