Permalink
Browse files

Merge pull request #2252 from popcornmix/toggle_digital_analogue

[rbp] Fix for audiotoggledigital on Pi
  • Loading branch information...
2 parents cc985c8 + 80a8ad6 commit 4aa245901af946bace919b8683603f326bf3329e @huceke huceke committed Mar 7, 2013
Showing with 9 additions and 4 deletions.
  1. +8 −4 xbmc/Application.cpp
  2. +1 −0 xbmc/settings/GUISettings.h
View
@@ -2859,11 +2859,15 @@ bool CApplication::OnAction(const CAction &action)
if (action.GetID() == ACTION_TOGGLE_DIGITAL_ANALOG)
{
- switch(g_guiSettings.GetInt("audiooutput.mode"))
+ // we are only allowed to SetInt to a value supported in GUISettings, so we keep trying until it sticks
+ int mode = g_guiSettings.GetInt("audiooutput.mode");
+ for (int i = 0; i < AUDIO_COUNT; i++)
{
- case AUDIO_ANALOG: g_guiSettings.SetInt("audiooutput.mode", AUDIO_IEC958); break;
- case AUDIO_IEC958: g_guiSettings.SetInt("audiooutput.mode", AUDIO_HDMI ); break;
- case AUDIO_HDMI : g_guiSettings.SetInt("audiooutput.mode", AUDIO_ANALOG); break;
+ if (++mode == AUDIO_COUNT)
+ mode = 0;
+ g_guiSettings.SetInt("audiooutput.mode", mode);
+ if (g_guiSettings.GetInt("audiooutput.mode") == mode)
+ break;
}
g_application.Restart();
@@ -84,6 +84,7 @@ class TiXmlElement;
#define AUDIO_ANALOG 0
#define AUDIO_IEC958 1
#define AUDIO_HDMI 2
+#define AUDIO_COUNT 3
#define AUDIO_IS_BITSTREAM(x) ((x) == AUDIO_IEC958 || (x) == AUDIO_HDMI)
#define VIDEO_NORMAL 0

0 comments on commit 4aa2459

Please sign in to comment.