output/PipeWire: don't force initial volume=100%
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1484
This commit is contained in:
parent
e807ed5870
commit
02b00f9146
1
NEWS
1
NEWS
|
@ -10,6 +10,7 @@ ver 0.23.8 (not yet released)
|
|||
- alsa: fix setting volume before playback starts
|
||||
- pipewire: fix crash bug
|
||||
- pipewire: fix volume change events with PipeWire 0.3.53
|
||||
- pipewire: don't force initial volume=100%
|
||||
* support libfmt 9
|
||||
|
||||
ver 0.23.7 (2022/05/09)
|
||||
|
|
|
@ -89,8 +89,12 @@ class PipeWireOutput final : AudioOutput {
|
|||
|
||||
/**
|
||||
* The current volume level (0.0 .. 1.0).
|
||||
*
|
||||
* This get initialized to -1 which means "unknown", so
|
||||
* restore_volume will not attempt to override PipeWire's
|
||||
* initial volume level.
|
||||
*/
|
||||
float volume = 1.0f;
|
||||
float volume = -1;
|
||||
|
||||
PipeWireMixer *mixer = nullptr;
|
||||
unsigned channels;
|
||||
|
@ -669,12 +673,14 @@ PipeWireOutput::ParamChanged([[maybe_unused]] uint32_t id,
|
|||
if (restore_volume) {
|
||||
restore_volume = false;
|
||||
|
||||
try {
|
||||
::SetVolume(*stream, channels, volume);
|
||||
} catch (...) {
|
||||
FmtError(pipewire_output_domain,
|
||||
FMT_STRING("Failed to restore volume: {}"),
|
||||
std::current_exception());
|
||||
if (volume >= 0) {
|
||||
try {
|
||||
::SetVolume(*stream, channels, volume);
|
||||
} catch (...) {
|
||||
FmtError(pipewire_output_domain,
|
||||
FMT_STRING("Failed to restore volume: {}"),
|
||||
std::current_exception());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue