How can I change a simple audio setting from the menu?
#1
Hello,

I'm hoping someone can put me on the right path to resolve this particular tweak. I've been hunting through the forums and found lots of hints that have pushed me the right way, but not everything I need. I have a lot of experience programming, but not with python or XBMC's other scripting methods, so you can be technical, but be comprehensive, please Big Grin

I'm running XBMC 13.1 Gotham on Ubuntu 14.04, using the Aeon Nox 5 skin (which I love!). It's all running very smoothly despite the fact that I have a basic motherboard with no HDMI output (I'm using a direct VGA to the tv instead).

The PC has no HDMI sound output but can export 5.1 through the standard 3 sockets, so I've got a PC surround system plugged into these. The TV shares the front L/R speaker socket via a simple splitter cable, so I'd like to be able to switch easily between 2 and 5.1 channels, preferably by menu option or remote. (Before anybody asks, an AV receiver is a little beyond both my budget and needs.)

I have previously played with the profile-switching option (one profile for the TV output, one for the surround) but it seemed a little clunky to me to switch just the one value (not to mention difficult to maintain).

I've identified the setting that needs changing: System/Audio Output/Number of channels.

I know I can do this via the settings menu, but want this in a single menu command. It looks like the best way to do this would be via a script or command from a custom menu item, so following teeedubb's advice in http://forum.xbmc.org/showthread.php?tid=192263, I've managed to pin down some JSON-RPC code to do the job, which I can run from Ubuntu terminal (switching to 2 and 5.1 channels respectively):
Code:
curl -v -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.channels","value":1},"id":1}' http://localhost:8081/jsonrpc
and
Code:
curl -v -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.channels","value":8},"id":1}' http://localhost:8081/jsonrpc

These are working perfectly from the terminal, but what I can't figure out is the best way of triggering these from the menu. I've been looking at RunScript but I can't seem to get the syntax correct.

It also seems that I should be able to chop out a lot of the curl and http stuff and run this as direct JSON-RPC, but I'm not sure where to start.

My plan is that this is all fired from two custom menu items (I'll worry about toggling things at a later date), using the custom command option on the Aeon Nox 5 menu editing screen. It would be wonderful if I could get the whole thing into the call, but I suspect separate scripts would be easier to implement.

Could someone advise me, please? It would be really appreciated Big Grin

Thanks,

Jon
Reply

Logout Mark Read Team Forum Stats Members Help
How can I change a simple audio setting from the menu?0