Tag Archives: oss

Default sound device in FreeBSD

I’ve an nVidia Graphics card in my FreeBSD box, and snd_hda.ko detects audio device on it as well. But the problem is, the audio interface is masked on the card, so there are no physical audio sockets on the card.

chateau.d.if!abbe:~ % cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play) default
pcm1: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm2: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm3: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm4: <HDA Realtek ALC889 PCM #0 Analog> (play/rec)
pcm5: <HDA Realtek ALC889 PCM #1 Analog> (play/rec)
pcm6: <HDA Realtek ALC889 PCM #2 Digital> (play)
pcm7: <HDA Realtek ALC889 PCM #3 Digital> (play)

The only problem with this setup is that all of my sound applications which try to use /dev/dsp end up using pcm0, which doesn’t exist physically. The tricky thing is that, there is no /dev/dsp on filesystem, so kernel internally manages accesses to that device node. To switch to on-board audio (i.e. pcm4) as default sound device, I did sysctl hw.snd.default_unit=4, which worked:

chateau.d.if!abbe:~ % cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm1: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm2: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm3: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm4: <HDA Realtek ALC889 PCM #0 Analog> (play/rec) default
pcm5: <HDA Realtek ALC889 PCM #1 Analog> (play/rec)
pcm6: <HDA Realtek ALC889 PCM #2 Digital> (play)
pcm7: <HDA Realtek ALC889 PCM #3 Digital> (play)

To persist the changes, I added it to sysctl.conf(5). I’ve not rebooted it yet, but I’m sure it’ll work 😉