[pulseaudio-discuss] Splitting ALSA card ports into

S0lll0s S0lll0s at blinkenshell.org
Tue Apr 5 15:32:15 UTC 2016


On 05.04.2016 17:19, S0lll0s wrote:
>> Message: 3
>> Date: Mon, 4 Apr 2016 09:41:52 +0800
>> From: Raymond Yau <superquad.vortex2 at gmail.com>
>> To: General PulseAudio Discussion
>> 	<pulseaudio-discuss at lists.freedesktop.org>
>> Subject: Re: [pulseaudio-discuss] Splitting ALSA card ports into
>> Message-ID:
>> 
>> 	<CAN8ccibGe204PjNZ=fmv_0=E7SZNUbNNo6fBTBp0a4DZZnYtGw at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>>>>>> > I am trying to get simultaneous output on the Line Out and 
>>>>>> Headphones
>>>>>> > outputs of my Intel HD Audio (AsRock Z97 motherboard) chipset 
>>>>>> and PC
>>>>>> > case. With the default pulseaudio configuration in pavucontrol 
>>>>>> I can
>>>>>> > choose Analog Stereo Duplex and then select either the "Line 
>>>>>> Out" or
>>>>>> > "Headphones" port under "Output Devices", but I would like to 
>>>>>> have
>>>>>> > simultaneous output on both (by having a seperate sink for 
>>>>>> each).
>>>>>> >
>>>>>> > Here is my alsa-info.sh output, please ignore the NVidia 
>>>>>> output
>>>>>> > provided by my GPU as I would like to not use it if possible:
>>>>>> >
>>>>>
>>>>>
>>>>>
>> 
>> http://www.alsa-project.org/db/?f=b7e5097f7a899aa5294b147b23cbb877db3b6f3c
>>>>>>
>>>>>> > And this is what "pacmd list-sinks" says about the Built-In 
>>>>>> audio
>> sink:
>>>>>> > http://hastebin.com/bonadehimu
>>>>>>
>>>>>> It's not possible to have independent line out and headphone 
>>>>>> output on
>>>>>> your hardware. There is only one analog device on your card.
>>>>>>
>>>>>> --
>>>>>
>>>>>
>>>>> The easy way to output same audio to both output is disable 
>>>>> drivers auto
>>>>> mute mode and change pulseaudio conf files
>>>>>
>>>>> Simple mixer control 'Auto-Mute Mode',0
>>>>> Capabilities: enum
>>>>> Items: 'Disabled' 'Enabled'
>>>>> Item0: 'Enabled'
>>>>>
>>>>>
>>>>>
>> 
>> http://www.intel.com/content/www/us/en/support/boards-and-kits/desktop-boards/000007156.html
>>>>>
>>>>>
>>>>>
>> 
>> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/Documentation/sound/alsa/HD-Audio.txt
>>>>>
>>>>> You have to ask Tiwai to enable independent hp for your realtek 
>>>>> codec on
>>>>> desktop ( e.g. no internal mic and hda controller
>>>>> support enough SDO)
>>>>>
>>>>> You can specify hint indep_hp=1 by early patching,  the driver
>>>>> automatically disable automute when you switch on independent hp 
>>>>> switch
>>>>>
>>>>>
>>>>>
>> 
>> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/Documentation/sound/alsa/HD-Audio-Controls.txt
>>>>>
>>>>> Independent HP When this enum control is enabled, the headphone 
>>>>> output
>> is
>>>>> routed from an individual stream (the third PCM such as hw:0,2) 
>>>>> instead
>> of
>>>>> the primary stream
>>>>
>>>>
>>>> Okay, so following your advice I set up modprobe.d to specify the
>>>> early-patching files:
>>>>
>>>> $ cat /etc/modprobe.d/snd_hda_intel.conf
>>>> options snd_hda_intel patch=onboard-patch,hdmi-patch
>>>>
>>>> and specified the hint in /lib/firmware/onboard-patch:
>>>>
>>>> $ cat /lib/firmware/onboard-patch
>>>> [codec]
>>>> 0x10ec0892 0x1849d892 0
>>>>
>>>> [hint]
>>>> indep_hp = 1
>>>>
>>>> this seems to work fine, I can query the card hints and indep_hp 
>>>> shows
>> up:
>>>>
>>>> $ cat /sys/class/sound/hwC0D0/hints
>>>> indep_hp = 1
>>>>
>>>> but pulseaudio still only shows one sink. Do I need to manually 
>>>> load
>>>> another sink module?
>>>
>>>
>>> also, my alsa-info after now:
>> 
>> http://www.alsa-project.org/db/?f=f7de54b96d1cb50391d638e3bc687730daf17a2f
>>>
>>> so there now is a new "Alt-Analog" playback device:
>>>
>>> >
>>> APLAY
>>>
>>> **** List of PLAYBACK Hardware Devices ****
>>> card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 
>>> Analog]
>>>   Subdevices: 1/1
>>>   Subdevice #0: subdevice #0
>>> card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 
>>> Digital]
>>>   Subdevices: 1/1
>>>   Subdevice #0: subdevice #0
>>> card 0: PCH [HDA Intel PCH], device 2: ALC892 Alt Analog [ALC892 
>>> Alt
>> Analog]
>>>   Subdevices: 1/1
>>>   Subdevice #0: subdevice #0
>>>
>>> ARECORD
>>>
>>> **** List of CAPTURE Hardware Devices ****
>>> card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 
>>> Analog]
>>>   Subdevices: 1/1
>>>   Subdevice #0: subdevice #0
>>> card 0: PCH [HDA Intel PCH], device 2: ALC892 Alt Analog [ALC892 
>>> Alt
>> Analog]
>>>   Subdevices: 1/1
>>>   Subdevice #0: subdevice #0
>>>
>>>
>>> So I tried adding a second module-alsa-card:
>>>
>>> $ pacmd load-module module-alsa-sink 
>>> card_name=alsa_card.pci-0000_00_1b.2
>>> Module load failed
>>>
>>> (changed the .0 to .2 because thats the Alt Analog right?)
>>
>> You also need hint
>>
>> jack_detect=no
>>
>> 
>> https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-output-headphones.conf
>>
>> Don't mute surround71 playback switches and don't turn off  volume
>>
>> 
>> https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-output-lineout.conf
>>
>> Don't mute headphone playback switch and don't turn off volume
>>
>> You need to enable 'independent hp' and set 'input source',1 to 
>> front mic
>> before starting  pulseaudio server
>>
>> Simple mixer control 'Independent HP',0
>> Capabilities: enum
>> Items: 'Disabled' 'Enabled'
>> Item0: 'Enabled'
>>
>> Simple mixer control 'Input Source',1
>> Capabilities: cenum
>> Items: 'Front Mic' 'Rear Mic' 'Line'
>> Item0: 'Front Mic'
>>
>> Use application (e.g. mplayer) which allow you to specify device 
>> hw:0,2
>>
>> 
>> https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/profile-sets/default.conf
>>
>> Just add a new mapping
>>
>> [Mapping alt-analog-stereo]
>> device-strings = hw:%f,2
>> channel-map = left,right
>> paths-output = analog-output-headphones
>> paths-input = analog-input-front-mic
>> priority = 10
>
> Sorry, I do not know a lot about ALSA or pulseaudio and I still have
> troubles understanding what exactly you are telling me to do.
> I added the jack_detect=no hint and I checked the mixer controls
> using amixer; "Input Source,1" is set to "Front Mic" already but I
> can't figure out how to set Independent HP to "Enabled".
>
> I tried all variants of amixer -c0 sset "Independent HP" Enabled,
> Item0=Enabled, True, 1, yes etc. (sget works fine) but it always
> either says "Specify what you want to set" or "Invalid command!". I
> can't find any information about setting enum mixer controls in 
> amixer
> OR any other way (apparently its not supported by the alsa python
> library). Also where would I change this permanently?
>
> I also added two new mappings (it wouldn't work if I reused the
> existing analog-stereo) and copied the "example for a multi-sink
> profile", and added this to the default profile-set:
>
>
> [Mapping alt-analog-stereo-back]
> device-strings = hw:%f
> channel-map = left,right
> paths-output = analog-output-lineout
> paths-input = analog-input-front-mic
> priority = 10
>
> [Mapping alt-analog-stereo-front]
> device-strings = hw:%f,2
> channel-map = left,right
> paths-output = analog-output-headphones
> paths-input = analog-input-front-mic
> priority = 10
>
> [Profile alt-analog-stereo-back+alt-analog-stereo-front]
> description = both
> output-mappings = alt-analog-stereo-front alt-analog-stereo-back
> input-mappings = alt-analog-stereo-back
> skip-probe = yes
>
> I can now select "both" in pavucontrol, but it doesn't add two sinks,
> I can only select the "Line Out" port in the Output tab.
>
>
> About the
>> Don't mute surround71 playback switches and don't turn off  volume
> lines; I'm not quite sure which lines of all the ones in the path
> files you are referring to. Right now i commented a few in the two
> files:
>
> in the headphones file:
> ;; [Element Surround]
> ;; switch = off
> ;; volume = off
>
> and in the lineout file:
> ;;; [Element Headphone+LO]
> ;;; switch = mute
> ;;; volume = merge
> ;;; override-map.1 = all
> ;;; override-map.2 = all-left,all-right
> ;;; required-any = any
>
> [Element Master Mono]
> switch = off
> volume = off
>
> [Element Line HP Swap]
> switch = off
> required-any = any
>
> ; This profile path is intended to control line out, let's mute 
> headphones
> ; else there will be a spike when plugging in headphones
> ;;; [Element Headphone]
> ;;; Switch = off
> ;;; Volume = off
>
>
> If I understood you correctly than all I need to do is flick the
> Independent HP mixer control on and I should have two sinks when
> restarting pulseaudio, but I have no idea how to.
patrakov on #pulseaudio helped me out, all I needed was to stop 
pulseaudio and toggle the control in the alsamixer CLI. Now everything 
is working great and I have two output streams. Thanks for all the help!


More information about the pulseaudio-discuss mailing list