see, that wasn't so bad, was it?
i suggested to use application.cpp so that you could macro it to switch on startup. (you may need to delay that sequence until xbmc is fully operational, after the splash is gone.) plus from there, it'll always work as its a global action. so if you're watching a photo slide show with music, you could switch back and forth if you wanted. don't know why you would, but you could
personally, i would also add a toggle action, say "ToggleAudioMode" which switches between the two. (I know you want to explicitly enable one or the other, so for that you need two discreet actions.)
re: passthru... if you have digital output enabled, the passthru options are available as settings in the gui. so, switch to digital output, and then enable them. those settings should stick, even if you switch back to analog. but obviously, they wont work unless you switch back to digital mode.
snippet assuming a toggle action:
Code:
// switch mode if digital output is allowed
int mode = g_guiSettings.GetInt("audiooutput.mode");
if (g_audioConfig.HasDigitalOutput() && mode == AUDIO_ANALOG)
g_guiSettings.SetInt("audiooutput.mode", AUDIO_DIGITAL);
else
g_guiSettings.SetInt("audiooutput.mode", AUDIO_ANALOG);
// no change, so just return
if (g_guiSettings.GetInt("audiooutput.mode") == mode)
return true;
// re-enable ac3 and dts passthru
if (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_DIGITAL)
{
g_audioConfig.SetAC3Enabled(g_guiSettings.GetBool("audiooutput.ac3passthrough"));
g_audioConfig.SetDTSEnabled(g_guiSettings.GetBool("audiooutput.dtspassthrough"));
// on xbox, these need to be written to the eeprom
if (g_audioConfig.NeedsSave())
g_audioConfig.Save();
}
Restart();
return true;