Toggle D/A audio during video playback

Requests, suggestions, support, and everything else python / plugin related.
Post Reply
kitana
Posts: 103
Joined: Fri Sep 28, 2012 6:20 am
Has thanked: 2 times

Toggle D/A audio during video playback

Post by kitana »

Is there an option within keymap.xml or guisettings.xml to map an unused Xbox remote button to allow switching digital/analog audio output during video playback? The two existing methods include:

1) Press Menu button during video playback>Video OSD>Audio and subtitle settings>Audio output>toggle Analog/Digital
OR
2) Home Screen>System>Settings>System>Audio output>toggle Analog/Digital

There is a Python script for main XBMC that would accomplish this:
http://forum.xbmc.org/showthread.php?ti ... pid1168021
Would the same script be applicable to XBMC4Xbox if neither keymap.xml or guisettings.xml can perform such task?
kitana
Posts: 103
Joined: Fri Sep 28, 2012 6:20 am
Has thanked: 2 times

Re: Toggle D/A audio during video playback

Post by kitana »

kitana wrote: There is a Python script for main XBMC that would accomplish this:
http://forum.xbmc.org/showthread.php?ti ... pid1168021
I managed to get the sample script above to switch A/D audio output during playback under FullscreenVideo. However, I too ran into the same issue reported here. Although the A/D switch is successfully made both onscreen (popup notification during playback) and also shown within System>Settings>System>Audio output, the actual audio output doesn't change!
Is it simply not possible to pull this off mid-stream or the script needs some adjustments?

AudioSwitcher script is currently located under E/XBMC/scripts
Keymap.xml (mapped button 1 under FullscreenVideo only) is located under E/XBMC/system

Code: Select all

[import os, xbmc
current_audio_mode = xbmc.executehttpapi( "GetGUISetting(0;audiooutput.mode)" ).replace("<li>","")
if current_audio_mode == "0":  # Current audio mode is Analog; set values for switching to Digital
  audio_mode = 1
  audio_output = "Digital"  # Optional, if notification used
else:  # Current audio mode is not Analog (Optical/Coax or Digital); set values for switching to Analog
  audio_mode = 0
  audio_output = "Analog"  # Optional, if notification used
# Change audio settings and display notification of new mode:
xbmc.executehttpapi( "SetGUISetting(0;audiooutput.mode;%s)" % audio_mode )
xbmc.executebuiltin( "Notification(Audio output changed to:, %s, 2000)" %audio_output )  # Optional notification
Attachments
AudioSwitcher.zip
(100.7 KiB) Downloaded 122 times
Post Reply