[pulseaudio-discuss] [PATCH 2/3] alsa: Default to 30% in absence of sink hw volume

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Sun Nov 16 00:10:28 PST 2014


If a sound card has no hardware volume that we could query when
creating a sink, 30% is a better default volume than 100%. 100% is
likely to be far too loud.
---
 src/modules/alsa/alsa-sink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 4ab3a22..6db56db 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -2387,6 +2387,10 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     } else {
         if (u->sink->get_volume)
             u->sink->get_volume(u->sink);
+        else {
+            /* Default to 30% volume to avoid being too loud. */
+            pa_cvolume_set(&u->sink->real_volume, u->sink->sample_spec.channels, PA_VOLUME_NORM * 0.3);
+        }
     }
 
     if (mute_is_set) {
-- 
1.9.3



More information about the pulseaudio-discuss mailing list