[pulseaudio-discuss] [PATCH v3 6/6] alsa-mixer: Improve volume handling for Terratec Aureon Dual USB
Alexander E. Patrakov
patrakov at gmail.com
Thu Apr 30 03:00:47 PDT 2015
30.04.2015 14:49, Tanu Kaskinen wrote:
> On Thu, 2015-04-30 at 11:07 +0200, David Henningsson wrote:
>>
>> On 2015-04-27 13:34, Tanu Kaskinen wrote:
>>> This card can be used in analog or digital mode, and in the digital
>>> mode there's no hardware volume or mute support. With the default
>>> configuration PulseAudio only sees a single "speaker" port, and
>>> assumes that controlling the Speaker element has some effect, which
>>> is not true in the digital mode. To work around this, let's add a
>>> special path configuration for this card to disable hardware volume.
>>>
>>> It would be better to disable hardware volume only in the digital
>>> mode, but I believe there's no way to automatically figure out which
>>> mode is in use, and requiring the user to tell which mode is in use
>>> at any given time would not be user-friendly.
>>>
>>> BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=81777
>>> ---
>>> src/Makefile.am | 6 ++--
>>> src/modules/alsa/alsa-mixer.c | 2 ++
>>> .../paths/terratec-aureon-dual-usb-output.conf | 37 +++++++++++++++++++
>>> .../alsa/mixer/profile-sets/90-pulseaudio.rules | 1 +
>>> .../profile-sets/terratec-aureon-dual-usb.conf | 42 ++++++++++++++++++++++
>>> 5 files changed, 86 insertions(+), 2 deletions(-)
>>> create mode 100644 src/modules/alsa/mixer/paths/terratec-aureon-dual-usb-output.conf
>>> create mode 100644 src/modules/alsa/mixer/profile-sets/terratec-aureon-dual-usb.conf
>>>
>>> diff --git a/src/Makefile.am b/src/Makefile.am
>>> index d582e57..ca432be 100644
>>> --- a/src/Makefile.am
>>> +++ b/src/Makefile.am
>>> @@ -1277,7 +1277,8 @@ dist_alsaprofilesets_DATA = \
>>> modules/alsa/mixer/profile-sets/native-instruments-traktor-audio10.conf \
>>> modules/alsa/mixer/profile-sets/native-instruments-traktorkontrol-s4.conf \
>>> modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf \
>>> - modules/alsa/mixer/profile-sets/kinect-audio.conf
>>> + modules/alsa/mixer/profile-sets/kinect-audio.conf \
>>> + modules/alsa/mixer/profile-sets/terratec-aureon-dual-usb.conf
>>>
>>> if HAVE_UDEV
>>> dist_udevrules_DATA = \
>>> @@ -1318,7 +1319,8 @@ dist_alsapaths_DATA = \
>>> modules/alsa/mixer/paths/hdmi-output-4.conf \
>>> modules/alsa/mixer/paths/hdmi-output-5.conf \
>>> modules/alsa/mixer/paths/hdmi-output-6.conf \
>>> - modules/alsa/mixer/paths/hdmi-output-7.conf
>>> + modules/alsa/mixer/paths/hdmi-output-7.conf \
>>> + modules/alsa/mixer/paths/terratec-aureon-dual-usb-output.conf
>>>
>>> endif
>>>
>>> diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
>>> index e921f8b..71459e1 100644
>>> --- a/src/modules/alsa/alsa-mixer.c
>>> +++ b/src/modules/alsa/alsa-mixer.c
>>> @@ -2386,6 +2386,7 @@ static int path_verify(pa_alsa_path *p) {
>>> { "analog-output-lineout", N_("Line Out") },
>>> { "analog-output-mono", N_("Analog Mono Output") },
>>> { "analog-output-speaker", N_("Speakers") },
>>> + { "output-speaker", N_("Speakers") },
>>> { "hdmi-output", N_("HDMI / DisplayPort") },
>>> { "iec958-stereo-output", N_("Digital Output (S/PDIF)") },
>>> { "iec958-stereo-input", N_("Digital Input (S/PDIF)") },
>>> @@ -3900,6 +3901,7 @@ static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile,
>>> static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) {
>>>
>>> static const struct description_map well_known_descriptions[] = {
>>> + { "stereo", N_("Stereo") },
>>> { "analog-mono", N_("Analog Mono") },
>>> { "analog-stereo", N_("Analog Stereo") },
>>> /* Note: Not translated to "Multichannel Input" - then the source name would be "Multichannel Input Input".
>>> diff --git a/src/modules/alsa/mixer/paths/terratec-aureon-dual-usb-output.conf b/src/modules/alsa/mixer/paths/terratec-aureon-dual-usb-output.conf
>>> new file mode 100644
>>> index 0000000..4bb4746
>>> --- /dev/null
>>> +++ b/src/modules/alsa/mixer/paths/terratec-aureon-dual-usb-output.conf
>>> @@ -0,0 +1,37 @@
>>> +# This file is part of PulseAudio.
>>> +#
>>> +# PulseAudio is free software; you can redistribute it and/or modify
>>> +# it under the terms of the GNU Lesser General Public License as
>>> +# published by the Free Software Foundation; either version 2.1 of the
>>> +# License, or (at your option) any later version.
>>> +#
>>> +# PulseAudio is distributed in the hope that it will be useful, but
>>> +# WITHOUT ANY WARRANTY; without even the implied warranty of
>>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> +# General Public License for more details.
>>> +#
>>> +# You should have received a copy of the GNU Lesser General Public License
>>> +# along with PulseAudio; if not, write to the Free Software Foundation,
>>> +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
>>> +
>>> +# For Terratec Aureon Dual USB.
>>> +#
>>> +# See analog-output.conf.common for an explanation on the directives.
>>> +
>>> +[General]
>>> +description-key = output-speaker
>>
>> Why don't you just reuse the existing analog-output-speaker
>> description-key here?
>
> Because this path may be digital.
I wonder whether, with USB devices, a situation is more common that we
know whether the path is analog or digital, or that we don't know. Or
even a corner case where the distinction doesn't really apply. The wild
question: does it make sense to treat (as far as port descriptions are
concerned) USB outputs as something neither analog nor digital, but as a
special case, unless we know better (e.g. by seeing the substring
"headset" in the device name)?
--
Alexander E. Patrakov
More information about the pulseaudio-discuss
mailing list