[pulseaudio-discuss] [PATCH v3 6/6] alsa-mixer: Improve volume handling for Terratec Aureon Dual USB
David Henningsson
david.henningsson at canonical.com
Thu Apr 30 02:07:03 PDT 2015
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?
> +default-volume = 30%
> +
> +# We set the hardware volume to maximum and do the volume control in software,
> +# because the hardware volume only has effect when the card is in analog mode.
> +# In the digital mode there's no hardware volume. Since we don't have any way
> +# to know which mode is in use, we disable hardware volume control in both
> +# modes. Otherwise the sink volume control wouldn't work properly in the
> +# digital mode.
> +#
> +# Similarly as with volume, the Speaker mute doesn't have effect in the digital
> +# mode, so we unmute the element unconditionally and implement muting in
> +# software.
> +[Element Speaker]
> +volume = zero
> +switch = on
> diff --git a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
> index eeb6ac4..7c8c14f 100644
> --- a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
> +++ b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
> @@ -97,5 +97,6 @@ ATTRS{idVendor}=="17cc", ATTRS{idProduct}=="1011", ENV{PULSE_PROFILE_SET}="nativ
> ATTRS{idVendor}=="17cc", ATTRS{idProduct}=="1021", ENV{PULSE_PROFILE_SET}="native-instruments-traktor-audio10.conf"
> ATTRS{idVendor}=="0763", ATTRS{idProduct}=="2012", ENV{PULSE_PROFILE_SET}="maudio-fasttrack-pro.conf"
> ATTRS{idVendor}=="045e", ATTRS{idProduct}=="02bb", ENV{PULSE_PROFILE_SET}="kinect-audio.conf"
> +ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="0077", ENV{PULSE_PROFILE_SET}="terratec-aureon-dual-usb.conf"
>
> LABEL="pulseaudio_end"
> diff --git a/src/modules/alsa/mixer/profile-sets/terratec-aureon-dual-usb.conf b/src/modules/alsa/mixer/profile-sets/terratec-aureon-dual-usb.conf
> new file mode 100644
> index 0000000..e6b6573
> --- /dev/null
> +++ b/src/modules/alsa/mixer/profile-sets/terratec-aureon-dual-usb.conf
> @@ -0,0 +1,42 @@
> +# 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.
> +
> +# Terratec Aureon Dual USB
> +#
> +# This card has one stereo output jack and one analog mono mic jack.
> +#
> +# The output jack supports both analog and digital output, but there's no way
> +# to detect which one is currently in use (or if there is a way, the PulseAudio
> +# developers don't know that).
> +#
> +# See default.conf for an explanation on the directives used here.
> +
> +[General]
> +auto-profiles = yes
> +
> +[Mapping stereo]
> +device-strings = hw:%f
> +channel-map = front-left,front-right
> +paths-output = terratec-aureon-dual-usb-output
> +priority = 1
> +direction = output
> +
> +[Mapping analog-mono]
> +device-strings = hw:%f
> +channel-map = mono
> +paths-input = analog-input-mic
> +priority = 1
> +direction = input
>
--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
More information about the pulseaudio-discuss
mailing list