[PATCH] Dual Audio Output support for XBMC (Eden Updated)

  Thread Rating:
  • 18 Votes - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
fritsch Offline
Team-XBMC Developer
Posts: 6,543
Joined: Aug 2011
Reputation: 148
Location: Karlsruhe
Post: #676
Now without joking:

We put a whole lot of time (you cannot even measure this in work weeks) into ruling out design gaps, that we had in especially SoftAE. We can now measure delay over all the stages correctly. We have a separate sink object, that really cares to write its data without being stopped or hold off by all the stages clibber (decode, transcode, resample).

We integrated new features (Play 5.1 flac as AC3 for spdif only computers), we made Play Stereo on All speakers working and so on.

It was pretty too much time, to now say "we do dual audio, by just having two sinks and a constant delay of $sinkBufferSize" from one Sink to the other - that pretty sucks.

I for my part don't want to have to care for dual audio sync in AE at all, I want to give possibilities to use "external" apps, that already _can_ manage two sinks correctly. That means in Linux: pulseaudio and on windows perhaps jack / whatever soundserver you like.

I really don't want to reinvent the wheel, blow up AE code, safe the world and fail when driving the shopping car.

But at the end, I also have to say:
If you always talk about money, that a new AVR costs and so on. Do you really see - that I would pay you that receiver? When I use my spare time to fix your setup, to make it survive via software. I don't see your part in our joint venture. Step up, get yourself a C compiler and help us to implement such features in a sane way, that works on all platforms and does not have design gaps from the start.
find quote
OCDHD Offline
Junior Member
Posts: 28
Joined: Jul 2013
Reputation: 0
Post: #677
Bottom line is, this solution works for us. Audio Engine does not do what many people need. We have tried all possible options within and outside of XBMC and it is simply a limitation we cannot live without so we just use what is working for us.
As for Sync and Delay, yes it is mathematically there, and as I said, this patch is not perfect, but the Sync is not noticeable by human perception. I have personally had guests, family, friends, listen to the same sound, Dolby or DTS, one downmixed into 2 channels going by HDMI, and one going straight through to Optical out of the PC to the AVR, and even I have not noticed a Sync or audio delay. There is no perceptible echoing.
The greatest thing about this patch is that there are no Loud pops or clicks that are heard when using Frodo. With Frodo, as soon as a DTS or DD stream starts, there's a Loud pop or click sound across the speakers.
I wish to get in touch with the Coder and see his plan on how can make this work for Audio Engine if at all and I would be willing to help in my free time.

As for the snotty comments, here's what I must say.

Coming in here with arrogance without admitting a solution is needed is a failure to see ones own limitations. Is XBMC about freedom? Or limits? This forum wouldnt exist if it was about limits, because clearly someone broke that barrier, so please let us Choose. Let Eden be loved by those who use it for what it does for us. If something works, why break it? Creating something new should not mean to take away the functionality.

Re-inventing the wheel is EXACTLY what you have done with the Audio Engine. Or so was the Intention, except it is not a Wheel anymore. You added some great "Features" but you took away a Function. Those features may be used by a few, but the functionality was NEEDED, specially since the way Windows handles audio, it was upto the Application (XBMC) to make windows handle the audio rather than letting windows say "Here's my default device, use it or lose it"

Please no more arrogant and snotty statements aimed at people who are here to thank the man that made this possible. Help him out. Ask him if he can help. Asking for help is almost always more productive towards a goal than

~+/- "If you think you can do it, better show me by tomorrow."

You speak to others this way in life? Good luck at getting them to listen to you when you need them.

Perhaps its better to see how you can do better, rather than telling people
"Here's our Audio Engine, we worked so hard, we did this for you,
We did not ask for money,
We are so MAD at you for wanting something we sort of broke
We have an i7 processor with 10x the HDMI to stick it in 5 AVRs, and we have the money, poor you!
We are going to start crying, but before we do that we are gonna let you know how arrogant we really are. And if you don't like it, you can go stick it where the sun don't shine"

Really, I really do appreciate it. It is why I am even writing to you. I'm sure you guys are better than that. I appreciate your hard work, we all do, but we would appreciate if you quit behaving like your Re-inventing the Audio Stack is set and no way you are going to bother making it work in a way that tells Windows Audio to act right, and see that many of us would like to help and see this Dual Audio feature brought to Frodo, and on and on.

This Dual Audio patch has helped us to put the Same Sound to Multiple Rooms. The Same Music playing from 2 different Outputs at the Same Time. It has helped us.
So far, the only thing I am missing in Eden is the Weather App, but hey, I don't go into XBMC to watch the Weather all night.

Thank you.
find quote
fritsch Offline
Team-XBMC Developer
Posts: 6,543
Joined: Aug 2011
Reputation: 148
Location: Karlsruhe
Post: #678
If you did not realize, you are already in touch with the coder.

It is fernetmenta and me.
find quote
stupid-boy Offline
Member
Posts: 75
Joined: Aug 2013
Reputation: 2
Location: Bulgaria
Post: #679
OCDHD, before some long time i realized that i can use both audio outputs on my RPi. actually i don't need that and will never use that, but i realized i CAN and this will help others. at that point i seat on my back and instead of start endless thread across forums, i started some coding. result: my RPi hangs when i enable both outputs. again instead of start some long forum process, i get in touch with firmware support. after a while firmware was fixed and without any noise i made a pull request, giving this feature to everyone that is interested. that was around january-february this year. even in this thread public mass realized presence of this RPi specific feat few weeks ago. no abnormal noise.

fritsch and fernetmenta are really correct. if you can, please start coding feature you need and place it using pull request. give it to all others without asking for payback of any form. everything else is just borrowing noise and nervous generator for a lot of people.
find quote
armac911 Offline
Junior Member
Posts: 4
Joined: Oct 2011
Reputation: 0
Post: #680
So, I downloaded the new Frodo (12.2) and as far as I can tell, you cannot output all the sound on two different audio sources simultaneously. Technicalities aside, this worked better for me as the new engine is not passing the "normal" stereo sound on both sources (HDMI from GPU to TV and Optical from Asus Xonar to Yamaha AVR). I only get sound on my AVR when I play DTS or AC3 videos.
find quote
PaulCarter Offline
Junior Member
Posts: 32
Joined: Jul 2011
Reputation: 0
Post: #681
I believe there are two use cases here, both fulfilled by the Eden patch but potentially soluble in very different ways.
1) Easy switching between audio outputs - where a typical case would be the use of an optical or hdmi channel for full 7 channel DTS audio when watching a movie and a simple stereo analog output when listening to music or when using headphones.
2) Simultaneous output to multiple audio outputs - for example when wanting to output sound to multiple places/rooms at once.

The two cases have different synchronisation issues - in case 1), sync isn't an issue if listening to music but if watching a movie by headphones it is an issue. In case 2) sync isn't an issue unless the video is also being sent to multiple places at once, which implies there's some other splitting going on downstream, and it should be capable of splitting audio as well as video.
Equally in case 1) there's no real need for simultaneous output at all - if it was easy to switch audio outputs.

My personal scenario is 1) and, having looked at the audio engine source and played around with the idea of reproducing this patch on it - and realised it's non-trivial to achieve, am now interested in looking at implementing an easy way to switch audio outputs - and I'm defining "easy" as "being able to configure a remote control button to switch to a specifc audio outputs (or toggle between two specific audio outputs)".
I'd be interested to hear if that would satisfy most people currently interested in this patch or if 2) is a more common scenario.
find quote
stupid-boy Offline
Member
Posts: 75
Joined: Aug 2013
Reputation: 2
Location: Bulgaria
Post: #682
"toggle between two specific audio outputs" - actually there is already something very similar and if you take a closer look, you will find it. there is defined action already, that will toggle between different audio outputs, but it is not exposed for keymaps. if you try to toggle these outputs while you are playing something, you will understand why that is not good idea. i will be short: it fully restart current player, resulting in close/open/seek operations, which some times are really bad idea.
find quote
mrdally204 Offline
Fan
Posts: 403
Joined: Nov 2010
Reputation: 3
Location: Ohio
Post: #683
I am in the case #1 crowd. I like being able to watch some items with the TV speakers, but able to flip on my surround and have 5.1 when I want to. I do not really have a problem switching it either when I want to use it but...

The biggest issue is the wife approval factor. If I leave the output to my surround system when she wants to use XBMC she will not be watching anything until I fix it as she never uses the surround and never will (too many variables). Until there is dual output I am stuck with fake "surround sound", 2.0 being output from my Television and upconverted to Prologic 5.1.

That is the sad state my current "Theater" is stuck in until a better solution is developed/found Sad
find quote
PaulCarter Offline
Junior Member
Posts: 32
Joined: Jul 2011
Reputation: 0
Post: #684
Thanks stupid-boy, that's a good pointer. I had been expecting that a change in audio settings would cause a full restart of the current player. Presumably that happens today if/when audio settings are change while something is playing, so I was intending to model that behaviour with the new function. In general I expect that most of the time there won't be anything playing but, in the switch-to-headphones-everyone-else-is-going-to-bed scenario then there would be something playing,so it does need to cope with it.
Unfortunately I'm not going to have time to actually play with the code for a couple of weeks at least, but will get to it eventually!
find quote
stupid-boy Offline
Member
Posts: 75
Joined: Aug 2013
Reputation: 2
Location: Bulgaria
Post: #685
please don't do that. it is bad idea. that is why it is not exposed.
or do it, but only for you Smile
find quote
teeedubb Offline
Donor
Posts: 2,644
Joined: Mar 2010
Reputation: 62
Location: Down Under
Post: #686
(2013-09-27 17:01)stupid-boy Wrote:  "toggle between two specific audio outputs" - actually there is already something very similar and if you take a closer look, you will find it. there is defined action already, that will toggle between different audio outputs, but it is not exposed for keymaps. if you try to toggle these outputs while you are playing something, you will understand why that is not good idea. i will be short: it fully restart current player, resulting in close/open/seek operations, which some times are really bad idea.

And it only changes the output, not the number of channels.

@mrdally: I put together a script that for OE that will change the audio output, number of channels and codec types based on wheter my avr is pingable via network, so when I turn on the avr is automatically switches, been working well for some time now. If your avr isn't network connected you could modify it to be triggered via remote press. There is also a link to a similar windows script that user nabz has created.

http://forum.xbmc.org/showthread.php?tid...pid1468716

My Add-ons, only available for XBMC:
Steam Launcher|Music Party Mode|Reboot2oOS|Triple J Radio
find quote
DarkRay Offline
Junior Member
Posts: 5
Joined: Feb 2009
Reputation: 0
Post: #687
(2013-09-27 17:01)stupid-boy Wrote:  "toggle between two specific audio outputs" - actually there is already something very similar and if you take a closer look, you will find it. there is defined action already, that will toggle between different audio outputs, but it is not exposed for keymaps. if you try to toggle these outputs while you are playing something, you will understand why that is not good idea. i will be short: it fully restart current player, resulting in close/open/seek operations, which some times are really bad idea.

wrong... In Frodo 12.2 I change de audio out (Settings -> System -> AudioOUT) at the same time that the video is playing and don't restart current player, no close/open/seek

Why I can't do it in the audio option when I playing any video? I must to go Settings -> System -> AudioOUT
(This post was last modified: 2013-10-02 18:47 by DarkRay.)
find quote
OCDHD Offline
Junior Member
Posts: 28
Joined: Jul 2013
Reputation: 0
Post: #688
I am not alone in this matter. This Dual audio problem has been an ongoing issue for many. The main issue I state again is, some people do not have HDMI on their AVRs, and even if they do, there are numerous Handshake issues with HDMI and it causes more problems than it is worth. This is a creation of Intel and Microsoft together, and anyone who does not follow their rules gets sued out of existence. This is built from the ground up to prevent Digital Copying, although no one seems to want to admit it. It's not just Microsoft. Apple is doing it as well as some Linux distros. This Limitation prevents the use of Multiple Zones. So if you want to send the same sound to many different Outputs, it is nearly impossible to do so. This is not just XBMC. Infact, I think XBMC does the best it can. If you look at many other softwares, such as Foobar, which I use primarily for music, it has NO way to select Multiple Zones to send audio to. Microsoft claims that the software should do this but how can the software do this when Microsoft and Intel have limited the capability to do so? When Microsoft says something is by design, it is not by design to make your life better, its by design to make it more miserable and time consuming for you. For every 1 thing they do right, they break atleast 5 more. If Microsoft were a construction worker hired to fix the floors in your kitchen, they would turn your kitchen into a bathroom but give you the good news that you can now cook in your bathroom. I'm gonna end my rant but here is a link maybe some of you would be interested in with possible solutions.
http://www.avsforum.com/t/1391807/list-o...-solutions
find quote
twelvebore Offline
Senior Member
Posts: 140
Joined: Mar 2011
Reputation: 3
Post: #689
(2013-10-03 19:17)OCDHD Wrote:  I am not alone in this matter. This Dual audio problem has been an ongoing issue for many. The main issue I state again is, some people do not have HDMI on their AVRs, and even if they do, there are numerous Handshake issues with HDMI and it causes more problems than it is worth. This is a creation of Intel and Microsoft together, and anyone who does not follow their rules gets sued out of existence. This is built from the ground up to prevent Digital Copying, although no one seems to want to admit it. It's not just Microsoft. Apple is doing it as well as some Linux distros. This Limitation prevents the use of Multiple Zones. So if you want to send the same sound to many different Outputs, it is nearly impossible to do so. This is not just XBMC. Infact, I think XBMC does the best it can. If you look at many other softwares, such as Foobar, which I use primarily for music, it has NO way to select Multiple Zones to send audio to. Microsoft claims that the software should do this but how can the software do this when Microsoft and Intel have limited the capability to do so? When Microsoft says something is by design, it is not by design to make your life better, its by design to make it more miserable and time consuming for you. For every 1 thing they do right, they break atleast 5 more. If Microsoft were a construction worker hired to fix the floors in your kitchen, they would turn your kitchen into a bathroom but give you the good news that you can now cook in your bathroom. I'm gonna end my rant but here is a link maybe some of you would be interested in with possible solutions.
http://www.avsforum.com/t/1391807/list-o...-solutions

What the hell are you rabbiting on about? Are you seriously saying that Microsoft, Intel and Apple are responsible for the fact that my Denon AVR won't play digital sources on it's Zone 2?
(This post was last modified: 2013-10-04 12:10 by twelvebore.)
find quote
OCDHD Offline
Junior Member
Posts: 28
Joined: Jul 2013
Reputation: 0
Post: #690
(2013-10-04 12:09)twelvebore Wrote:  
(2013-10-03 19:17)OCDHD Wrote:  I am not alone in this matter. This Dual audio problem has been an ongoing issue for many. The main issue I state again is, some people do not have HDMI on their AVRs, and even if they do, there are numerous Handshake issues with HDMI and it causes more problems than it is worth. This is a creation of Intel and Microsoft together, and anyone who does not follow their rules gets sued out of existence. This is built from the ground up to prevent Digital Copying, although no one seems to want to admit it. It's not just Microsoft. Apple is doing it as well as some Linux distros. This Limitation prevents the use of Multiple Zones. So if you want to send the same sound to many different Outputs, it is nearly impossible to do so. This is not just XBMC. Infact, I think XBMC does the best it can. If you look at many other softwares, such as Foobar, which I use primarily for music, it has NO way to select Multiple Zones to send audio to. Microsoft claims that the software should do this but how can the software do this when Microsoft and Intel have limited the capability to do so? When Microsoft says something is by design, it is not by design to make your life better, its by design to make it more miserable and time consuming for you. For every 1 thing they do right, they break atleast 5 more. If Microsoft were a construction worker hired to fix the floors in your kitchen, they would turn your kitchen into a bathroom but give you the good news that you can now cook in your bathroom. I'm gonna end my rant but here is a link maybe some of you would be interested in with possible solutions.
http://www.avsforum.com/t/1391807/list-o...-solutions

What the hell are you rabbiting on about? Are you seriously saying that Microsoft, Intel and Apple are responsible for the fact that my Denon AVR won't play digital sources on it's Zone 2?

Yes. One of the reasons why. They made it difficult through their Mixer to send 1 audio stream to multiple outputs on a Single sound card. This led to many software programmers to not even bother with this "feature" so many drivers just don't allow you to output 1 stream through say an Analog and Digital at the same time. This was possible in XP but not since Vista. This is a major problem that Microsoft has refused to fix by blaming software programmers instead. There is a realtek patch you can find that will allow this on some systems. Some drivers for certain soundcards will allow also this under Vista or Windows 7. But this is mainly to stop Pirates from obtaining digital audio for recording purposes which makes Windows not very usable on its own for audio manipulation. You can buy external Mixers or equipment from Monoprice which will do this. I hope enjoyed my Rabbiting.
find quote
Post Reply