[LINUX] Problems switching from Analog to Digital over SPDIF?
#19
Ubuntu 9.10, Kernel 2.6.31-15.
XBMC 9.11 Beta1.
ALSA v1.0.20.
PulseAudio 1:0.9.19-0ubuntu4.
Nvidia MCP7A Audio.

I've managed to get multichannel pass-through audio, stereo output, and even menu sounds working (although with a few bugs here and there.) Here is how I did it, hopefully it will help someone else:

I'm outputting audio through the optical connection to my receiver.

XBMC > System > System > Audio Output:
Code:
Audio output: Digital
-Dolby Digital (AC3) capable receiver.....(X)
-DTS Capable Receiver........................(X)
Audio output device: Custom
Custom audio device: "plughw:0,1"  (without quotes)
Pass-through output device: Custom
Custom pass-through device: "plughw:0,1"  (without quotes)
Downmix multichannel audio to stereo.............(_)

Those settings did not work ("Failed to initialize audio device" messages) until I launched XBMC with the following script. This script kills PulseAudio just before starting XBMC:

Code:
#!/bin/bash

# Test to see if XBMC is running first
if ps -ef|grep -v grep|grep -i xbmc.bin
then
# Do nothing
echo "XBMC already Running!"
else
# Startup XBMC
ps aux|grep -v grep|grep -i pulseaudio|awk '{print $2}'| xargs kill -9
xbmc
fi
exit

This kills PulseAudio just long enough for XBMC to start and for the XBMC audio settings to take effect. Now the buggy part begins: PulseAudio will auto-restart a few seconds after XBMC launches, so there will be a few seconds before menu sounds return.

The second bug occurs when launching a stereo (2.0) audio stream. The *first* time any 2.0 audio stream is launched, it will give the familiar "Failed to initialize audio device" error. Simply stop whatever you were trying to play, give it a second, and restart it. All 2.0 audio will work from then on. (IDK why this happens, but it does, and it's stupid. Damn you PulseAudio.)

For reference, here are my aplay -l and aplay -L outputs:

Code:
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
Code:
aplay -L
front:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    Front speakers
surround40:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Digital
    IEC958 (S/PDIF) Digital Audio Output
hdmi:CARD=NVidia,DEV=0
    HDA NVidia, NVIDIA HDMI
    HDMI Audio Output
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    Playback/recording through the PulseAudio sound server

Your "plughw:X,X" values will change depending on sound-card, and desired audio output device.

Hope this helps someone!
Reply


Messages In This Thread
[No subject] - by F3d0r - 2009-11-22, 09:32
[No subject] - by F3d0r - 2009-11-22, 09:59
[No subject] - by miseryshining - 2009-11-22, 16:42
[No subject] - by F3d0r - 2009-11-23, 19:48
[No subject] - by razo - 2009-11-23, 21:40
[No subject] - by F3d0r - 2009-11-23, 22:32
[No subject] - by miseryshining - 2009-11-24, 01:26
[No subject] - by F3d0r - 2009-11-24, 10:06
[No subject] - by dongioia - 2009-11-24, 10:41
[No subject] - by F3d0r - 2009-11-24, 10:51
[No subject] - by dongioia - 2009-11-24, 10:56
[No subject] - by dongioia - 2009-11-24, 20:23
[No subject] - by lloydsmart - 2009-11-28, 00:18
[No subject] - by remb0 - 2009-11-28, 01:22
[No subject] - by F3d0r - 2009-11-28, 10:07
[No subject] - by miseryshining - 2009-11-28, 12:07
[No subject] - by lloydsmart - 2009-11-29, 01:32
[No subject] - by bradford108 - 2009-11-30, 02:18
Excellent - by jonnybignote - 2010-01-07, 07:59
[No subject] - by Asswipe44 - 2010-01-07, 11:39
[No subject] - by erhnam - 2010-02-02, 12:20
[No subject] - by F3d0r - 2010-02-02, 15:36
[No subject] - by fidoboy - 2010-02-03, 03:08
[No subject] - by erhnam - 2010-02-07, 16:27
[No subject] - by fidoboy - 2010-02-07, 16:39
[No subject] - by josbeir - 2010-02-09, 02:20
[No subject] - by finite3 - 2010-02-09, 10:09
[No subject] - by josbeir - 2010-02-09, 10:32
[No subject] - by erhnam - 2010-02-09, 17:00


Logout Mark Read Team Forum Stats Members Help
[LINUX] Problems switching from Analog to Digital over SPDIF?1
This forum uses Lukasz Tkacz MyBB addons.