Enabling nForce4 optical SPDIF output
From MythTV Official Wiki
Background
Many users with Nvidia4 based motherboards have problems enabling the optical audio output from their motherboard in linux. The default values set by the alsa driver do not enable the optical output, and it is not possible to enable it using the alsamixer.
A solution was found by changing the /etc/asound.state file directly.
Short howto:
- save the asound.state file below as "/etc/asound.state"
- Enter the command "alsactl restore"
- Due to differences in the alsa driver and the support circuts you might experience error messages of the following kind:
- alsactl: set_control:894: warning: name mismatch (Mic Boost (+20dB)/Mic Boost (+20dB) Capture Switch) for control #17
- alsactl: set_control:896: warning: index mismatch (0/0) for control #17
- alsactl: set_control:898: failed to obtain info for control #17 (Operation not permitted)
- alsactl: set_control:894: warning: name mismatch (Mic Boost (+20dB)/Mic Boost (+20dB) Capture Switch) for control #17
- This means that on your hardware, the name of control #17 is not "Mic Boost (+20dB)" but instead "Mic Boost (+20dB) Capture Switch".
- To fix this problem, edit the /etc/asound.state file and change the name of control to the correct name.
- Due to differences in the alsa driver and the support circuts you might experience error messages of the following kind:
- 3. Fix any problems in the asound.state file as described above.
- 4. Test your setup by playing an audio file while using the optical output. The optical output should now be able to output regular stereo and surround depending on your audio source.
/etc/asound.state File
Save the following file as /etc/asound.state
state.CK804 { control.1 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'Master Playback Switch' value true } control.2 { comment.access 'read write' comment.type INTEGER comment.count 2 comment.range '0 - 31' iface MIXER name 'Master Playback Volume' value.0 22 value.1 22 } control.3 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'Center Playback Switch' value false } control.4 { comment.access 'read write' comment.type INTEGER comment.count 1 comment.range '0 - 31' iface MIXER name 'Center Playback Volume' value 31 } control.5 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'LFE Playback Switch' value true } control.6 { comment.access 'read write' comment.type INTEGER comment.count 1 comment.range '0 - 31' iface MIXER name 'LFE Playback Volume' value 13 } control.7 { comment.access 'read write' comment.type BOOLEAN comment.count 2 iface MIXER name 'Surround Playback Switch' value.0 false value.1 false } control.8 { comment.access 'read write' comment.type INTEGER comment.count 2 comment.range '0 - 31' iface MIXER name 'Surround Playback Volume' value.0 0 value.1 0 } control.9 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'Master Mono Playback Switch' value false } control.10 { comment.access 'read write' comment.type INTEGER comment.count 1 comment.range '0 - 31' iface MIXER name 'Master Mono Playback Volume' value 0 } control.11 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'PC Speaker Playback Switch' value false } control.12 { comment.access 'read write' comment.type INTEGER comment.count 1 comment.range '0 - 15' iface MIXER name 'PC Speaker Playback Volume' value 0 } control.13 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'Phone Playback Switch' value false } control.14 { comment.access 'read write' comment.type INTEGER comment.count 1 comment.range '0 - 31' iface MIXER name 'Phone Playback Volume' value 0 } control.15 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'Mic Playback Switch' value false } control.16 { comment.access 'read write' comment.type INTEGER comment.count 1 comment.range '0 - 31' iface MIXER name 'Mic Playback Volume' value 0 } control.17 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'Mic Boost (+20dB) Capture Switch' value false } control.18 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'Line Playback Switch' value false } control.19 { comment.access 'read write' comment.type INTEGER comment.count 2 comment.range '0 - 31' iface MIXER name 'Line Playback Volume' value.0 0 value.1 0 } control.20 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'CD Playback Switch' value false } control.21 { comment.access 'read write' comment.type INTEGER comment.count 2 comment.range '0 - 31' iface MIXER name 'CD Playback Volume' value.0 0 value.1 0 } control.22 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'Aux Playback Switch' value false } control.23 { comment.access 'read write' comment.type INTEGER comment.count 2 comment.range '0 - 31' iface MIXER name 'Aux Playback Volume' value.0 0 value.1 0 } control.24 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'PCM Playback Switch' value true } control.25 { comment.access 'read write' comment.type INTEGER comment.count 2 comment.range '0 - 31' iface MIXER name 'PCM Playback Volume' value.0 22 value.1 22 } control.26 { comment.access 'read write' comment.type ENUMERATED comment.count 2 comment.item.0 Mic comment.item.1 CD comment.item.2 Video comment.item.3 Aux comment.item.4 Line comment.item.5 Mix comment.item.6 'Mix Mono' comment.item.7 Phone iface MIXER name 'Capture Source' value.0 Mic value.1 Mic } control.27 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'Capture Switch' value true } control.28 { comment.access 'read write' comment.type INTEGER comment.count 2 comment.range '0 - 15' iface MIXER name 'Capture Volume' value.0 0 value.1 0 } control.29 { comment.access 'read write' comment.type ENUMERATED comment.count 1 comment.item.0 Mix comment.item.1 Mic iface MIXER name 'Mono Output Select' value Mix } control.30 { comment.access 'read write' comment.type ENUMERATED comment.count 1 comment.item.0 Mic1 comment.item.1 Mic2 iface MIXER name 'Mic Select Capture Switch' value Mic1 } control.31 { comment.access read comment.type IEC958 comment.count 1 iface MIXER name 'IEC958 Playback Con Mask' value '0fff000f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' } control.32 { comment.access read comment.type IEC958 comment.count 1 iface MIXER name 'IEC958 Playback Pro Mask' value cf00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 } control.33 { comment.access 'read write' comment.type IEC958 comment.count 1 iface MIXER name 'IEC958 Playback Default' value '0082000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' } control.34 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'IEC958 Playback Switch' value true } control.35 { comment.access 'read write' comment.type INTEGER comment.count 1 comment.range '0 - 3' iface MIXER name 'IEC958 Playback AC97-SPSA' value 0 } control.36 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'Duplicate Front' value false } control.37 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'Mic Front Input Switch' value false } control.38 { comment.access 'read write' comment.type ENUMERATED comment.count 1 comment.item.0 Shared comment.item.1 Independent iface MIXER name 'Surround Jack Mode' value Shared } control.39 { comment.access 'read write' comment.type ENUMERATED comment.count 1 comment.item.0 '2ch' comment.item.1 '4ch' comment.item.2 '6ch' iface MIXER name 'Channel Mode' value '2ch' } control.40 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'IEC958 Capture Switch' value false } control.41 { comment.access 'read write' comment.type ENUMERATED comment.count 1 comment.item.0 PCM comment.item.1 'Analog In' comment.item.2 'IEC958 In' iface MIXER name 'IEC958 Playback Source' value PCM } control.42 { comment.access 'read write' comment.type BOOLEAN comment.count 1 iface MIXER name 'External Amplifier' value true } }
MythTV Setup
Now, once the file is saved start/restart mythfrontend.
Go to Utilities/Setup -> Setup -> General and for Audio output device put ALSA:digital.