mixer/All: auto-open "global" mixers

If a mixer is "global", it is available even if the output isn't
open.  However, since the check was changed from IsEnabled() to
IsReallyEnabled(), enabled outputs have not yet been used have not
been "really" enabled yet, preventing using the mixer.

Fixes a regression by commit 35dbc1a90c
(part of https://github.com/MusicPlayerDaemon/MPD/pull/1480).

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1563
This commit is contained in:
Max Kellermann 2022-07-08 10:35:09 +02:00
parent 2d7181105d
commit 47680f936b
3 changed files with 9 additions and 1 deletions

1
NEWS
View File

@ -5,6 +5,7 @@ ver 0.23.8 (not yet released)
- pipewire: fix crash with PipeWire 0.3.53
* mixer
- better error messages
- alsa: fix setting volume before playback starts
* support libfmt 9
ver 0.23.7 (2022/05/09)

View File

@ -91,7 +91,10 @@ output_mixer_set_volume(AudioOutputControl &ao, unsigned volume)
/* software mixers are always updated, even if they are
disabled */
if (!ao.IsReallyEnabled() && !mixer->IsPlugin(software_mixer_plugin))
if (!mixer->IsPlugin(software_mixer_plugin) &&
/* "global" mixers can be used even if the output hasn't
been used yet */
!(mixer->IsGlobal() ? ao.IsEnabled() : ao.IsReallyEnabled()))
return SetVolumeResult::DISABLED;
try {

View File

@ -63,6 +63,10 @@ public:
return &plugin == &other;
}
bool IsGlobal() const noexcept {
return plugin.global;
}
/**
* Open mixer device
*