Optical SPDIF output on nforce2 by default (was Re: [mythtv-users]
More audio issues)
Chris Tracy
mythtv at adiemus.org
Sun Feb 22 13:00:10 EST 2004
Replying to myself here, but I figure it's worth it if anyone else is in
the same boat.
If you're looking to get optical SPDIF output from an nforce2 chip
and you're using ALSA (I'm using 1.0.2), what you need to do is:
Let everything use oss emulation except for apps that have real ALSA
support. (ie, apps like mplayer. MythTV's ALSA support was not really
ever fully integrated, as far as I can tell)
In /etc/modules.conf you need to set some options for the snd-pcm-oss
module. By default it has /dev/dsp tied to the analog stereo outputs
while /dev/adsp is (I believe, but didn't check) tied to the analog
surround outputs. (I'm using an Abit NF7-M) First you need to find out
where your digital output is. To do that:
$ cat /proc/asound/pcm
00-00: Intel ICH : NVidia nForce2 : playback 1 : capture 1
00-01: Intel ICH - MIC ADC : NVidia nForce2 - MIC ADC : capture 1
00-02: Intel ICH - IEC958 : NVidia nForce2 - IEC958 : playback 1
You're looking for the IEC958 playback entry, which in my case is 2.
(I've only got the single sound card. It'll be more complicated with
multiple cards)
Now, in my case, that means I add the following line to /etc/modules.conf:
options snd-pcm-oss dsp_map=2 adsp_map=2
With this I map both /dev/dsp and /dev/adsp to the SPDIF output. (Of
course, the nforce2 doesn't have any hardware mixing, so I've set up
software mixing in /etc/asound.conf, but that doesn't work with oss-only
apps, unless you modify how they run with something like the 'aoss'
script)
Now, I can play sound through /dev/dsp (or /dev/adsp) and it plays in the
digital input of my Samsung HT-DB600.
Obviously, if you want only some things to use digital SPDIF and some to
go out over analog, you could for example, remap adsp to SPDIF, while
leaving dsp alone. That way, only apps set to use /dev/adsp would get
spdif output, while all others would get analog (since /dev/dsp is the
default output device)
At this point, mythtv should work just fine through the digital output.
However, in my case, I had the "AC3 Passthrough" option selected in "Setup
| General" and I got no sound when watching Live or Recorded TV. But I'm
using a PVR-250 to record normal, non-HDTV signals. I thought it wouldn't
cause problems if there was no AC3 stream, and would just be a good thing
to have set, but it's not.
Oh, and when setting up MythVideo, I've simply got it set up to spawn
mplayer thus:
mplayer -fs -zoom -quiet -vo xv -ao alsa9:spdif -ac hwac3, -srate 48000 %s
-ao alsa9:spdif
Tells it to use the SPDIF output always, and not to fall back to analog
ever. (Maybe overkill, since I have everything routed through SPDIF by
default now...)
-ac hwac3,
The comma is important. It tells mplayer to pass ac3 directly through to
my receiver. However, if there is no ac3, it will not attempt to pass it.
(This seems to be something mythtv doesn't do, which resulted in my
confusion over the similar setting in mythtv)
Do make sure to go into alsamixer and unmute the:
IEC958
IEC958 Input Monitor
IEC958 Playback AC97-SPSA
channels. (There is no level control for these channels, so don't worry
about that. Just make sure they're not [Off])
For the sake of completeness, here's my /etc/asound.conf:
#--------------/etc/asound.conf------------
pcm.nforce-hw {
type hw
card 0
}
pcm.!default {
type plug
slave.pcm "nforce"
}
pcm.dsp0 {
type plug
slave.pcm "nforce"
}
pcm.nforce {
type dmix
ipc_key 1234
slave {
pcm "hw:0,2"
period_time 0
period_size 1024
buffer_size 8192
rate 48000
}
bindings {
0 0
1 1
}
}
ctl.nforce-hw {
type hw
card 0
}
#-----------End /etc/asound.conf---------------
Hope this helps someone else. I spent a LONG time yesterday piecing all
of this together from several corners of the Internet.
Chris
More information about the mythtv-users
mailing list