# Can you choose a pcm?



## quakerdoomer (Nov 24, 2022)

Short:
How to enforce a specific nid onto a pcm?
This is what I have: pcm0, pcm1 and pcm2
------------------
pcm0 is play/rec nid20/nid25
pcm1 is play nid33
pcm2 is HDMI
------------------


This is what I want
------------------
pcm0 rec nid25
pcm1 play nid33 or nid20
pcm2 HDMI
------------------


If I disable play (nid20) from pcm0
nid33 jumps from pcm1 to pcm0 and HDMI becomes pcm1

How can I stop nid33 from jumping from pcm1 to pcm0??


Long:

```
ORIGINAL WITHOUT ANY CHANGES TO device.hints

root@LAPTOP:/ # cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC257 (Analog)> (play/rec) default [at nid 20 and 25 on hdaa0]
pcm1: <Realtek ALC257 (Right Analog Headphones)> (play) [ at nid 33 on hdaa0]
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> (play)


root@LAPTOP:/ # sysctl -a | grep nid33
dev.hdaa.0.nid33_original: 0x04211020 as=2 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Right color=Black misc=0
dev.hdaa.0.nid33_config: 0x04211020 as=2 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Right color=Black misc=0
dev.hdaa.0.nid33: pin: Headphones (Black Jack)


root@LAPTOP:/ # sysctl -a | grep nid25
dev.hdaa.0.nid25_original: 0x04a11030 as=3 seq=0 device=Mic conn=Jack ctype=1/8 loc=Right color=Black misc=0
dev.hdaa.0.nid25_config: 0x04a11030 as=3 seq=0 device=Mic conn=Jack ctype=1/8 loc=Right color=Black misc=0
dev.hdaa.0.nid25: pin: Mic (Black Jack)


root@LAPTOP:/ # sysctl -a | grep nid20
dev.hdaa.0.nid20_original: 0x90170110 as=1 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20_config: 0x90170110 as=1 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20: pin: Speaker (Fixed)
root@LAPTOP:/ #

------ NOW MAKING CHANES to device.hints -----------------------
#Set 25 as mic (Keep rec from play/rec) same as default setting, no changes here
hint.hdaa.0.nid25.config="as=3 seq=0 device=Mic conn=Jack ctype=1/8 loc=Right color=Black misc=0"

#Disable 20 (Disable play from play/rec)
hint.hdaa.0.nid20.config="as=0 seq=0 device=Speaker"

#Set 33 as Headphones same as default setting, no changes here
hint.hdaa.0.nid33.config="as=2 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Right color=Black misc=0"
------
```
But, now, slaughter-of-a-b17ch nid33 jumps from pcm1 to pcm0 and neither plays nor records!!!! WHYY?? Can't it just stay on pcm1?


----------



## shepper (Nov 24, 2022)

pcm's are associations (the as=) of in/out nwid's (sound chip pins).  By default, FreeBSD uses pcm0 as the default pcm device (pcm is softlinked to pcm0).  The handbook chapter on multimedia tells you how to change the default pcm.

Each nwid has an as/seq assignment.  You can also reassign as and seq for a given nwid.  A common example is change the front panel headphone jack (as=2) to the same as='s as the speakers (as=1) and set the sequence (seq=15).  With this, the headphone jack senses and will mute the speakers.  Pardon the unintentional alliteration.

This is described in the manpage snd_hda(1) - the man page takes some study to get through.  There are also numerous examples in the forum.  If you describe what you are trying to accomplish, it will be easier to suggest the default pcm and as/seq changes that need to be made.


----------

