Switching audio outputs through API ?

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
mikehunt Offline
Junior Member
Posts: 14
Joined: Jan 2011
Reputation: 0
Post: #1
Good day !

I've got XBMC set up where it's outputing to 2 different TV sets through an HDMI matrix. I've got a problem where only 1 of the sets can use the sound off of the HDMI, and the other uses optical. Until I get a bit more money to buy a decent multi-zone receiver, I'm stuck with this setup.

No I have no problem switching audio sources, but some times it gets a bit confusing for other members in the house. I've already got a home "dashboard" set up that handles a bunch of tasks, and creating a new task for "switch audio to romm X" would be really awesome.

To do this, I need to be able to switch audio outputs from an API call. You can do it through the UI, so I figure it's probably not a long stretch away from being able to do it through an API call.

Also, second part to this question : Is there a way to switch audio outputs without restarting XBMC ? I've got a small process manager that I wrote that kills XBMC then restarts it, but it would be cool if I didn't need to do this.

Thanks !
Eric.

Data server:
Dell precision 670, Dual Xeon, 4 GB of ram
Running Amahi with greyhole with a total of 6 TB of HD in an 8-bay hard drive tower
XBMC:
Windows 2008 R2 server, 16 GB of ram, AMD Phenom X6 @ 2.80 ghz, Using onboard video card with HDMI out
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,830
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #2
Currently switching audio outputs through JSON-RPC API (which is the API you would probably be using) is not possible. The problem is not the switching itself but getting it done right so that it also shows correctly in the settings dialog. It's a bit complicated to explain but generally the way changing settings in XBMC is currently implemented makes it very very difficult to change a setting from outside the settings dialog (which would be the case when doing it through JSON-RPC).

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
mikehunt Offline
Junior Member
Posts: 14
Joined: Jan 2011
Reputation: 0
Post: #3
Is there any way to do this doing a DB call or changing some setting in an XML file ? I know it's ugly/dangerous to do, especially for including as a feature within XBMC, but if it's doable, I would do it myself locally and be happy with that lol.
Oh and I already have the code for reloading XBMC, so I don't mind closing xbmc, making the change, reloading xbmc.

Data server:
Dell precision 670, Dual Xeon, 4 GB of ram
Running Amahi with greyhole with a total of 6 TB of HD in an 8-bay hard drive tower
XBMC:
Windows 2008 R2 server, 16 GB of ram, AMD Phenom X6 @ 2.80 ghz, Using onboard video card with HDMI out
(This post was last modified: 2012-06-18 21:27 by mikehunt.)
find quote
Aubrien Offline
Senior Member
Posts: 103
Joined: Jan 2012
Reputation: 3
Post: #4
Hmmm, I just posted about wishing I could do this in another thread due to issues with the new AudioEngine...

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

Even if there were a way to do it with an API call that did not update the UI then it would fix the AE issue I spoke of as we would be changing it back as soon as the XBMC thread is unpaused and returned to anyway. I just need to free up the busy device until we come back to XBMC.
find quote
bossanova808 Offline
Member+
Posts: 1,542
Joined: Sep 2009
Reputation: 20
Location: Melbourne, Australia
Post: #5
+1 for this - with exclusive wasapi locking going on with AE (which it would seem doesn't release in the GUI even if no gui sounds is selected) - I'm going to need this with my Add-on:XSqueeze
find quote
mikebzh44 Offline
Posting Freak
Posts: 1,116
Joined: Nov 2011
Reputation: 21
Location: Nantes - France
Post: #6
I also need this feature.

For now, I'm always using my optical output to my A/V receiver but i would be great to switch for optical to HDMI to play 2.0 videos on my TV.

No need to switch on A/V receiver = less power consumption => XBMC is ecological Big Grin

Sorry for my english, but, you know, I'm French so ...

find quote
pumkinut Offline
Posting Freak
Posts: 881
Joined: May 2006
Reputation: 9
Post: #7
(2012-06-22 11:14)mikebzh44 Wrote:  I also need this feature.

For now, I'm always using my optical output to my A/V receiver but i would be great to switch for optical to HDMI to play 2.0 videos on my TV.

No need to switch on A/V receiver = less power consumption => XBMC is ecological Big Grin

Does your receiver support standby passthrough? My Yamaha does and I can use XBMC with my receiver in standby mode, I just have to make sure I make the change in the gui to not enable DTS or AC3 passthrough. The receiver still uses about 3W/Hr in standby, but that's far less than having it on to use XBMC.
find quote
mikebzh44 Offline
Posting Freak
Posts: 1,116
Joined: Nov 2011
Reputation: 21
Location: Nantes - France
Post: #8
I can't use my receiver as an HDMI hub as it's not 1080/24p compliant so :

HTPC -> HDMI -> TV to get 1080/24p
HTPC -> S/PDIF -> receiver to get AC3/DTS

Sorry for my english, but, you know, I'm French so ...

find quote
erhnam Offline
Team-XBMC Live Developer
Posts: 656
Joined: May 2009
Reputation: 2
Location: The Netherlands
Post: #9
(2012-06-18 21:24)Montellese Wrote:  Currently switching audio outputs through JSON-RPC API (which is the API you would probably be using) is not possible. The problem is not the switching itself but getting it done right so that it also shows correctly in the settings dialog. It's a bit complicated to explain but generally the way changing settings in XBMC is currently implemented makes it very very difficult to change a setting from outside the settings dialog (which would be the case when doing it through JSON-RPC).

Maybe ugly...., but isn't it possible to write a wrapper around this settings dialog so we can interact with json?
find quote