Commit 02b00f91 authored by Max Kellermann's avatar Max Kellermann

output/PipeWire: don't force initial volume=100%

parent e807ed58
...@@ -10,6 +10,7 @@ ver 0.23.8 (not yet released) ...@@ -10,6 +10,7 @@ ver 0.23.8 (not yet released)
- alsa: fix setting volume before playback starts - alsa: fix setting volume before playback starts
- pipewire: fix crash bug - pipewire: fix crash bug
- pipewire: fix volume change events with PipeWire 0.3.53 - pipewire: fix volume change events with PipeWire 0.3.53
- pipewire: don't force initial volume=100%
* support libfmt 9 * support libfmt 9
ver 0.23.7 (2022/05/09) ver 0.23.7 (2022/05/09)
......
...@@ -89,8 +89,12 @@ class PipeWireOutput final : AudioOutput { ...@@ -89,8 +89,12 @@ class PipeWireOutput final : AudioOutput {
/** /**
* The current volume level (0.0 .. 1.0). * 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; PipeWireMixer *mixer = nullptr;
unsigned channels; unsigned channels;
...@@ -669,6 +673,7 @@ PipeWireOutput::ParamChanged([[maybe_unused]] uint32_t id, ...@@ -669,6 +673,7 @@ PipeWireOutput::ParamChanged([[maybe_unused]] uint32_t id,
if (restore_volume) { if (restore_volume) {
restore_volume = false; restore_volume = false;
if (volume >= 0) {
try { try {
::SetVolume(*stream, channels, volume); ::SetVolume(*stream, channels, volume);
} catch (...) { } catch (...) {
...@@ -677,6 +682,7 @@ PipeWireOutput::ParamChanged([[maybe_unused]] uint32_t id, ...@@ -677,6 +682,7 @@ PipeWireOutput::ParamChanged([[maybe_unused]] uint32_t id,
std::current_exception()); std::current_exception());
} }
} }
}
#if defined(ENABLE_DSD) && defined(SPA_AUDIO_DSD_FLAG_NONE) #if defined(ENABLE_DSD) && defined(SPA_AUDIO_DSD_FLAG_NONE)
if (use_dsd && id == SPA_PARAM_Format && param != nullptr) if (use_dsd && id == SPA_PARAM_Format && param != nullptr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment