Index: WindowPlugins/GUISettings/GUISettingsMusic.cs =================================================================== --- WindowPlugins/GUISettings/GUISettingsMusic.cs (revision 28114) +++ WindowPlugins/GUISettings/GUISettingsMusic.cs (working copy) @@ -19,11 +19,13 @@ #endregion using System.Threading; +using System.Collections; using MediaPortal.Configuration; using MediaPortal.Dialogs; using MediaPortal.GUI.Library; using MediaPortal.Services; using MediaPortal.Threading; +using Un4seen.Bass; namespace MediaPortal.GUI.Settings { @@ -38,6 +40,7 @@ CONTROL_BTNREORGDB = 8, CONTROL_BTNDELALBUMINFO = 10, CONTROL_BTNDELALBUM = 13, + CONTROL_BTNAUDIODEVICE = 12, } ; private bool m_bAutoShuffle; @@ -143,6 +146,76 @@ } } } + + if (iControl == (int)Controls.CONTROL_BTNAUDIODEVICE) + { + string strAudioRenderer = ""; + string strAudioPlayer = ""; + using (Profile.Settings xmlreader = new Profile.MPSettings()) + { + strAudioRenderer = xmlreader.GetValueAsString("audioplayer", "sounddevice", "Default Sound Device"); + strAudioPlayer = xmlreader.GetValueAsString("audioplayer", "player", "BASS engine"); + } + BASS_DEVICEINFO[] soundDevices = Bass.BASS_GetDeviceInfos(); + GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); + if (dlg != null) + { + dlg.Reset(); + dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu + int selected = 0; + int count = 0; + // For Directshow player, we need to have the exact wording here + if (strAudioPlayer != "BASS engine") + { + dlg.Add("Default DirectSound Device"); + } + else + { + dlg.Add("Default Sound Device"); + } + if ("Default Sound Device" == strAudioRenderer) + { + selected = count; + } + count++; + // Fill the combo box, starting at 1 to skip the "No Sound" device + for (int i = 1; i < soundDevices.Length; i++) + { + dlg.Add(soundDevices[i].name); //delete + if (soundDevices[i].name == strAudioRenderer) + { + selected = count; + } + count++; + } + dlg.SelectedLabel = selected; + } + dlg.DoModal(GetID); + if (dlg.SelectedLabel < 0) + { + break; + } + using (Profile.Settings xmlwriter = new Profile.MPSettings()) + { + Log.Info("CONFIG: SelectedLabel: " + dlg.SelectedLabel); + string device = ""; + if (dlg.SelectedLabel == 0) + { + if (strAudioPlayer != "BASS engine") + { + device = "Default DirectSound Device"; + }else + { + device = "Default Sound Device"; + } + }else + { + device = (string)soundDevices[dlg.SelectedLabel].name; + } + Log.Info("CONFIG: Device: " + device); + xmlwriter.SetValue("audioplayer", "sounddevice", (string)device); + } + } } break; }