Kodi Community Forum
[PATCH] Dual Audio Output support for XBMC (Eden Updated) - Printable Version

+- Kodi Community Forum (http://forum.kodi.tv)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Development (/forumdisplay.php?fid=93)
+--- Thread: [PATCH] Dual Audio Output support for XBMC (Eden Updated) (/showthread.php?tid=86038)



- kwstump - 2011-01-11 05:45

Works Great on XBMCFreak 10.00 V1 Dahrma final (Name is wrong but you get the point which one)..

I did have to do the following for dependencies

sudo service xbmc-live stop
sudo add-apt-repository ppa:lucid-bleed/ppa
sudo apt-get update
sudo apt-get install libmodplug1 libmodplug-dev libmodplug0c2 libssh-4 libssl-dev

Then copied binary over existing file as mentioned above! (of course making a backup first)
sudo reboot

Voila it was there and ready to be configured!

THANKS!!!!!!!! This is AWESOME!

PS throught I would add my GUI settings as an FYI.

Both on the Same Sound Card
Output 1 - Optical to Stereo
Output 2 - Stereo Output to House Audio System

In the past I would get static on the Stereo Output when playing a multichannel audio, That is a thing of the past!!!!!

<audiooutput>
<ac3passthrough>true</ac3passthrough>
<audiodevice>alsa:plug:iec958</audiodevice>
<channellayout>7</channellayout>
<customdevice></customdevice>
<custompassthrough></custompassthrough>
<dontnormalizelevels>true</dontnormalizelevels>
<dtspassthrough>true</dtspassthrough>
<mode>1</mode>
<passthroughaac>false</passthroughaac>
<passthroughdevice>alsa:iec958</passthroughdevice>
<passthroughmp1>false</passthroughmp1>
<passthroughmp2>false</passthroughmp2>
<passthroughmp3>false</passthroughmp3>
</audiooutput>
<audiooutput2>
<ac3passthrough>true</ac3passthrough>
<audiodevice>custom</audiodevice>
<channellayout>0</channellayout>
<customdevice>plughw:0,0</customdevice>
<custompassthrough></custompassthrough>
<dontnormalizelevels>true</dontnormalizelevels>
<dtspassthrough>true</dtspassthrough>
<mode>0</mode>
<passthroughaac>false</passthroughaac>
<passthroughdevice>iec958</passthroughdevice>
<passthroughmp1>false</passthroughmp1>
<passthroughmp2>false</passthroughmp2>
<passthroughmp3>false</passthroughmp3>
</audiooutput2>


- tequila - 2011-01-11 16:32

hmm couldn´t get it working on a pov mobii with ubuntu, libs missing... could install them but I am not sure if it makes sense when it ends in choppy playback.... some ION useres with success?


- kwstump - 2011-01-11 18:27

@tequila.
My video is not choppy (only watched 1 1080p movie so not exhaustive testing) but I am running a home made PC with a older Q6600 and a CrystalHD Card so that may be the difference between our installs.

kevin


- BullShaft - 2011-01-12 21:20

First post in this forum. I was SO waiting for a patch like this since I switched to Win7. Under XP, it worked to have the sound analog on zone 2, while providing zone 1 with digital SPDIF 5.1, but unfortunatelly not under Win7.

Now it just replaced the xbmc.exe, configured and it worked instantly like a charm. Thx a lot!
No choppy 1080i either so far


Works great! - Cthugha - 2011-01-12 21:31

Works great!
I'm now able to simultaneously output both 2ch stereo over HDMI to my TV and 5.1ch over S/PDIF to my reciever. No more manual switching Smile
This patch should be included into xbmc by default!

Keep up the great work!


- tequila - 2011-01-15 18:51

hmm all I get is this: error while loading shared libraries: libmodplug.so.1
trying to find this ...no luck yet except libmodplug0c2 and libmodplug-dev which both don't fix it

-------------------------------------------------------------------------
Alright I am stuck... managed to install the libmodplug1 through a debian package
so far so good xbmc launches again but no menu sounds and both devices fail Sad

so I tried a another asound.conf (from here: http://forum.xbmc.org/showthread.php?tid=62919) but no real luck:
I hoped to get at least the TOSlink to work with this.


pcm.!default {
type plug
slave {
pcm "both_digital"
}
}

pcm.both_digital {
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
}

# Toslink digital_1 output
pcm.digital_1 {
type hw
card 0
device 1
channels 2
}

# HDMI digital_2 output
pcm.digital_2 {
type hw
card 0
device 3
channels 2
}

pcm.multi {
type multi
slaves.a {
pcm "digital_1"
channels 2
}

slaves.b {
pcm "digital_2"
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
}



I have to admit, that I am a linux idiot I don´t really know what I am doing ;-)
For people like me there is a button in the setup required like "test audio device" ... with a sound).
Anyway, someone who is able to point me into the right direction?

You ION people know about it, this is what the audio devices look like:

card 0: NVidia [HDA NVidia], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 1: ALC662 rev1 Digital [ALC662 rev1 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


Anyway, my alsamixer just shows:
Master, Headphone, PCM, Front, Front Mi, Surround, Line, Mic, Mic Boos, S/PDIF, S/PDIF D, S/PDIF 1, Beep

where I cannot modify the S/PDIF items and there is no coax/tos listed

Since with the original xbmc.bin I have menu sounds but when playing a movie fails now too, maybe it is a good idea to get back to the roots (yes I am willing to understand what is actually going on):

1. What is actually required by xbmc? asound.conf, alsamixer, what else ?
2. Belongs tos/coax to s/pdif ? So do I have to get s/pdif (thought thats only the 3,5mm jack) running to get tos/coax working ?


sigh... I´ll do some more sound tests outside xbmc now


- digzz - 2011-01-16 18:53

Does this work with the latest XBMC Live ?


- scrumpydrinker - 2011-01-21 22:14

Yes

Just replace your already installed xbmx .exe file with the relevant '10.0-Dharma Final:' one from the first post inthis thread.


- scrumpydrinker - 2011-01-21 22:24

For anyones infomation:

I tried nessus's set up from a few posts back but not all files played ok


I ended up with:


FIRST AUDIO OUTPUT
Audio Output : HDMI
Speakers Configuration : 2.0
DD AC3 capable NO
DTS cabable NO
Audio Output Device : DirectSound Nvidia HD

SECOND AUDIO OUTPUT
Audio Output : optical/coax
Speakers Configuration : 5.1
Boost Volume YES
DD AC3 Capable YES
DTS Capable Yes
Audio Output Device : DirectSound Realtek Digital Output

SYSTEM SETUP
XBMC Dharma (Latest)
Acer Revo R3700
Windows 7 Enterprise 32bit


This gives me sound to the TV over HDMI and 5.1 or stereo to my Denon receiver over optical


- digzz - 2011-01-22 20:25

scrumpydrinker Wrote:Yes

Just replace your already installed xbmx .exe file with the relevant '10.0-Dharma Final:' one from the first post inthis thread.

Where in xbmx .exe file xbmc live would you put the file? are you sure this works with live ? all I see is windows and linux.


sharing a patched version - phyrros1 - 2011-01-26 09:32

Hi Guys,

Since I am not capable to patch and compile a source code, would somebody might share a ready installable version of Dharma Final for Windows ?

I need this second audio output so bad but I do not know how to get it
Thanks a lot

Rgds

Phyrros


- OriginNG - 2011-01-26 11:40

phyrros1 Wrote:Hi Guys,

Since I am not capable to patch and compile a source code, would somebody might share a ready installable version of Dharma Final for Windows ?

I need this second audio output so bad but I do not know how to get it
Thanks a lot

Just install the regular Dharma Final for Windows and replace the executable with the version you can download from the first post.
So, replace C:\Program Files\XBMC\XBMC.exe with XBMC.exe from the rar archive.

Regards,

Joop


- digzz - 2011-01-26 11:46

What About xbmc LiveConfusedConfusedConfused?


- tequila - 2011-01-26 16:46

Alright, for all of you with trouble on nvidia ion based systems.
This is far from perfect but it works (though no menu sounds).

My System is a 330 POV Mobii.

This is for having Digital Audio on HDMI AND Coax/Optical on an ubuntu based system 10.04.1 LTS (if you don´t know your version use at console: echo -e $(cat /etc/issue)|head -1).

First of all I got rid of Pulse-Audio. (This might be a problem for some of you but it turned out that only without it it works for me.

This is what aplay -l returns:

Code:
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 1: ALC662 rev1 Digital [ALC662 rev1 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

I am only interested in device 1 and device 3
So I picked this asound.conf and put it into /etc

I don´t have any further configs like .asoundrc, just this asound.conf
and I have to learn whats actually going on to have real 7.1


Code:
pcm.!default {
type plug
slave {
pcm "both"
}
}

pcm.both {
type route
slave {
pcm multi
channels 6
}
ttable.0.0 1.0
ttable.1.1 1.0
ttable.0.2 1.0
ttable.1.3 1.0
ttable.0.4 1.0
ttable.1.5 1.0
}

pcm.multi {
type multi
slaves.a {
pcm "tv"
channels 2
}
slaves.b {
pcm "receiver"
channels 2
}
slaves.c {
pcm "phones"
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
bindings.4.slave c
bindings.4.channel 0
bindings.5.slave c
bindings.5.channel 1
}

pcm.tv {
type dmix
ipc_key 1024
slave {
    pcm "tvhw"
    period_time 0
    period_size 1024
    buffer_size 8192
    rate 48000
}
bindings {
    0 0
    1 1
}
}

pcm.receiver {
type dmix
ipc_key 1024
slave {
    pcm "receiverhw"
    period_time 0
    period_size 1024
    buffer_size 8192
    rate 48000
}
bindings {
    0 0
    1 1
}
}

pcm.phones {
type dmix
ipc_key 1024
slave {
    pcm "phoneshw"
    period_time 0
    period_size 1024
    buffer_size 8192
    rate 48000
}
bindings {
    0 0
    1 1
}
}

pcm.tvhw {
    type hw
    card 0
    device 3
    channels 2
}

pcm.receiverhw {
    type hw
    card 0
    device 1
    channels 2
}

pcm.phoneshw {
    type hw
    card 0
    device 0
    channels 2
}

Everything about device 0 could be left out but it doesn´t hurt me so I left it as it is. Next step is to fix it for 7.1 dts.

The config in the patched xbmc is as follows:

First device is HDMI 7.1, everything checked, device hdmi passthrough hdmi.

Second Device is Optical/Coax 7.1, everything checked, custom device (important) receiverhw which is Nvidia Audio device 1. Same to passthrough.

Now music and Video works fine. I can toggle between hdmi and optical on my onkyo 7.1 receiver.

The idea behind it is to have audio no matter what display device is connected. Up to now I had no sound when I switched to the beamer which is not yet HD/Hdmi capable.

Next step is to understand EVERYTHING in asound.conf. I´ll let you know once I found out :-)

Hope this is useful for some of you.

Btw, I didn´t notice any stuttering in HD playback yet.

digzz: live is linux afaik


- phyrros1 - 2011-01-27 11:21

OriginNG Wrote:Just install the regular Dharma Final for Windows and replace the executable with the version you can download from the first post.
So, replace C:\Program Files\XBMC\XBMC.exe with XBMC.exe from the rar archive.

Regards,

Joop


Joop, you are star. Thanks a lot for the hint.

Phyrros