[Linux] Audio to HDMI and optical (fixing sample rate issues)
#1
This is more of a note to me for the future (when I reinstall, forget what I have done and search this forum!) - and to help people in similar situations searching. There are a couple of good posts on here that look at the issue of simulataneous, dual HDMI and optical 5.1 outputs. for my own situation I use Eden "live" install with tvheadend and PVR build. I have a HDMI (TV) and optical output (5.1) on my system

Using an ATI fusion E350 with hauppauge usb tvstick. Incidentally I also have a VRC 1100 and original xbox remote control (im inbetween deciding which is best to use, my xbox remote is actually part of an all in one remote so I dont know which one I will be sticking with! Both work simultaneously though)

Code:
aplay -l

card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 1: ALC892 Digital [ALC892 Digital]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

I wanted to output to 0,3 and 1,1 for non-passthrough audio and 1,1 for passthrough only. I can specify hw:CARD=SB,dev=1 for the passthrough (and normal if I so wished all sound to go through the optical decoder)

Sound I looked at various ALSA configurations, .asoundrc configurations and none seemed to work. This is the only .asoundrc that worked for me. It is modified slightly from one taken from this forum (cannot find source - this isnt all my own work!)

Code:
#xbmc optical and hdmi

pcm.!default {
    type plug
    slave {
        pcm "both"
    }
}
pcm.both {
    type route
    slave {
        pcm multi
        channels 4
    }
    ttable.0.0 1.0
    ttable.1.1 1.0
    ttable.0.2 1.0
    ttable.1.3 1.0
}
pcm.multi {
    type multi
    slaves.a {
        pcm "dmixtv"
        channels 2
    }
    slaves.b {
        pcm "dmixrec"
        channels 2
    }
    bindings.0.slave a
    bindings.0.channel 0
    bindings.1.slave a
    bindings.1.channel 1
    bindings.2.slave b
    bindings.2.channel 0
    bindings.3.slave b
    bindings.3.channel 1
}
pcm.dmixtv {
    type dmix
    ipc_key 1024
    slave {
        pcm "tv"
     }
     bindings {
        0 0
        1 1
     }
}
pcm.dmixrec {
    type dmix
    ipc_key 1024
    slave {
        pcm "receiver"
     }
     bindings {
        0 0
        1 1
     }
}
pcm.tv {
    type hw
    card 0
    device 3
    channels 2
}
pcm.receiver {
    type hw
    card 1
    device 1
    channels 2
}

The original post on here had me using pcm.both as the custom audio source. this partially worked for me. Music, mp3 encoded video sound worked fine. However, I also use tvheadend and livetv on my PVR build eden. The LiveTV audio would downsample and appear "slow". If I set the audio to ALSA defaults then all is well.

Very happy now, AC3/DTS/AAC all go through to the optical decoded and other audio goes to optical decoder and HDMI (as I want).

Hope this helps someone.
Reply

Logout Mark Read Team Forum Stats Members Help
[Linux] Audio to HDMI and optical (fixing sample rate issues)0