Re: [pulseaudio-discuss] [PATCH 4/4] alsa-mixer: Add force-hw-volume flag to alsa profile sets
'Twas brillig, and Jyri Sarha at 11/04/11 10:19 did gyre and gimble: On Sat, 09 Apr 2011 20:20:40 +0200, David Henningsson david.hennings...@canonical.com wrote: On 2011-04-08 17:18, Colin Guthrie wrote: 'Twas brillig, and o...@iki.fi at 08/04/11 15:18 did gyre and gimble: From: Jyri Sarhajyri.sa...@nokia.com Before this patch, if any of the paths in a path set do not support HW volume then the HW volume is disabled for the whole set. In some cases this is a bit drastic measure. For instance, if all but one of the paths support HW volume and dB there no problem to pretend that we have HW volume for the whole set. The path without any mixers to control will just always return 0 dB and the rest is handled by SW volume. This patch adds a flag to the mapping section of profile set file to enables this behavior. David, this sounds similar to your USB Headset issue from a couple days ago... or am I just reading too much into the description? Sort of - it just feels like neither of us has tried to do the right thing so far - I added a workaround/quirk for a few devices, and this patch adds a setting to turn something on and off. I'd like it to just work. Or put in another way - what's the recommended default setting of this new parameter, and why? Target for my patch was to be non intrusive, but if you agree I can easily change my patch to always behave like force-hw-volume flag was set to true and remove the flag. It is even easier just to change the default for the flag. David, what's you're thinking on Jyri's suggestion here? Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 4/4] alsa-mixer: Add force-hw-volume flag to alsa profile sets
On Sat, 09 Apr 2011 20:20:40 +0200, David Henningsson david.hennings...@canonical.com wrote: On 2011-04-08 17:18, Colin Guthrie wrote: 'Twas brillig, and o...@iki.fi at 08/04/11 15:18 did gyre and gimble: From: Jyri Sarhajyri.sa...@nokia.com Before this patch, if any of the paths in a path set do not support HW volume then the HW volume is disabled for the whole set. In some cases this is a bit drastic measure. For instance, if all but one of the paths support HW volume and dB there no problem to pretend that we have HW volume for the whole set. The path without any mixers to control will just always return 0 dB and the rest is handled by SW volume. This patch adds a flag to the mapping section of profile set file to enables this behavior. David, this sounds similar to your USB Headset issue from a couple days ago... or am I just reading too much into the description? Sort of - it just feels like neither of us has tried to do the right thing so far - I added a workaround/quirk for a few devices, and this patch adds a setting to turn something on and off. I'd like it to just work. Or put in another way - what's the recommended default setting of this new parameter, and why? Target for my patch was to be non intrusive, but if you agree I can easily change my patch to always behave like force-hw-volume flag was set to true and remove the flag. It is even easier just to change the default for the flag. Cheers, Jyri ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 4/4] alsa-mixer: Add force-hw-volume flag to alsa profile sets
On 2011-04-08 17:18, Colin Guthrie wrote: 'Twas brillig, and o...@iki.fi at 08/04/11 15:18 did gyre and gimble: From: Jyri Sarhajyri.sa...@nokia.com Before this patch, if any of the paths in a path set do not support HW volume then the HW volume is disabled for the whole set. In some cases this is a bit drastic measure. For instance, if all but one of the paths support HW volume and dB there no problem to pretend that we have HW volume for the whole set. The path without any mixers to control will just always return 0 dB and the rest is handled by SW volume. This patch adds a flag to the mapping section of profile set file to enables this behavior. David, this sounds similar to your USB Headset issue from a couple days ago... or am I just reading too much into the description? Sort of - it just feels like neither of us has tried to do the right thing so far - I added a workaround/quirk for a few devices, and this patch adds a setting to turn something on and off. I'd like it to just work. Or put in another way - what's the recommended default setting of this new parameter, and why? // David ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 4/4] alsa-mixer: Add force-hw-volume flag to alsa profile sets
From: Jyri Sarha jyri.sa...@nokia.com Before this patch, if any of the paths in a path set do not support HW volume then the HW volume is disabled for the whole set. In some cases this is a bit drastic measure. For instance, if all but one of the paths support HW volume and dB there no problem to pretend that we have HW volume for the whole set. The path without any mixers to control will just always return 0 dB and the rest is handled by SW volume. This patch adds a flag to the mapping section of profile set file to enables this behavior. --- src/modules/alsa/alsa-mixer.c| 51 ++ src/modules/alsa/alsa-mixer.h|3 + src/modules/alsa/mixer/profile-sets/default.conf |3 + 3 files changed, 57 insertions(+), 0 deletions(-) diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index f236da0..027c63a 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -2693,6 +2693,7 @@ pa_alsa_path_set *pa_alsa_path_set_new(pa_alsa_mapping *m, pa_alsa_direction_t d ps = pa_xnew0(pa_alsa_path_set, 1); ps-direction = direction; +ps-force_hw_volume = m-force_hw_volume; if (direction == PA_ALSA_DIRECTION_OUTPUT) pn = m-output_path_names; @@ -2816,6 +2817,25 @@ static void path_set_unify(pa_alsa_path_set *ps) { * means for now we have to have all paths support volume/mute/dB * or none. */ +if (ps-force_hw_volume) { +pa_bool_t force_on = TRUE; +PA_LLIST_FOREACH(p, ps-paths) { +pa_assert(p-probed); +if (p-has_volume !p-has_dB) { +pa_log_warn(The path %s has hw volume but lacks dB information, can not apply force-hw-volume flag., p-name); +force_on = FALSE; +} +} +if (force_on) { +pa_log_debug(Successful forced HW volume on path set containing:); +PA_LLIST_FOREACH(p, ps-paths) { +pa_log_debug(%s %s, p-name, p-has_volume ? : (hw volume forced)); +p-has_volume = TRUE; +p-has_dB = TRUE; +} +} +} + PA_LLIST_FOREACH(p, ps-paths) { pa_assert(p-probed); @@ -3188,6 +3208,36 @@ static int mapping_parse_direction( return 0; } +static int mapping_parse_force_hw_volume( +const char *filename, +unsigned line, +const char *section, +const char *lvalue, +const char *rvalue, +void *data, +void *userdata) { + +pa_alsa_profile_set *ps = userdata; +pa_alsa_mapping *m; +int b; + +pa_assert(ps); + +if (!(m = mapping_get(ps, section))) { +pa_log([%s:%u] Section name %s invalid., filename, line, section); +return -1; +} + +if ((b = pa_parse_boolean(rvalue)) 0) { +pa_log([%s:%u] Force hw volume invalid of '%s', filename, line, section); +return -1; +} + +m-force_hw_volume = b; + +return 0; +} + static int mapping_parse_description( const char *filename, unsigned line, @@ -3778,6 +3828,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel { element-input, mapping_parse_element,NULL, NULL }, { element-output, mapping_parse_element,NULL, NULL }, { direction, mapping_parse_direction, NULL, NULL }, +{ force-hw-volume,mapping_parse_force_hw_volume,NULL, NULL }, /* Shared by [Mapping ...] and [Profile ...] */ { description,mapping_parse_description,NULL, NULL }, diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h index a29aed1..a80dfc6 100644 --- a/src/modules/alsa/alsa-mixer.h +++ b/src/modules/alsa/alsa-mixer.h @@ -199,6 +199,7 @@ struct pa_alsa_path_set { PA_LLIST_HEAD(pa_alsa_path, paths); pa_alsa_direction_t direction; pa_bool_t probed:1; +pa_bool_t force_hw_volume:1; /* This is used during parsing only, as a shortcut so that we * don't have to iterate the list all the time */ @@ -255,6 +256,8 @@ struct pa_alsa_mapping { pa_sink *sink; pa_source *source; + +pa_bool_t force_hw_volume:1; }; struct pa_alsa_profile { diff --git a/src/modules/alsa/mixer/profile-sets/default.conf b/src/modules/alsa/mixer/profile-sets/default.conf index 9f7b5f2..560f930 100644 --- a/src/modules/alsa/mixer/profile-sets/default.conf +++ b/src/modules/alsa/mixer/profile-sets/default.conf @@ -55,6 +55,9 @@ ; priority = ... ; direction = any | input | output # Only useful for? ; +; force-hw-volume = no | yes# Force HW volume on a path sets in profile even if all paths do not support +; # HW volume. To be able to force the HW volume all paths with HW volume +; # must have dB info. ; [Profile id] ;
Re: [pulseaudio-discuss] [PATCH 4/4] alsa-mixer: Add force-hw-volume flag to alsa profile sets
'Twas brillig, and o...@iki.fi at 08/04/11 15:18 did gyre and gimble: From: Jyri Sarha jyri.sa...@nokia.com Before this patch, if any of the paths in a path set do not support HW volume then the HW volume is disabled for the whole set. In some cases this is a bit drastic measure. For instance, if all but one of the paths support HW volume and dB there no problem to pretend that we have HW volume for the whole set. The path without any mixers to control will just always return 0 dB and the rest is handled by SW volume. This patch adds a flag to the mapping section of profile set file to enables this behavior. David, this sounds similar to your USB Headset issue from a couple days ago... or am I just reading too much into the description? Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss