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

+- XBMC Community Forum (http://forum.xbmc.org)
+-- 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)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48


Fixed Volume On Output 2 - anthony.selby - 2011-06-03 21:11

So I was looking through the code and I think I found what I had to change (a guess)

Code:
void PAPlayer::SetVolume(long nVolume)
{
  if (m_pAudioDecoder[m_currentStream])
    m_pAudioDecoder[m_currentStream]->SetCurrentVolume(nVolume);
  if (m_pAudioDecoder2[m_currentStream])
    m_pAudioDecoder2[m_currentStream]->SetCurrentVolume(nVolume);
}

To

Code:
void PAPlayer::SetVolume(long nVolume)
{
  if (m_pAudioDecoder[m_currentStream])
    m_pAudioDecoder[m_currentStream]->SetCurrentVolume(nVolume);
  if (m_pAudioDecoder2[m_currentStream])
    m_pAudioDecoder2[m_currentStream]->SetCurrentVolume(100);
    // Have no idea if 100 is loud or not but 900 is FF Mute so maybe
}


but my issue is how do I compile that in XBMC Live, I went to http://wiki.xbmc.org/index.php?title=HOW-TO_compile_XBMC_for_Linux_from_source_code

Downloaded and installed everything then I copied the two folders on top of the source that was downloaded then I followed the rest of the instructions, (after I did all that I copied the xbmc.bin that it created to another computer)
but when I reset I get a blank screen (after the xbmc splash screen) so I reinstalled XBMC-Live from the disk and copied the compiled xbmc.bin back over and nothing


I used
Code:
$ cd $HOME/XBMC
$ ./bootstrap
$ ./configure
$ make
$ sudo make install

instead of the make -j2 but if anyone can help me figure out how to compile this so XBMC runs that would be great

Thanks again


- BrooksyX - 2011-06-06 17:32

Downloaded this, gonna try it out after class today.

Thanks Much!


- RXP91 - 2011-06-07 19:32

Thanks so much for this. I've got my XBMC connected to my AV receiver in my living room and TV in my Amp prior to this it was frustrating to keep on going back and forth now it just works with no hassle!


- nessus - 2011-06-09 11:00

nessus Wrote:xhbl... any plans for releasing new master binary file ?.

If i install the latest nightly master build and replace the exe with what you have in the first thread (master-20110331-acb1223) will work without problems;

Cheers
Nessus

Any news on this ?

Can anyone build a binary file (XBMC.exe) for windows with the latest nightly master build ?

Cheers
Nessus


- darkscout - 2011-06-10 03:29

Gone.


Fixing Very Slow Video Rendering - ubuntu-xbmc - 2011-06-10 09:02

xhbl, awesome job. I hope the fact that this patch won't be mainstreamed doesn't discourage you, as you can see from the 200+ posts, it is well received.

Initially, I had the ~3 frames/sec issue reported by veens34 and sirkonsta. But the following fixed it (BTW, while I resolve the issue, I don't really understand the fix, so, you might not have to do all these steps, these steps could break your computer, etc):

---My installation steps------------------------------------------------------

The steps I followed:

(1) Compiled 10.1 and the patch source on my HTPC; selected outputs very similar to the first post in this thread. This is when I had very, very slow video rendering (e.g. 20% of normal speed). However, turning "off" the analog audio channel immediately returned playback to normal. Since my Phenom II 555x4 should handle 720p easily, I assumed there was a fault with the sound functionality.

(2) Remove all pulse audio components (sudo apt-get autoremove pulseaudio). This may not be required, but I don't need pulse, and removal was the easiest way to know it wasn't conflicting. This probably breaks other applications' audio, but I didn't care.

(3) Install ALSA Mixer (sudo apt-get install gnome-alsamixer).

(4) Reboot.

(5) Set alasmixer devices to their eventual use in XBMC (e.g. I checked the IEC958 box in the mixer tab for my motherboard sound device (tab named "RealTek ALC887") because I was using that for SPDIF output; and in the Soundblaster tab, I unchecked IEC958 because I was using it for analog audio).

(6) At a terminal window I launched MM System Selector (gstreamer-properties), and selected the default inputs and outputs as "ALSA -- Advanced Linux Sound Architecture." For output device, I selected my SPDIF output device ("ALC887-VD Digital"). This appears to be required -- SPDIF would not work for me (with or without pulse) unless this was set. This is the only thing here that appeared 100% repeatable under every configuration I tried. For the input device, I selected "Default."

(7) At a terminal window, I used "sudo aplay -L" to get a list of valid devices that can play audio.

(8) I selected my two devices and noted their ALSA "names"
(a) e.g. for my analog card, I found "plughw:CARD=CA0106,DEV=0" for my Soundblaster card (CA = Creative Audio).
(b) likewise for my SPDIF pass through found "iec958:CARD=SB,DEV=0" to be my MB output. I knew this because the output of "aplay -L" indicates ATI SB below this line -- and because my MB calls the onboard sound ATI (even though it has RealTek chips).

(9) Started xbmc and configured it, being sure that the analog 2.0 source was listed first on the XBMC GUI screen. I used the ALSA names to create a custom audio device for the analog device (the analog device was the one slowing up video playback) E.g. I used Audio Output Device = Custom; name = plughw:CARD=CARD0106. But, for the SPDIF, I used the 'standard' name given to the onboard audio ("HDA ATI Audio"). Using the ALSA name here did not work for me, but I needed to use the ALSA name in the pass-through input box (e.g. "iec958:CARD=SB,DEV=0" for pass-through, not the default "iec958").

(10) I copied the asound.conf file from /home/[my-username]/xbmc/system/asound.conf to /home/[my-username]/.asound.conf. Again, I'm not sure this was required, but I know that ALSA prefers .asound.conf files in home directories, and this insured I knew which asound file was being used.

(11) I rebooted and tested.

---Patch Testing------------------------------------------------------------
Ubuntu 11.04; XBMC 11.1; Audigy SE

--Settings Used--

XBMC Settings Output 1: Analog/2.0/Boost On/Custom/plughw:CARD=CARD0106
XBMC Settings Output 2: Optical_Coax/7.1/Boost On/DD Compatible/DTS Compatible/HDA ATI Audio/iec958:CARD=SB,DEV=0

--Results--

- 2.0 source
- played on 2.0 TV speakers, normal
- played on 5.1 speakers (passed through 7.1 receiver) -- audio plays at two front speakers, low frequencies to .1 speaker.
- audio sync between the two outputs was perfect within my hearing tolerance

- 5.1 audio test file source
- played on 2.0 TV speakers -- all 5.1 encoded tracks downmixed into 2.0 tracks
- played on 5.1 speakers (passed through 7.1 receiver) -- audio plays on all 6 speakers, track encoding (L/C/R/SL/SR/SW) accurate
- audio sync between the two outputs was perfect within my hearing tolerance

- 7.1 test files
- I have no 7.1 test file

- MP3 Audio Test File
- played on 2.0 TV speakers --played normal (note: using custom name = "front:CARD=CARD0106" caused mechanical sounding music with audible scratching for mp3s, but normal movie playback)
- played on 5.1 speakers (passed through 7.1 receiver) -- audio plays on two front speakers
- I couldn't discern if there was a sync issue.

- Video performance
- VAPPI (?) acceleration was checkable, uncheckable
- No video hangups, video is very fast

--Test Limitations--

- I don't use crossovers -- so I didn't test them
- I may have injured other applications' audio on the computer, a non-issue for me
- There is definitely a ~1 second hangup when entering the audio configuration menu
- There may be a slight hangup when starting a movie

--Conclusion--

Overall, a giant relief to finally get this setup in a permanent manner that keeps others in the household from trying to adjust audio/video settings.


- nessus - 2011-06-10 09:25

darkscout Wrote:https://github.com/jedediahfrey/xbmc/branches

I mean, that's what the whole git/github concept is for, right? Spent the better part of the last 4 hours getting the latest and greatest master working with dual audio... and it does.

I'll try to keep it up to date when I have time.

I am sorry. I am on dark when it comes to code/github stuff.
Is this your dual audio build ?. Is the same as xhbl ?. If so can you build a binary for windows ?.


Cheers
Nessus


- darkscout - 2011-06-10 09:48

nessus Wrote:I am sorry. I am on dark when it comes to code/github stuff.
Is this your dual audio build ?. Is the same as xhbl ?. If so can you build a binary for windows ?.


Cheers
Nessus

It's his patches applied to the latest master.

I can't build a binary for windows as I don't have a windows machine in the house. But it should be a bit less voodoo than just downloading and extracting a rar file. (Especially since there have been numerous changes since March when the last patch for 'master' was released).

These are near identical to the patches in the 1st post, I just went through and made sure they were all applied correctly to the latest master, then pushed it back to github.


- nessus - 2011-06-10 10:05

I see.
Well i've download the zip file and there is no .exe inside. As i say i am dumb on this code stuff but i think this is just the code. So we need the xbmc.exe build-ed from this code or the complete installation package ?. Can anyone else do it or give a step-by-step directions how to do it ?.

Thanks for applying the patches darkscout.

Cheers
Nessus


- darkscout - 2011-06-10 10:50

darkscout Wrote:I can't build a binary for windows as I don't have a windows machine in the house.

My github is just a fork of the master source code with all the patches applied.


- nessus - 2011-06-10 18:51

Now... there is no need to shout. I've read you in the previous post. I just ask if...
nessus Wrote:Can anyone else do it or give a step-by-step directions how to do it ?.

Cheers
Nessus


Fantastic! - thewarm - 2011-06-15 15:36

I just "took the plunge" and tried your patch. Fantastic! You need to take a spin to Redmond WA (the M$ campus) and show them how to handle multiple audio outputs.
I now have HDMI + 2.0 audio in my bedroom and Optical 5.1 in the front room.

Sorry to say that after using this for a week, I stopped using it. Every video I played had severe stuttering when first launched. It became quite annoying. But after reading this thread I learned more about profiles, so I set up a "Stereo" profile and a "Surround 5.1" profile. This is most likely the way I will have to configure Eden when it is released.

UPDATE: Using profiles was not the way to go. So I tried again, this time setting WASAPI Optical , 5.1, AC3/DTS checked, as my FIRST device (instead of the 2nd device) and now I don't get the video stuttering when starting a video with my i3-530 HTPC!

Thanks for all of your hard work.


- wes paich - 2011-06-16 04:18

you sir are a genius! thanks xhbl! 5.1 in the living room, and stereo downstairs, no switching. excellent work!


- teeedubb - 2011-06-20 00:42

darkscout Wrote:https://github.com/jedediahfrey/xbmc/branches

I mean, that's what the whole git/github concept is for, right? Spent the better part of the last 4 hours getting the latest and greatest master working with dual audio... and it does.

I'll try to keep it up to date when I have time.

Thanks for your work darkscout. Do you know if your pre 11 build is using the new master-audio subsystem or is still using the old sound system?


- darkscout - 2011-06-21 14:43

Still using the old sound system.

But Doomsday is coming: http://forum.xbmc.org/showthread.php?tid=103834