From 67915fa48a757a7d54540cfa49609ba4c417fe80 Mon Sep 17 00:00:00 2001 From: AlwinEsch Date: Sat, 16 May 2015 13:31:13 +0200 Subject: [adsp] Add dsp processing setting dialog selection to player dialog --- .../720p/DialogAudioDSPSettings.xml | 244 +++++ addons/skin.confluence/720p/MusicOSD.xml | 20 +- addons/skin.confluence/720p/MusicVisualisation.xml | 71 +- addons/skin.confluence/720p/VideoFullScreen.xml | 19 +- addons/skin.confluence/720p/VideoOSD.xml | 15 +- addons/skin.confluence/720p/VideoOSDSettings.xml | 2 +- .../project/VS2010Express/libKODI_adsp.vcxproj | 4 +- project/VS2010Express/XBMC.vcxproj | 2 + project/VS2010Express/XBMC.vcxproj.filters | 11 +- xbmc/guilib/GUIWindowManager.cpp | 3 + xbmc/guilib/WindowIDs.h | 1 + xbmc/input/ButtonTranslator.cpp | 1 + xbmc/music/dialogs/GUIDialogMusicOSD.cpp | 3 +- xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp | 6 +- .../settings/dialogs/GUIDialogAudioDSPSettings.cpp | 1010 ++++++++++++++++++++ xbmc/settings/dialogs/GUIDialogAudioDSPSettings.h | 112 +++ xbmc/settings/dialogs/Makefile | 1 + .../dialogs/GUIDialogAudioSubtitleSettings.cpp | 31 +- .../video/dialogs/GUIDialogAudioSubtitleSettings.h | 1 + xbmc/video/dialogs/GUIDialogVideoOSD.cpp | 12 + 20 files changed, 1538 insertions(+), 31 deletions(-) create mode 100644 addons/skin.confluence/720p/DialogAudioDSPSettings.xml create mode 100644 xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp create mode 100644 xbmc/settings/dialogs/GUIDialogAudioDSPSettings.h diff --git a/addons/skin.confluence/720p/DialogAudioDSPSettings.xml b/addons/skin.confluence/720p/DialogAudioDSPSettings.xml new file mode 100644 index 0000000000..95fa7c41fe --- /dev/null +++ b/addons/skin.confluence/720p/DialogAudioDSPSettings.xml @@ -0,0 +1,244 @@ + + + 5 + + 240 + 60 + + dialogeffect + + + Conditional + + background image + 0 + 0 + 800 + 600 + DialogBack2.png + + + Dialog Header image + 40 + 16 + 720 + 40 + dialogheader.png + + + header label + 40 + 20 + 720 + 30 + font13_title + + center + center + selected + black + + + Close Window button + 710 + 15 + 64 + 32 + + - + PreviousMenu + DialogCloseButton-focus.png + DialogCloseButton.png + system.getbool(input.enablemouse) + + + control area + 40 + 65 + 520 + 470 + 5 + 60 + 60 + 60 + 5 + 5 + + + 560 + 65 + 25 + 470 + ScrollBarV.png + ScrollBarV_bar.png + ScrollBarV_bar_focus.png + ScrollBarNib.png + ScrollBarNib.png + 5 + 5 + 61 + 61 + false + vertical + + + info label + 40 + 540 + 720 + 30 + font13_title + + left + center + selected + black + + + Audio DSP Image + 555 + 540 + 85 + 35 + keep + !IsEmpty(ADSP.MasterOwnIcon) + $INFO[ADSP.MasterOwnIcon] + + + Audio Codec Image + 640 + 540 + 85 + 35 + keep + $INFO[VideoPlayer.AudioCodec,flagging/audio/,.png] + IsEmpty(ADSP.MasterOverrideIcon) + Player.HasVideo + + + Audio Codec Image + 640 + 540 + 85 + 35 + keep + $INFO[MusicPlayer.Codec,flagging/audio/,.png] + IsEmpty(ADSP.MasterOverrideIcon) + Player.HasAudio + + + Audio Codec Override Image + 640 + 540 + 85 + 35 + keep + !IsEmpty(ADSP.MasterOverrideIcon) + $INFO[ADSP.MasterOverrideIcon] + + + Audio Channels Image + 730 + 540 + 50 + 35 + keep + $INFO[VideoPlayer.AudioChannels,flagging/audio/,.png] + + + type label + 590 + 65 + 720 + 30 + font13_title + + left + center + grey2 + black + + + type label + 590 + 100 + 230 + 30 + font13_title + + left + center + selected + black + + + + Default Button + 0 + 0 + 40 + font13 + grey2 + white + button-focus2.png + + + Default RadioButton + 0 + 0 + 40 + font13 + grey2 + white + button-focus2.png + + + Default SpinControlex + 0 + 0 + 40 + font13 + grey2 + white + button-focus2.png + button-nofocus.png + center + yes + + + separator image + 2 + separator2.png + + + Default Edit + 0 + 0 + 40 + font13 + grey2 + white + button-nofocus.png + button-focus2.png + + + Default Slider + 40 + button-nofocus.png + button-focus2.png + font13 + grey2 + white + + + Default Label + 0 + 0 + 30 + + center + bottom + font13_title + grey + black + + + diff --git a/addons/skin.confluence/720p/MusicOSD.xml b/addons/skin.confluence/720p/MusicOSD.xml index bdfbfcdce6..18ea9d4914 100644 --- a/addons/skin.confluence/720p/MusicOSD.xml +++ b/addons/skin.confluence/720p/MusicOSD.xml @@ -27,7 +27,7 @@ 100 VisibleChange conditional - ![Window.IsVisible(AddonSettings) | Window.IsVisible(SelectDialog) | Window.IsVisible(VisualisationPresetList) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide)] + ![Window.IsVisible(AddonSettings) | Window.IsVisible(SelectDialog) | Window.IsVisible(VisualisationPresetList) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide) | Window.IsVisible(OSDAudioDSPSettings) | Window.IsVisible(Addon)] Seek Slider @@ -42,7 +42,7 @@ osd_slider_nibNF.png osd_slider_nib.png VisibleChange - ![Window.IsVisible(AddonSettings) | Window.IsVisible(SelectDialog) | Window.IsVisible(VisualisationPresetList) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide)] + ![Window.IsVisible(AddonSettings) | Window.IsVisible(SelectDialog) | Window.IsVisible(VisualisationPresetList) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide) | Window.IsVisible(OSDAudioDSPSettings) | Window.IsVisible(Addon)] 325 @@ -52,7 +52,7 @@ horizontal 0 VisibleChange - ![Window.IsVisible(AddonSettings) | Window.IsVisible(SelectDialog) | Window.IsVisible(VisualisationPresetList) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide)] + ![Window.IsVisible(AddonSettings) | Window.IsVisible(SelectDialog) | Window.IsVisible(VisualisationPresetList) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide) | Window.IsVisible(OSDAudioDSPSettings) | Window.IsVisible(Addon)] 55 55 @@ -247,16 +247,26 @@ PlayerControl(Random) - 215 + 160 55 - !MusicPlayer.Content(LiveTV) - 270 + 215 - MusicPlayer.Content(LiveTV) + + system.getbool(audiooutput.dspaddonsenabled) + 55 + 55 + + - + OSDDSPAudioFO.png + OSDDSPAudioNF.png + ActivateWindow(OSDAudioDSPSettings) + 55 55 diff --git a/addons/skin.confluence/720p/MusicVisualisation.xml b/addons/skin.confluence/720p/MusicVisualisation.xml index 6430cb97d8..fbe93ebc1a 100644 --- a/addons/skin.confluence/720p/MusicVisualisation.xml +++ b/addons/skin.confluence/720p/MusicVisualisation.xml @@ -25,7 +25,7 @@ VisibleChange - [Player.ShowInfo | Window.IsActive(MusicOSD)] + ![Window.IsVisible(AddonSettings) | Window.IsVisible(SelectDialog) | Window.IsVisible(VisualisationPresetList) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide)] + [Player.ShowInfo | Window.IsActive(MusicOSD)] + ![Window.IsVisible(AddonSettings) | Window.IsVisible(SelectDialog) | Window.IsVisible(VisualisationPresetList) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide) | Window.IsVisible(OSDAudioDSPSettings) | Window.IsVisible(Addon)] 0 -150 @@ -129,6 +129,7 @@ 35 5 horizontal + !system.getbool(audiooutput.dspaddonsenabled) auto 30 @@ -170,6 +171,72 @@ + + 20 + 60 + 910 + 35 + 5 + horizontal + system.getbool(audiooutput.dspaddonsenabled) + + auto + 30 + font30 + left + center + + orange + true + + + ADSP Master Mode Image + 80 + 35 + keep + !IsEmpty(ADSP.MasterOwnIcon) + $INFO[ADSP.MasterOwnIcon] + + + Audio Codec Image + 80 + 35 + keep + IsEmpty(ADSP.MasterOverrideIcon) + $INFO[MusicPlayer.Codec,flagging/audio/,.png] + + + ADSP Audio Codec Override Image + 80 + 35 + keep + !IsEmpty(ADSP.MasterOverrideIcon) + $INFO[ADSP.MasterOverrideIcon] + + + Rating + 110 + 35 + + rating back + 0 + 0 + 110 + 35 + stretch + flagging/blank.png + + + Rating + 5 + 0 + 100 + 35 + keep + $INFO[Player.StarRating,LeftRating/] + + + 0 120 @@ -222,7 +289,7 @@ 0 50 - Player.ShowCodec + ![Window.IsVisible(script-cu-lrclyrics-main.xml) | Window.IsVisible(VisualisationSettings) | Window.IsVisible(VisualisationPresetList) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide)] + Player.ShowCodec + ![Window.IsVisible(script-cu-lrclyrics-main.xml) | Window.IsVisible(VisualisationSettings) | Window.IsVisible(VisualisationPresetList) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide) | Window.IsVisible(OSDAudioDSPSettings) | Window.IsVisible(Addon)] VisibleChange media info background image diff --git a/addons/skin.confluence/720p/VideoFullScreen.xml b/addons/skin.confluence/720p/VideoFullScreen.xml index 8f917179f7..0d4a0e2b51 100644 --- a/addons/skin.confluence/720p/VideoFullScreen.xml +++ b/addons/skin.confluence/720p/VideoFullScreen.xml @@ -4,7 +4,7 @@ - [Player.ShowInfo | Window.IsActive(VideoOSD)] + ![Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(VideoBookmarks) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide) | Window.IsVisible(SliderDialog)] + [Player.ShowInfo | Window.IsActive(VideoOSD)] + ![Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(OSDAudioDSPSettings) | Window.IsVisible(VideoBookmarks) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide) | Window.IsVisible(SliderDialog)] VisibleChange 0 @@ -213,13 +213,30 @@ keep $INFO[VideoPlayer.VideoResolution,flagging/video/,.png] + + ADSP Master Mode Image + 85 + 35 + keep + !IsEmpty(ADSP.MasterOwnIcon) + $INFO[ADSP.MasterOwnIcon] + Audio Codec Image 85 35 keep + IsEmpty(ADSP.MasterOverrideIcon) $INFO[VideoPlayer.AudioCodec,flagging/audio/,.png] + + ADSP Audio Codec Override Image + 85 + 35 + keep + !IsEmpty(ADSP.MasterOverrideIcon) + $INFO[ADSP.MasterOverrideIcon] + Audio Channels Image 50 diff --git a/addons/skin.confluence/720p/VideoOSD.xml b/addons/skin.confluence/720p/VideoOSD.xml index 54dec84c83..118a3bf62d 100644 --- a/addons/skin.confluence/720p/VideoOSD.xml +++ b/addons/skin.confluence/720p/VideoOSD.xml @@ -27,7 +27,7 @@ 100 conditional VisibleChange - ![Window.IsVisible(SliderDialog) | Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(VideoBookmarks)] + ![Window.IsVisible(SliderDialog) | Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(OSDAudioDSPSettings) | Window.IsVisible(VideoBookmarks)] Seek Slider @@ -42,7 +42,7 @@ osd_slider_nibNF.png osd_slider_nib.png VisibleChange - ![Window.IsVisible(SliderDialog) | Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(VideoBookmarks) | VideoPlayer.Content(LiveTV)] + ![Window.IsVisible(SliderDialog) | Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(OSDAudioDSPSettings) | Window.IsVisible(VideoBookmarks) | VideoPlayer.Content(LiveTV)] 325 @@ -50,7 +50,7 @@ horizontal 0 VisibleChange - ![Window.IsVisible(SliderDialog) | Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(VideoBookmarks) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide)] + ![Window.IsVisible(SliderDialog) | Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(OSDAudioDSPSettings) | Window.IsVisible(VideoBookmarks) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide)] 1000 55 @@ -213,13 +213,16 @@ 1000 ActivateWindow(OSDVideoSettings) - + 55 55 - OSDAudioFO.png OSDAudioNF.png + system.getbool(audiooutput.dspaddonsenabled) + OSDDSPAudioFO.png + OSDDSPAudioNF.png 1000 1000 ActivateWindow(OSDAudioSettings) @@ -281,7 +284,7 @@ Control.HasFocus(410) | Control.HasFocus(250) | ControlGroup(400).HasFocus - ![Window.IsVisible(SliderDialog) | Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(VideoBookmarks)] + ![Window.IsVisible(SliderDialog) | Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(OSDAudioDSPSettings) | Window.IsVisible(VideoBookmarks)] VisibleChange Conditional Conditional @@ -402,7 +405,7 @@ Control.HasFocus(520) | Control.HasFocus(255) | ControlGroup(500).HasFocus - videoplayer.isstereoscopic + ![Window.IsVisible(SliderDialog) | Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(VideoBookmarks) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide)] + [Control.HasFocus(255) | ControlGroup(500).HasFocus | Control.HasFocus(520)] + videoplayer.isstereoscopic + ![Window.IsVisible(SliderDialog) | Window.IsVisible(OSDVideoSettings) | Window.IsVisible(OSDAudioSettings) | Window.IsVisible(OSDAudioDSPSettings) | Window.IsVisible(VideoBookmarks) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(PVROSDGuide)] + [Control.HasFocus(255) | ControlGroup(500).HasFocus | Control.HasFocus(520)] VisibleChange Conditional 200 diff --git a/addons/skin.confluence/720p/VideoOSDSettings.xml b/addons/skin.confluence/720p/VideoOSDSettings.xml index e274a8a7f8..776c7dc3b5 100644 --- a/addons/skin.confluence/720p/VideoOSDSettings.xml +++ b/addons/skin.confluence/720p/VideoOSDSettings.xml @@ -9,7 +9,7 @@ dialogeffect - Conditional + Conditional background image 0 diff --git a/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj b/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj index 005aba0e7b..87a33fa58a 100644 --- a/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj +++ b/lib/addons/library.kodi.adsp/project/VS2010Express/libKODI_adsp.vcxproj @@ -50,7 +50,7 @@ - ..\..\..\..\..\xbmc;..\..\..\..\..\xbmc\addons\include;..\..\..\..\..\xbmc\cores\dvdplayer\DVDDemuxers;%(AdditionalIncludeDirectories) + ..\..\..\..\..\xbmc;..\..\..\..\..\xbmc\addons\include;..\..\..\..\..\xbmc\cores\dvdplayer\DVDDemuxers;..\..\..\..\..\addons\library.xbmc.addon;%(AdditionalIncludeDirectories) VDR_EXPORTS;_WIN32PC;%(PreprocessorDefinitions) Sync @@ -62,7 +62,7 @@ - ..\..\..\..\..\xbmc;..\..\..\..\..\xbmc\addons\include;..\..\..\..\..\xbmc\cores\dvdplayer\DVDDemuxers;%(AdditionalIncludeDirectories) + ..\..\..\..\..\xbmc;..\..\..\..\..\xbmc\addons\include;..\..\..\..\..\xbmc\cores\dvdplayer\DVDDemuxers;..\..\..\..\..\addons\library.xbmc.addon;%(AdditionalIncludeDirectories) HAS_SDL_OPENGL;HAS_SDL;_USRDLL;XBMC_VDR_EXPORTS;_WIN32PC;%(PreprocessorDefinitions) Sync diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index f4465991ce..a98bdd8c48 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -788,6 +788,7 @@ + @@ -1036,6 +1037,7 @@ + diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index ba51b16613..b4ca7ceffe 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -3098,11 +3098,14 @@ music + + test + settings\dialogs - - test + + settings\dialogs utils @@ -6052,6 +6055,7 @@ network\dacp + settings\dialogs @@ -6073,6 +6077,9 @@ messaging + + settings\dialogs + diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp index 45e8a839e8..5ae1aa8b9b 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -137,6 +137,7 @@ #include "dialogs/GUIDialogMediaFilter.h" #include "video/dialogs/GUIDialogSubtitles.h" #include "settings/dialogs/GUIDialogAudioDSPManager.h" +#include "settings/dialogs/GUIDialogAudioDSPSettings.h" #ifdef HAS_KARAOKE #include "music/karaoke/GUIDialogKaraokeSongSelector.h" @@ -278,6 +279,7 @@ void CGUIWindowManager::CreateWindows() Add(new CGUIDialogPVRGuideOSD); Add(new ActiveAE::CGUIDialogAudioDSPManager); + Add(new ActiveAE::CGUIDialogAudioDSPSettings); Add(new CGUIDialogSelect); Add(new CGUIDialogMusicInfo); @@ -376,6 +378,7 @@ bool CGUIWindowManager::DestroyWindows() Delete(WINDOW_DIALOG_OSD_TELETEXT); Delete(WINDOW_DIALOG_AUDIO_DSP_MANAGER); + Delete(WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS); Delete(WINDOW_DIALOG_TEXT_VIEWER); Delete(WINDOW_DIALOG_PLAY_EJECT); diff --git a/xbmc/guilib/WindowIDs.h b/xbmc/guilib/WindowIDs.h index 5d663aaf3a..b4338d258f 100644 --- a/xbmc/guilib/WindowIDs.h +++ b/xbmc/guilib/WindowIDs.h @@ -105,6 +105,7 @@ #define WINDOW_DIALOG_MEDIA_FILTER 10152 #define WINDOW_DIALOG_SUBTITLES 10153 #define WINDOW_DIALOG_AUDIO_DSP_MANAGER 10154 +#define WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS 10155 #define WINDOW_MUSIC_PLAYLIST 10500 #define WINDOW_MUSIC_FILES 10501 diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp index 3200586303..59828d9e6b 100644 --- a/xbmc/input/ButtonTranslator.cpp +++ b/xbmc/input/ButtonTranslator.cpp @@ -354,6 +354,7 @@ static const ActionMapping windows[] = {"osdvideosettings" , WINDOW_DIALOG_VIDEO_OSD_SETTINGS}, {"osdaudiosettings" , WINDOW_DIALOG_AUDIO_OSD_SETTINGS}, {"audiodspmanager" , WINDOW_DIALOG_AUDIO_DSP_MANAGER}, + {"osdaudiodspsettings" , WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS}, {"videobookmarks" , WINDOW_DIALOG_VIDEO_BOOKMARKS}, {"filebrowser" , WINDOW_DIALOG_FILE_BROWSER}, {"networksetup" , WINDOW_DIALOG_NETWORK_SETUP}, diff --git a/xbmc/music/dialogs/GUIDialogMusicOSD.cpp b/xbmc/music/dialogs/GUIDialogMusicOSD.cpp index 88e85d8503..756255cdfe 100644 --- a/xbmc/music/dialogs/GUIDialogMusicOSD.cpp +++ b/xbmc/music/dialogs/GUIDialogMusicOSD.cpp @@ -90,7 +90,8 @@ void CGUIDialogMusicOSD::FrameMove() // check for movement of mouse or a submenu open if (CInputManager::Get().IsMouseActive() || g_windowManager.IsWindowActive(WINDOW_DIALOG_VIS_SETTINGS) || - g_windowManager.IsWindowActive(WINDOW_DIALOG_VIS_PRESET_LIST)) + g_windowManager.IsWindowActive(WINDOW_DIALOG_VIS_PRESET_LIST) || + g_windowManager.IsWindowActive(WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS)) // extend show time by original value SetAutoClose(m_showDuration); } diff --git a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp b/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp index 5ec7da844c..bccc00ffa5 100644 --- a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp +++ b/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp @@ -567,7 +567,7 @@ bool CGUIDialogAudioDSPManager::OnContextButton(int itemNumber, CONTEXT_BUTTON b CGUIDialogTextViewer* pDlgInfo = (CGUIDialogTextViewer*)g_windowManager.GetWindow(WINDOW_DIALOG_TEXT_VIEWER); pDlgInfo->SetHeading(g_localizeStrings.Get(15062) + " - " + pItem->GetProperty("Name").asString()); pDlgInfo->SetText(addon->GetString((uint32_t)pItem->GetProperty("Help").asInteger())); - pDlgInfo->DoModal(); + pDlgInfo->Open(); } } else if (button == CONTEXT_BUTTON_ACTIVATE) @@ -694,7 +694,7 @@ void CGUIDialogAudioDSPManager::Update() helper_LogError(__FUNCTION__); return; } - pDlgBusy->Show(); + pDlgBusy->Open(); Clear(); @@ -790,7 +790,7 @@ void CGUIDialogAudioDSPManager::SaveList(void) helper_LogError(__FUNCTION__); return; } - pDlgBusy->Show(); + pDlgBusy->Open(); /* persist all modes */ if (UpdateDatabase(pDlgBusy)) diff --git a/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp b/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp new file mode 100644 index 0000000000..aa652def88 --- /dev/null +++ b/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp @@ -0,0 +1,1010 @@ +/* + * Copyright (C) 2005-2015 Team KODI + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KODI; see the file COPYING. If not, see + * . + * + */ + +#include "GUIDialogAudioDSPSettings.h" +#include "Application.h" +#include "addons/Skin.h" +#include "cores/IPlayer.h" +#include "cores/AudioEngine/DSPAddons/ActiveAEDSPDatabase.h" +#include "cores/AudioEngine/DSPAddons/ActiveAEDSPMode.h" +#include "cores/AudioEngine/Utils/AEUtil.h" +#include "dialogs/GUIDialogKaiToast.h" +#include "dialogs/GUIDialogYesNo.h" +#include "guilib/GUIMessage.h" +#include "guilib/GUIWindowManager.h" +#include "guilib/LocalizeStrings.h" +#include "profiles/ProfilesManager.h" +#include "settings/AdvancedSettings.h" +#include "settings/MediaSettings.h" +#include "settings/MediaSourceSettings.h" +#include "settings/Settings.h" +#include "settings/lib/SettingSection.h" +#include "settings/lib/Setting.h" +#include "settings/lib/SettingsManager.h" +#include "settings/windows/GUIControlSettings.h" +#include "utils/log.h" +#include "utils/StringUtils.h" + +#define SETTING_AUDIO_CAT_MAIN "audiodspmainsettings" +#define SETTING_AUDIO_CAT_MASTER "audiodspmastersettings" +#define SETTING_AUDIO_CAT_POST_PROCESS "audiodsppostsettings" +#define SETTING_AUDIO_CAT_RESAMPLING "audiodspresamplesettings" +#define SETTING_AUDIO_CAT_PRE_PROCESS "audiodsppresettings" +#define SETTING_AUDIO_CAT_MISC "audiodspmiscsettings" +#define SETTING_AUDIO_CAT_PROC_INFO "audiodspprocinfo" + +#define SETTING_AUDIO_MAIN_STREAMTYPE "audiodsp.main.streamtype" +#define SETTING_AUDIO_MAIN_MODETYPE "audiodsp.main.modetype" +#define SETTING_AUDIO_MAIN_VOLUME "audiodsp.main.volume" +#define SETTING_AUDIO_MAIN_VOLUME_AMPLIFICATION "audiodsp.main.volumeamplification" +#define SETTING_AUDIO_MAIN_BUTTON_MASTER "audiodsp.main.menumaster" +#define SETTING_AUDIO_MAIN_BUTTON_OUTPUT "audiodsp.main.menupostproc" +#define SETTING_AUDIO_MAIN_BUTTON_RESAMPLE "audiodsp.main.menuresample" +#define SETTING_AUDIO_MAIN_BUTTON_PRE_PROC "audiodsp.main.menupreproc" +#define SETTING_AUDIO_MAIN_BUTTON_MISC "audiodsp.main.menumisc" +#define SETTING_AUDIO_MAIN_BUTTON_INFO "audiodsp.main.menuinfo" +#define SETTING_AUDIO_MAIN_MAKE_DEFAULT "audiodsp.main.makedefault" +#define SETTING_AUDIO_MASTER_SETTINGS_MENUS "audiodsp.master.menu_" +#define SETTING_AUDIO_POST_PROC_AUDIO_DELAY "audiodsp.postproc.delay" +#define SETTING_AUDIO_PROC_SETTINGS_MENUS "audiodsp.proc.menu_" + +#define SETTING_STREAM_INFO_INPUT_CHANNELS "audiodsp.info.inputchannels" +#define SETTING_STREAM_INFO_INPUT_CHANNEL_NAMES "audiodsp.info.inputchannelnames" +#define SETTING_STREAM_INFO_INPUT_SAMPLERATE "audiodsp.info.inputsamplerate" +#define SETTING_STREAM_INFO_OUTPUT_CHANNELS "audiodsp.info.outputchannels" +#define SETTING_STREAM_INFO_OUTPUT_CHANNEL_NAMES "audiodsp.info.outputchannelnames" +#define SETTING_STREAM_INFO_OUTPUT_SAMPLERATE "audiodsp.info.outputsamplerate" +#define SETTING_STREAM_INFO_CPU_USAGE "audiodsp.info.cpuusage" +#define SETTING_STREAM_INFO_TYPE_INPUT "audiodsp.info.typeinput" +#define SETTING_STREAM_INFO_TYPE_PREPROC "audiodsp.info.typepreproc" +#define SETTING_STREAM_INFO_TYPE_MASTER "audiodsp.info.typemaster" +#define SETTING_STREAM_INFO_TYPE_POSTPROC "audiodsp.info.typepostproc" +#define SETTING_STREAM_INFO_TYPE_OUTPUT "audiodsp.info.typeoutput" +#define SETTING_STREAM_INFO_MODE_CPU_USAGE "audiodsp.info.modecpuusage_" + +#define CONTROL_SETTINGS_LABEL 2 + +using namespace std; +using namespace ActiveAE; + +CGUIDialogAudioDSPSettings::CGUIDialogAudioDSPSettings() + : CGUIDialogSettingsManualBase(WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS, "DialogAudioDSPSettings.xml") +{ + m_ActiveStreamId = 0; + m_GetCPUUsage = false; + m_MenuPositions[SETTING_AUDIO_CAT_MAIN] = CONTROL_SETTINGS_START_CONTROL; + m_MenuPositions[SETTING_AUDIO_CAT_MASTER] = CONTROL_SETTINGS_START_CONTROL; + m_MenuPositions[SETTING_AUDIO_CAT_POST_PROCESS] = CONTROL_SETTINGS_START_CONTROL; + m_MenuPositions[SETTING_AUDIO_CAT_RESAMPLING] = CONTROL_SETTINGS_START_CONTROL; + m_MenuPositions[SETTING_AUDIO_CAT_PRE_PROCESS] = CONTROL_SETTINGS_START_CONTROL; + m_MenuPositions[SETTING_AUDIO_CAT_MISC] = CONTROL_SETTINGS_START_CONTROL; + m_MenuPositions[SETTING_AUDIO_CAT_PROC_INFO] = CONTROL_SETTINGS_START_CONTROL+2; +} + +CGUIDialogAudioDSPSettings::~CGUIDialogAudioDSPSettings(void) +{ } + +int CGUIDialogAudioDSPSettings::FindCategoryIndex(const std::string &catId) +{ + for (unsigned int i = 0; i < m_categories.size(); i++) + { + if (m_categories[i]->GetId() == catId) + return i; + } + return 0; +} + +void CGUIDialogAudioDSPSettings::OpenMenu(const std::string &id) +{ + m_GetCPUUsage = false; + m_MenuPositions[m_categories[m_iCategory]->GetId()] = GetFocusedControlID(); + m_MenuHierarchy.push_back(m_iCategory); + m_iCategory = FindCategoryIndex(id); + + /* Get menu name */ + m_MenuName = -1; + if (id == SETTING_AUDIO_CAT_MAIN) + m_MenuName = 15028; + else if (id == SETTING_AUDIO_CAT_MASTER) + m_MenuName = 15029; + else if (id == SETTING_AUDIO_CAT_POST_PROCESS) + m_MenuName = 15030; + else if (id == SETTING_AUDIO_CAT_RESAMPLING) + m_MenuName = 15035; + else if (id == SETTING_AUDIO_CAT_PRE_PROCESS) + m_MenuName = 15037; + else if (id == SETTING_AUDIO_CAT_MISC) + m_MenuName = 15038; + else if (id == SETTING_AUDIO_CAT_PROC_INFO) + m_MenuName = 15031; + + SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, g_localizeStrings.Get(m_MenuName)); + CreateSettings(); + SET_CONTROL_FOCUS(m_MenuPositions[id], 0); +} + +bool CGUIDialogAudioDSPSettings::OnMessage(CGUIMessage &message) +{ + switch (message.GetMessage()) + { + case GUI_MSG_CLICKED: + { + int iControl = message.GetSenderId(); + if (iControl >= CONTROL_SETTINGS_START_CONTROL && iControl < (int)(CONTROL_SETTINGS_START_CONTROL + m_settingControls.size())) + { + CSetting *setting = GetSettingControl(iControl)->GetSetting(); + if (setting != NULL) + { + if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_MASTER) + OpenMenu(SETTING_AUDIO_CAT_MASTER); + else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_OUTPUT) + OpenMenu(SETTING_AUDIO_CAT_POST_PROCESS); + else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_RESAMPLE) + OpenMenu(SETTING_AUDIO_CAT_RESAMPLING); + else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_PRE_PROC) + OpenMenu(SETTING_AUDIO_CAT_PRE_PROCESS); + else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_MISC) + OpenMenu(SETTING_AUDIO_CAT_MISC); + else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_INFO) + { + SetupView(); + OpenMenu(SETTING_AUDIO_CAT_PROC_INFO); + m_GetCPUUsage = true; + } + else + { + if (setting->GetId().substr(0, 19) == SETTING_AUDIO_PROC_SETTINGS_MENUS) + OpenAudioDSPMenu(strtol(setting->GetId().substr(19).c_str(), NULL, 0)); + else if (setting->GetId().substr(0, 21) == SETTING_AUDIO_MASTER_SETTINGS_MENUS) + OpenAudioDSPMenu(strtol(setting->GetId().substr(21).c_str(), NULL, 0)); + else if (setting->GetId().substr(0, 27) == SETTING_STREAM_INFO_MODE_CPU_USAGE) + { + if (!OpenAudioDSPMenu(m_ActiveModesData[strtol(setting->GetId().substr(27).c_str(), NULL, 0)].MenuListPtr)) + CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(15031), g_localizeStrings.Get(416)); + } + } + } + } + break; + } + default: + break; + } + + return CGUIDialogSettingsManualBase::OnMessage(message); +} + +bool CGUIDialogAudioDSPSettings::OnBack(int actionID) +{ + // if the setting dialog is not a window but a dialog we need to close differently + int mainCategory = FindCategoryIndex(SETTING_AUDIO_CAT_MAIN); + if (m_iCategory == mainCategory) + return CGUIDialogSettingsManualBase::OnBack(actionID); + + m_MenuPositions[m_categories[m_iCategory]->GetId()] = GetFocusedControlID(); + if (!m_MenuHierarchy.empty()) + { + m_iCategory = m_MenuHierarchy.back(); + m_MenuHierarchy.pop_back(); + } + else + m_iCategory = mainCategory; + + if (m_iCategory == mainCategory) + SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, g_localizeStrings.Get(15028)); + + CreateSettings(); + SET_CONTROL_FOCUS(m_MenuPositions[m_categories[m_iCategory]->GetId()], 0); + + return true; +} + +void CGUIDialogAudioDSPSettings::FrameMove() +{ + // update the volume setting if necessary + float newVolume = g_application.GetVolume(false); + if (newVolume != m_volume) + m_settingsManager->SetNumber(SETTING_AUDIO_MAIN_VOLUME, newVolume); + + if (g_application.m_pPlayer->HasPlayer()) + { + const CVideoSettings &videoSettings = CMediaSettings::Get().GetCurrentVideoSettings(); + + // these settings can change on the fly + if (SupportsAudioFeature(IPC_AUD_OFFSET)) + m_settingsManager->SetNumber(SETTING_AUDIO_POST_PROC_AUDIO_DELAY, videoSettings.m_AudioDelay); + + bool forceReload = false; + unsigned int streamId = CActiveAEDSP::Get().GetActiveStreamId(); + if (m_ActiveStreamId != streamId) + { + m_ActiveStreamId = streamId; + m_ActiveStreamProcess = CActiveAEDSP::Get().GetDSPProcess(m_ActiveStreamId); + if (m_ActiveStreamId == (unsigned int)-1 || !m_ActiveStreamProcess) + { + Close(true); + return; + } + forceReload = true; + } + + int modeUniqueId; + AE_DSP_BASETYPE usedBaseType; + AE_DSP_STREAMTYPE streamTypeUsed; + m_ActiveStreamProcess->GetMasterModeTypeInformation(streamTypeUsed, usedBaseType, modeUniqueId); + if (forceReload || m_baseTypeUsed != usedBaseType || m_streamTypeUsed != streamTypeUsed) + { + m_baseTypeUsed = usedBaseType; + m_streamTypeUsed = streamTypeUsed; + + /*! + * Update settings + */ + int selType = CMediaSettings::Get().GetCurrentAudioSettings().m_MasterStreamTypeSel; + CMediaSettings::Get().GetCurrentAudioSettings().m_MasterModes[streamTypeUsed][usedBaseType] = modeUniqueId; + CMediaSettings::Get().GetCurrentAudioSettings().m_MasterModes[selType][usedBaseType] = modeUniqueId; + CMediaSettings::Get().GetCurrentAudioSettings().m_MasterStreamBase = usedBaseType; + CMediaSettings::Get().GetCurrentAudioSettings().m_MasterStreamType = streamTypeUsed; + + m_settingsManager->SetInt(SETTING_AUDIO_MAIN_MODETYPE, modeUniqueId); + } + + // these settings can change on the fly + if (m_GetCPUUsage) + { + m_CPUUsage = StringUtils::Format("%.02f %%", m_ActiveStreamProcess->GetCPUUsage()); + m_settingsManager->SetString(SETTING_STREAM_INFO_CPU_USAGE, m_CPUUsage); + for (unsigned int i = 0; i < m_ActiveModes.size(); i++) + { + string settingId = StringUtils::Format("%s%i", SETTING_STREAM_INFO_MODE_CPU_USAGE, i); + m_ActiveModesData[i].CPUUsage = StringUtils::Format("%.02f %%", m_ActiveModes[i]->CPUUsage()); + m_settingsManager->SetString(settingId, m_ActiveModesData[i].CPUUsage); + } + } + } + + CGUIDialogSettingsManualBase::FrameMove(); +} + +std::string CGUIDialogAudioDSPSettings::FormatDelay(float value, float interval) +{ + if (fabs(value) < 0.5f * interval) + return StringUtils::Format(g_localizeStrings.Get(22003).c_str(), 0.0); + if (value < 0) + return StringUtils::Format(g_localizeStrings.Get(22004).c_str(), fabs(value)); + + return StringUtils::Format(g_localizeStrings.Get(22005).c_str(), value); +} + +std::string CGUIDialogAudioDSPSettings::FormatDecibel(float value) +{ + return StringUtils::Format(g_localizeStrings.Get(14054).c_str(), value); +} + +std::string CGUIDialogAudioDSPSettings::FormatPercentAsDecibel(float value) +{ + return StringUtils::Format(g_localizeStrings.Get(14054).c_str(), CAEUtil::PercentToGain(value)); +} + +void CGUIDialogAudioDSPSettings::OnSettingChanged(const CSetting *setting) +{ + if (setting == NULL) + return; + + CGUIDialogSettingsManualBase::OnSettingChanged(setting); + + CVideoSettings &videoSettings = CMediaSettings::Get().GetCurrentVideoSettings(); + const std::string &settingId = setting->GetId(); + if (settingId == SETTING_AUDIO_MAIN_STREAMTYPE) + { + int type = (AE_DSP_STREAMTYPE)static_cast(setting)->GetValue(); + CMediaSettings::Get().GetCurrentAudioSettings().m_MasterStreamTypeSel = type; + if (type == AE_DSP_ASTREAM_AUTO) + type = m_ActiveStreamProcess->GetDetectedStreamType(); + + CMediaSettings::Get().GetCurrentAudioSettings().m_MasterStreamType = type; + + /* Set the input stream type if any modes are available for this type */ + if (type >= AE_DSP_ASTREAM_BASIC && type < AE_DSP_ASTREAM_AUTO && !m_MasterModes[type].empty()) + { + /* Find the master mode id for the selected stream type if it was not known before */ + if (CMediaSettings::Get().GetCurrentAudioSettings().m_MasterModes[type][m_baseTypeUsed] < 0) + CMediaSettings::Get().GetCurrentAudioSettings().m_MasterModes[type][m_baseTypeUsed] = m_MasterModes[type][0]->ModeID(); + + /* Switch now the master mode and stream type for audio dsp processing */ + m_ActiveStreamProcess->SetMasterMode((AE_DSP_STREAMTYPE)type, + CMediaSettings::Get().GetCurrentAudioSettings().m_MasterModes[type][m_baseTypeUsed], + true); + } + else + { + CLog::Log(LOGERROR, "ActiveAE DSP Settings - %s - Change of audio stream type failed (type = %i)", __FUNCTION__, type); + } + } + else if (settingId == SETTING_AUDIO_MAIN_MODETYPE) + { + m_modeTypeUsed = static_cast(setting)->GetValue(); + if (m_ActiveStreamProcess->SetMasterMode(m_streamTypeUsed, m_modeTypeUsed)) + CMediaSettings::Get().GetCurrentAudioSettings().m_MasterModes[m_streamTypeUsed][m_baseTypeUsed] = m_modeTypeUsed; + } + else if (settingId == SETTING_AUDIO_MAIN_VOLUME) + { + m_volume = static_cast(static_cast(setting)->GetValue()); + g_application.SetVolume(m_volume, false); // false - value is not in percent + } + else if (settingId == SETTING_AUDIO_MAIN_VOLUME_AMPLIFICATION) + { + videoSettings.m_VolumeAmplification = static_cast(static_cast(setting)->GetValue()); + g_application.m_pPlayer->SetDynamicRangeCompression((long)(videoSettings.m_VolumeAmplification * 100)); + } + else if (settingId == SETTING_AUDIO_POST_PROC_AUDIO_DELAY) + { + videoSettings.m_AudioDelay = static_cast(static_cast(setting)->GetValue()); + g_application.m_pPlayer->SetAVDelay(videoSettings.m_AudioDelay); + } +} + +void CGUIDialogAudioDSPSettings::OnSettingAction(const CSetting *setting) +{ + if (setting == NULL) + return; + + CGUIDialogSettingsManualBase::OnSettingAction(setting); + + const std::string &settingId = setting->GetId(); + if (settingId == SETTING_AUDIO_MAIN_MAKE_DEFAULT) + Save(); +} + +void CGUIDialogAudioDSPSettings::Save() +{ + if (!g_passwordManager.CheckSettingLevelLock(SettingLevelExpert) && + CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE) + return; + + // prompt user if they are sure + if (!CGUIDialogYesNo::ShowAndGetInput(12376, 750, 0, 12377)) + return; + + // reset the settings + CActiveAEDSPDatabase db; + if (!db.Open()) + return; + + db.EraseActiveDSPSettings(); + db.Close(); + + CMediaSettings::Get().GetDefaultAudioSettings() = CMediaSettings::Get().GetCurrentAudioSettings(); + CMediaSettings::Get().GetDefaultAudioSettings().m_MasterStreamType = AE_DSP_ASTREAM_AUTO; + CSettings::Get().Save(); +} + +void CGUIDialogAudioDSPSettings::SetupView() +{ + CGUIDialogSettingsManualBase::SetupView(); + SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, g_localizeStrings.Get(15028)); +} + +void CGUIDialogAudioDSPSettings::InitializeSettings() +{ + CGUIDialogSettingsManualBase::InitializeSettings(); + + CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_MAIN, -1); + if (category == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspmainsettings'"); + return; + } + + // get all necessary setting groups + CSettingGroup *groupAudioModeSel = AddGroup(category); + if (groupAudioModeSel == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAudioModeSel'"); + return; + } + CSettingGroup *groupAudioVolumeSel = AddGroup(category); + if (groupAudioVolumeSel == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAudioVolumeSel'"); + return; + } + CSettingGroup *groupAudioSubmenuSel = AddGroup(category); + if (groupAudioSubmenuSel == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAudioSubmenuSel'"); + return; + } + CSettingGroup *groupSaveAsDefault = AddGroup(category); + if (groupSaveAsDefault == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupSaveAsDefault'"); + return; + } + + bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml"); + + CVideoSettings &videoSettings = CMediaSettings::Get().GetCurrentVideoSettings(); + + m_audioCaps.clear(); + if (g_application.m_pPlayer->HasPlayer()) + g_application.m_pPlayer->GetAudioCapabilities(m_audioCaps); + + m_ActiveStreamId = CActiveAEDSP::Get().GetActiveStreamId(); + m_ActiveStreamProcess = CActiveAEDSP::Get().GetDSPProcess(m_ActiveStreamId); + if (m_ActiveStreamId == (unsigned int)-1 || !m_ActiveStreamProcess) + { + m_iCategory = FindCategoryIndex(SETTING_AUDIO_CAT_MAIN); + Close(true); + return; + } + + int modeUniqueId; + m_ActiveStreamProcess->GetMasterModeTypeInformation(m_streamTypeUsed, m_baseTypeUsed, modeUniqueId); + + int modesAvailable = 0; + for (int i = 0; i < AE_DSP_ASTREAM_AUTO; i++) + { + m_MasterModes[i].clear(); + m_ActiveStreamProcess->GetAvailableMasterModes((AE_DSP_STREAMTYPE)i, m_MasterModes[i]); + if (!m_MasterModes[i].empty()) modesAvailable++; + } + + if (modesAvailable > 0) + { + /* about size() > 1, it is always the fallback (ignore of master processing) present. */ + StaticIntegerSettingOptions modeEntries; + if (m_MasterModes[AE_DSP_ASTREAM_BASIC].size() > 1) + modeEntries.push_back(pair(CActiveAEDSP::Get().GetStreamTypeName(AE_DSP_ASTREAM_BASIC), AE_DSP_ASTREAM_BASIC)); + if (m_MasterModes[AE_DSP_ASTREAM_MUSIC].size() > 1) + modeEntries.push_back(pair(CActiveAEDSP::Get().GetStreamTypeName(AE_DSP_ASTREAM_MUSIC), AE_DSP_ASTREAM_MUSIC)); + if (m_MasterModes[AE_DSP_ASTREAM_MOVIE].size() > 1) + modeEntries.push_back(pair(CActiveAEDSP::Get().GetStreamTypeName(AE_DSP_ASTREAM_MOVIE), AE_DSP_ASTREAM_MOVIE)); + if (m_MasterModes[AE_DSP_ASTREAM_GAME].size() > 1) + modeEntries.push_back(pair(CActiveAEDSP::Get().GetStreamTypeName(AE_DSP_ASTREAM_GAME), AE_DSP_ASTREAM_GAME)); + if (m_MasterModes[AE_DSP_ASTREAM_APP].size() > 1) + modeEntries.push_back(pair(CActiveAEDSP::Get().GetStreamTypeName(AE_DSP_ASTREAM_APP), AE_DSP_ASTREAM_APP)); + if (m_MasterModes[AE_DSP_ASTREAM_MESSAGE].size() > 1) + modeEntries.push_back(pair(CActiveAEDSP::Get().GetStreamTypeName(AE_DSP_ASTREAM_MESSAGE), AE_DSP_ASTREAM_MESSAGE)); + if (m_MasterModes[AE_DSP_ASTREAM_PHONE].size() > 1) + modeEntries.push_back(pair(CActiveAEDSP::Get().GetStreamTypeName(AE_DSP_ASTREAM_PHONE), AE_DSP_ASTREAM_PHONE)); + if (modesAvailable > 1 && m_MasterModes[m_streamTypeUsed].size() > 1) + modeEntries.insert(modeEntries.begin(), pair(CActiveAEDSP::Get().GetStreamTypeName(AE_DSP_ASTREAM_AUTO), AE_DSP_ASTREAM_AUTO)); + + AddSpinner(groupAudioModeSel, + SETTING_AUDIO_MAIN_STREAMTYPE, 15021, 0, + (AE_DSP_STREAMTYPE)CMediaSettings::Get().GetCurrentAudioSettings().m_MasterStreamTypeSel, + modeEntries); + } + + bool AddonMasterModeSetupPresent = false; + m_ModeList.clear(); + for (unsigned int i = 0; i < m_MasterModes[m_streamTypeUsed].size(); i++) + { + if (m_MasterModes[m_streamTypeUsed][i]) + { + AE_DSP_ADDON addon; + int modeId = m_MasterModes[m_streamTypeUsed][i]->ModeID(); + if (modeId == AE_DSP_MASTER_MODE_ID_PASSOVER || modeId >= AE_DSP_MASTER_MODE_ID_INTERNAL_TYPES) + { + m_ModeList.push_back(make_pair(g_localizeStrings.Get(m_MasterModes[m_streamTypeUsed][i]->ModeName()), modeId)); + } + else if (CActiveAEDSP::Get().GetAudioDSPAddon(m_MasterModes[m_streamTypeUsed][i]->AddonID(), addon)) + { + m_ModeList.push_back(make_pair(addon->GetString(m_MasterModes[m_streamTypeUsed][i]->ModeName()), modeId)); + if (!AddonMasterModeSetupPresent) + AddonMasterModeSetupPresent = m_MasterModes[m_streamTypeUsed][i]->HasSettingsDialog(); + } + } + } + + m_modeTypeUsed = CMediaSettings::Get().GetCurrentAudioSettings().m_MasterModes[m_streamTypeUsed][m_baseTypeUsed]; + CSettingInt *spinner = AddSpinner(groupAudioModeSel, SETTING_AUDIO_MAIN_MODETYPE, 15022, 0, m_modeTypeUsed, AudioModeOptionFiller); + spinner->SetOptionsFiller(AudioModeOptionFiller, this); + + ///----------------------- + + // audio settings + // audio volume setting + m_volume = g_application.GetVolume(false); + if (!g_windowManager.IsWindowActive(WINDOW_DIALOG_AUDIO_OSD_SETTINGS)) + { + CSettingNumber *settingAudioVolume = AddSlider(groupAudioVolumeSel, SETTING_AUDIO_MAIN_VOLUME, 13376, 0, m_volume, 14054, VOLUME_MINIMUM, VOLUME_MAXIMUM / 100.0f, VOLUME_MAXIMUM); + static_cast(settingAudioVolume->GetControl())->SetFormatter(SettingFormatterPercentAsDecibel); + } + + // audio volume amplification setting + if (SupportsAudioFeature(IPC_AUD_AMP)) + AddSlider(groupAudioVolumeSel, SETTING_AUDIO_MAIN_VOLUME_AMPLIFICATION, 660, 0, videoSettings.m_VolumeAmplification, 14054, VOLUME_DRC_MINIMUM * 0.01f, (VOLUME_DRC_MAXIMUM - VOLUME_DRC_MINIMUM) / 6000.0f, VOLUME_DRC_MAXIMUM * 0.01f); + + ///----------------------- + + AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_MASTER, 15025, 0, false, AddonMasterModeSetupPresent, -1); + AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_OUTPUT, 15026, 0, false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_POST_PROCESS) || SupportsAudioFeature(IPC_AUD_OFFSET), -1); + AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_RESAMPLE, 15033, 0, false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_RESAMPLE), -1); + AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_PRE_PROC, 15039, 0, false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_PRE_PROCESS), -1); + AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_MISC, 15034, 0, false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_MISCELLANEOUS), -1); + AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_INFO, 15027, 0, false, true, -1); + + ///----------------------- + + AddButton(groupSaveAsDefault, SETTING_AUDIO_MAIN_MAKE_DEFAULT, 12376, 0); + + m_Menus.clear(); + + /** + * Audio Master mode settings Dialog init + */ + { + CSettingCategory *categoryMaster = AddCategory(SETTING_AUDIO_CAT_MASTER, -1); + if (categoryMaster == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspmastersettings'"); + return; + } + + CSettingGroup *groupMasterMode = AddGroup(categoryMaster); + if (groupMasterMode == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupMasterMode'"); + return; + } + + for (unsigned int i = 0; i < m_MasterModes[m_streamTypeUsed].size(); i++) + { + if (m_MasterModes[m_streamTypeUsed][i]->HasSettingsDialog()) + { + AE_DSP_ADDON addon; + if (CActiveAEDSP::Get().GetAudioDSPAddon(m_MasterModes[m_streamTypeUsed][i]->AddonID(), addon)) + { + AE_DSP_MENUHOOKS hooks; + if (CActiveAEDSP::Get().GetMenuHooks(m_MasterModes[m_streamTypeUsed][i]->AddonID(), AE_DSP_MENUHOOK_MASTER_PROCESS, hooks)) + { + for (unsigned int j = 0; j < hooks.size(); j++) + { + if (hooks[j].iRelevantModeId != m_MasterModes[m_streamTypeUsed][i]->AddonModeNumber()) + continue; + + MenuHookMember menu; + menu.addonId = m_MasterModes[m_streamTypeUsed][i]->AddonID(); + menu.hook.category = hooks[j].category; + menu.hook.iHookId = hooks[j].iHookId; + menu.hook.iLocalizedStringId = hooks[j].iLocalizedStringId; + menu.hook.iRelevantModeId = hooks[j].iRelevantModeId; + m_Menus.push_back(menu); + + string setting = StringUtils::Format("%s%i", SETTING_AUDIO_MASTER_SETTINGS_MENUS, (int)m_Menus.size()-1); + AddButton(groupMasterMode, setting, 15041, 0); + break; + } + } + } + } + } + } + + /** + * Audio post processing settings Dialog init + */ + { + CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_POST_PROCESS, -1); + if (category == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodsppostsettings'"); + return; + } + + CSettingGroup *groupInternal = AddGroup(category); + if (groupInternal == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupInternal'"); + return; + } + + CSettingGroup *groupAddon = AddGroup(category); + if (groupAddon == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAddon'"); + return; + } + + // audio delay setting + if (SupportsAudioFeature(IPC_AUD_OFFSET)) + { + CSettingNumber *settingAudioDelay = AddSlider(groupInternal, SETTING_AUDIO_POST_PROC_AUDIO_DELAY, 297, 0, videoSettings.m_AudioDelay, 0, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange, -1, usePopup); + static_cast(settingAudioDelay->GetControl())->SetFormatter(SettingFormatterDelay); + } + GetAudioDSPMenus(groupAddon, AE_DSP_MENUHOOK_POST_PROCESS); + } + + /** + * Audio add-on resampling setting dialog's + */ + { + CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_RESAMPLING, -1); + if (category == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspresamplesettings'"); + return; + } + CSettingGroup *group = AddGroup(category); + if (group == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'group'"); + return; + } + GetAudioDSPMenus(group, AE_DSP_MENUHOOK_RESAMPLE); + } + + /** + * Audio add-on's pre processing setting dialog's + */ + { + CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_PRE_PROCESS, -1); + if (category == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodsppresettings'"); + return; + } + CSettingGroup *group = AddGroup(category); + if (group == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'group'"); + return; + } + GetAudioDSPMenus(group, AE_DSP_MENUHOOK_PRE_PROCESS); + } + + /** + * Audio add-on's miscellaneous setting dialog's + */ + { + CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_MISC, -1); + if (category == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspmiscsettings'"); + return; + } + CSettingGroup *group = AddGroup(category); + if (group == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'group'"); + return; + } + GetAudioDSPMenus(group, AE_DSP_MENUHOOK_MISCELLANEOUS); + } + + /** + * Audio Information Dialog init + */ + { + CSettingGroup *group; + CSettingCategory *category = AddCategory(SETTING_AUDIO_CAT_PROC_INFO, -1); + if (category == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspprocinfo'"); + return; + } + + m_ActiveModes.clear(); + m_ActiveStreamProcess->GetActiveModes(AE_DSP_MODE_TYPE_UNDEFINED, m_ActiveModes); + m_ActiveModesData.resize(m_ActiveModes.size()); + + group = AddGroup(category, 15089); + if (group == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group for '%s'", g_localizeStrings.Get(15089).c_str()); + return; + } + m_InputChannels = StringUtils::Format("%i", m_ActiveStreamProcess->GetInputChannels()); + AddInfoLabelButton(group, SETTING_STREAM_INFO_INPUT_CHANNELS, 21444, 0, m_InputChannels); + m_InputChannelNames = m_ActiveStreamProcess->GetInputChannelNames(); + AddInfoLabelButton(group, SETTING_STREAM_INFO_INPUT_CHANNEL_NAMES, 15091, 0, m_InputChannelNames); + m_InputSamplerate = StringUtils::Format("%i Hz", (int)m_ActiveStreamProcess->GetInputSamplerate()); + AddInfoLabelButton(group, SETTING_STREAM_INFO_INPUT_SAMPLERATE, 613, 0, m_InputSamplerate); + + group = AddGroup(category, 15090); + if (group == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group for '%s'", g_localizeStrings.Get(15090).c_str()); + return; + } + m_OutputChannels = StringUtils::Format("%i", m_ActiveStreamProcess->GetOutputChannels()); + AddInfoLabelButton(group, SETTING_STREAM_INFO_OUTPUT_CHANNELS, 21444, 0, m_OutputChannels); + m_OutputChannelNames = m_ActiveStreamProcess->GetOutputChannelNames(); + AddInfoLabelButton(group, SETTING_STREAM_INFO_OUTPUT_CHANNEL_NAMES, 15091, 0, m_OutputChannelNames); + m_OutputSamplerate = StringUtils::Format("%i Hz", (int)m_ActiveStreamProcess->GetOutputSamplerate()); + AddInfoLabelButton(group, SETTING_STREAM_INFO_OUTPUT_SAMPLERATE, 613, 0, m_OutputSamplerate); + + group = AddGroup(category, 15081); + if (group == NULL) + { + CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group for '%s'", g_localizeStrings.Get(15081).c_str()); + return; + } + m_CPUUsage = StringUtils::Format("%.02f %%", m_ActiveStreamProcess->GetCPUUsage()); + AddInfoLabelButton(group, SETTING_STREAM_INFO_CPU_USAGE, 15092, 0, m_CPUUsage); + + bool foundPreProcess = false, foundPostProcess = false; + for (unsigned int i = 0; i < m_ActiveModes.size(); i++) + { + AE_DSP_ADDON addon; + if (CActiveAEDSP::Get().GetAudioDSPAddon(m_ActiveModes[i]->AddonID(), addon)) + { + std::string label; + switch (m_ActiveModes[i]->ModeType()) + { + case AE_DSP_MODE_TYPE_INPUT_RESAMPLE: + group = AddGroup(category, 15087, -1, true, true); + label = StringUtils::Format(g_localizeStrings.Get(15082).c_str(), m_ActiveStreamProcess->GetProcessSamplerate()); + break; + case AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE: + group = AddGroup(category, 15088, -1, true, true); + label = StringUtils::Format(g_localizeStrings.Get(15083).c_str(), m_ActiveStreamProcess->GetOutputSamplerate()); + break; + case AE_DSP_MODE_TYPE_MASTER_PROCESS: + group = AddGroup(category, 15084, -1, true, true); + label = addon->GetString(m_ActiveModes[i]->ModeName()); + break; + case AE_DSP_MODE_TYPE_PRE_PROCESS: + if (!foundPreProcess) + { + foundPreProcess = true; + group = AddGroup(category, 15085, -1, true, true); + } + label = addon->GetString(m_ActiveModes[i]->ModeName()); + break; + case AE_DSP_MODE_TYPE_POST_PROCESS: + if (!foundPostProcess) + { + foundPostProcess = true; + group = AddGroup(category, 15086, -1, true, true); + } + label = addon->GetString(m_ActiveModes[i]->ModeName()); + break; + default: + { + label += addon->GetString(m_ActiveModes[i]->ModeName()); + label += " - "; + label += addon->GetFriendlyName(); + } + }; + m_ActiveModesData[i].CPUUsage = StringUtils::Format("%.02f %%", m_ActiveModes[i]->CPUUsage()); + + MenuHookMember menu; + menu.addonId = -1; + + AE_DSP_MENUHOOKS hooks; + m_ActiveModesData[i].MenuListPtr = -1; + if (CActiveAEDSP::Get().GetMenuHooks(m_ActiveModes[i]->AddonID(), AE_DSP_MENUHOOK_INFORMATION, hooks)) + { + for (unsigned int j = 0; j < hooks.size(); j++) + { + if (hooks[j].iRelevantModeId != m_ActiveModes[i]->AddonModeNumber()) + continue; + + menu.addonId = m_ActiveModes[i]->AddonID(); + menu.hook.category = hooks[j].category; + menu.hook.iHookId = hooks[j].iHookId; + menu.hook.iLocalizedStringId = hooks[j].iLocalizedStringId; + menu.hook.iRelevantModeId = hooks[j].iRelevantModeId; + m_Menus.push_back(menu); + m_ActiveModesData[i].MenuListPtr = m_Menus.size()-1; + label += " ..."; + break; + } + } + m_ActiveModesData[i].MenuName = label; + + string settingId = StringUtils::Format("%s%i", SETTING_STREAM_INFO_MODE_CPU_USAGE, i); + AddInfoLabelButton(group, settingId, 15041, 0, m_ActiveModesData[i].CPUUsage); + } + } + } +} + +bool CGUIDialogAudioDSPSettings::SupportsAudioFeature(int feature) +{ + for (Features::iterator itr = m_audioCaps.begin(); itr != m_audioCaps.end(); ++itr) + { + if (*itr == feature || *itr == IPC_AUD_ALL) + return true; + } + + return false; +} + +void CGUIDialogAudioDSPSettings::AudioModeOptionFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t, void *data) +{ + CGUIDialogAudioDSPSettings *dialog = (CGUIDialogAudioDSPSettings *)data; + list = dialog->m_ModeList; + + if (list.empty()) + { + list.push_back(make_pair(g_localizeStrings.Get(231), -1)); + current = -1; + } +} + +std::string CGUIDialogAudioDSPSettings::SettingFormatterDelay(const CSettingControlSlider *control, const CVariant &value, const CVariant &minimum, const CVariant &step, const CVariant &maximum) +{ + if (!value.isDouble()) + return ""; + + float fValue = value.asFloat(); + float fStep = step.asFloat(); + + if (fabs(fValue) < 0.5f * fStep) + return StringUtils::Format(g_localizeStrings.Get(22003).c_str(), 0.0); + if (fValue < 0) + return StringUtils::Format(g_localizeStrings.Get(22004).c_str(), fabs(fValue)); + + return StringUtils::Format(g_localizeStrings.Get(22005).c_str(), fValue); +} + +std::string CGUIDialogAudioDSPSettings::SettingFormatterPercentAsDecibel(const CSettingControlSlider *control, const CVariant &value, const CVariant &minimum, const CVariant &step, const CVariant &maximum) +{ + if (control == NULL || !value.isDouble()) + return ""; + + std::string formatString = control->GetFormatString(); + if (control->GetFormatLabel() > -1) + formatString = g_localizeStrings.Get(control->GetFormatLabel()); + + return StringUtils::Format(formatString.c_str(), CAEUtil::PercentToGain(value.asFloat())); +} + +bool CGUIDialogAudioDSPSettings::HaveActiveMenuHooks(AE_DSP_MENUHOOK_CAT category) +{ + /*!> Check menus are active on current stream */ + AE_DSP_ADDONMAP addonMap; + if (CActiveAEDSP::Get().HaveMenuHooks(category) && + CActiveAEDSP::Get().GetEnabledAudioDSPAddons(addonMap) > 0) + { + for (AE_DSP_ADDONMAP_ITR itr = addonMap.begin(); itr != addonMap.end(); itr++) + { + AE_DSP_MENUHOOKS hooks; + if (CActiveAEDSP::Get().GetMenuHooks(itr->second->GetID(), category, hooks)) + { + for (unsigned int i = 0; i < hooks.size(); i++) + { + if (category != AE_DSP_MENUHOOK_MISCELLANEOUS && + !m_ActiveStreamProcess->IsMenuHookModeActive(hooks[i].category, itr->second->GetID(), hooks[i].iRelevantModeId)) + continue; + + return true; + } + } + } + } + + return false; +} + +string CGUIDialogAudioDSPSettings::GetSettingsLabel(CSetting *pSetting) +{ + if (pSetting->GetLabel() == 15041) + { + const std::string &settingId = pSetting->GetId(); + + int ptr = -1; + AE_DSP_ADDON addon; + if (settingId.substr(0, 27) == SETTING_STREAM_INFO_MODE_CPU_USAGE) + { + ptr = strtol(settingId.substr(27).c_str(), NULL, 0); + if (ptr >= 0 && CActiveAEDSP::Get().GetAudioDSPAddon(m_ActiveModes[ptr]->AddonID(), addon)) + return m_ActiveModesData[ptr].MenuName; + } + else + { + if (settingId.substr(0, 21) == SETTING_AUDIO_MASTER_SETTINGS_MENUS) + ptr = strtol(settingId.substr(21).c_str(), NULL, 0); + else if (settingId.substr(0, 19) == SETTING_AUDIO_PROC_SETTINGS_MENUS) + ptr = strtol(settingId.substr(19).c_str(), NULL, 0); + + if (ptr >= 0 && CActiveAEDSP::Get().GetAudioDSPAddon(m_Menus[ptr].addonId, addon)) + return addon->GetString(m_Menus[ptr].hook.iLocalizedStringId); + } + } + + return GetLocalizedString(pSetting->GetLabel()); +} + +void CGUIDialogAudioDSPSettings::GetAudioDSPMenus(CSettingGroup *group, AE_DSP_MENUHOOK_CAT category) +{ + AE_DSP_ADDONMAP addonMap; + if (CActiveAEDSP::Get().GetEnabledAudioDSPAddons(addonMap) > 0) + { + for (AE_DSP_ADDONMAP_ITR itr = addonMap.begin(); itr != addonMap.end(); itr++) + { + AE_DSP_MENUHOOKS hooks; + if (CActiveAEDSP::Get().GetMenuHooks(itr->second->GetID(), category, hooks)) + { + for (unsigned int i = 0; i < hooks.size(); i++) + { + if (category != hooks[i].category || (category != AE_DSP_MENUHOOK_MISCELLANEOUS && + !m_ActiveStreamProcess->IsMenuHookModeActive(hooks[i].category, itr->second->GetID(), hooks[i].iRelevantModeId))) + continue; + + MenuHookMember menu; + menu.addonId = itr->second->GetID(); + menu.hook.category = hooks[i].category; + menu.hook.iHookId = hooks[i].iHookId; + menu.hook.iLocalizedStringId = hooks[i].iLocalizedStringId; + menu.hook.iRelevantModeId = hooks[i].iRelevantModeId; + m_Menus.push_back(menu); + } + } + } + } + + for (unsigned int i = 0; i < m_Menus.size(); i++) + { + AE_DSP_ADDON addon; + if (CActiveAEDSP::Get().GetAudioDSPAddon(m_Menus[i].addonId, addon) && category == m_Menus[i].hook.category) + { + std::string modeName = addon->GetString(m_Menus[i].hook.iLocalizedStringId); + if (modeName.empty()) + modeName = g_localizeStrings.Get(15041); + + string setting = StringUtils::Format("%s%i", SETTING_AUDIO_PROC_SETTINGS_MENUS, i); + AddButton(group, setting, 15041, 0); + } + } +} + +bool CGUIDialogAudioDSPSettings::OpenAudioDSPMenu(unsigned int setupEntry) +{ + if (setupEntry >= m_Menus.size()) + return false; + + AE_DSP_ADDON addon; + if (!CActiveAEDSP::Get().GetAudioDSPAddon(m_Menus[setupEntry].addonId, addon)) + return false; + + AE_DSP_MENUHOOK hook; + AE_DSP_MENUHOOK_DATA hookData; + + hook.category = m_Menus[setupEntry].hook.category; + hook.iHookId = m_Menus[setupEntry].hook.iHookId; + hook.iLocalizedStringId = m_Menus[setupEntry].hook.iLocalizedStringId; + hook.iRelevantModeId = m_Menus[setupEntry].hook.iRelevantModeId; + hookData.category = m_Menus[setupEntry].hook.category; + switch (hookData.category) + { + case AE_DSP_MENUHOOK_PRE_PROCESS: + case AE_DSP_MENUHOOK_MASTER_PROCESS: + case AE_DSP_MENUHOOK_RESAMPLE: + case AE_DSP_MENUHOOK_POST_PROCESS: + hookData.data.iStreamId = m_ActiveStreamId; + break; + default: + break; + } + + /*! + * @note the addon dialog becomes always opened on the back of Kodi ones for this reason a + * "Conditional" + * on skin is needed to hide dialog. + */ + addon->CallMenuHook(hook, hookData); + + return true; +} diff --git a/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.h b/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.h new file mode 100644 index 0000000000..a488f302ec --- /dev/null +++ b/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.h @@ -0,0 +1,112 @@ +#pragma once +/* + * Copyright (C) 2005-2015 Team KODI + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KODI; see the file COPYING. If not, see + * . + * + */ + +#include "cores/AudioEngine/DSPAddons/ActiveAEDSPProcess.h" +#include "settings/dialogs/GUIDialogSettingsManualBase.h" + +namespace ActiveAE +{ + class CGUIDialogAudioDSPSettings : public CGUIDialogSettingsManualBase + { + public: + CGUIDialogAudioDSPSettings(); + virtual ~CGUIDialogAudioDSPSettings(); + + // specializations of CGUIControl + virtual bool OnMessage(CGUIMessage &message); + virtual bool OnBack(int actionID); + + // specialization of CGUIWindow + virtual void FrameMove(); + + static std::string FormatDelay(float value, float interval); + static std::string FormatDecibel(float value); + static std::string FormatPercentAsDecibel(float value); + + protected: + // implementations of ISettingCallback + virtual void OnSettingChanged(const CSetting *setting); + virtual void OnSettingAction(const CSetting *setting); + + // specialization of CGUIDialogSettingsBase + virtual bool AllowResettingSettings() const { return false; } + virtual void Save(); + virtual void SetupView(); + + // specialization of CGUIDialogSettingsManualBase + virtual void InitializeSettings(); + + bool SupportsAudioFeature(int feature); + + static void AudioModeOptionFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t, void *data); + + static std::string SettingFormatterDelay(const CSettingControlSlider *control, const CVariant &value, const CVariant &minimum, const CVariant &step, const CVariant &maximum); + static std::string SettingFormatterPercentAsDecibel(const CSettingControlSlider *control, const CVariant &value, const CVariant &minimum, const CVariant &step, const CVariant &maximum); + + std::string GetSettingsLabel(CSetting *pSetting); + + private: + typedef struct + { + int addonId; + AE_DSP_MENUHOOK hook; + } MenuHookMember; + typedef struct + { + std::string MenuName; + int MenuListPtr; + std::string CPUUsage; + } ActiveModeData; + typedef std::vector Features; + + void OpenMenu(const std::string &id); + bool HaveActiveMenuHooks(AE_DSP_MENUHOOK_CAT category); + void GetAudioDSPMenus(CSettingGroup *group, AE_DSP_MENUHOOK_CAT category); + bool OpenAudioDSPMenu(unsigned int setupEntry); + int FindCategoryIndex(const std::string &catId); + + AE_DSP_STREAM_ID m_ActiveStreamId; /*!< The on dialog selectable stream identifier */ + ActiveAE::CActiveAEDSPProcessPtr m_ActiveStreamProcess; /*!< On dialog adjustable dsp processing class */ + AE_DSP_STREAMTYPE m_streamTypeUsed; /*!< The currently available stream type */ + AE_DSP_BASETYPE m_baseTypeUsed; /*!< The currently detected and used base type */ + int m_modeTypeUsed; /*!< The currently selected mode type */ + std::vector m_ActiveModes; /*!< The process modes currently active on dsp processing stream */ + std::vector m_ActiveModesData; /*!< The process modes currently active on dsp processing stream info*/ + std::vector m_MasterModes[AE_DSP_ASTREAM_MAX]; /*!< table about selectable and usable master processing modes */ + std::map m_MenuPositions; /*!< The differnet menu selection positions */ + std::vector m_MenuHierarchy; /*!< Menu selection flow hierachy */ + std::vector m_Menus; /*!< storage about present addon menus on currently selected submenu */ + std::vector< std::pair > m_ModeList; /*!< currently present modes */ + bool m_GetCPUUsage; /*!< if true cpu usage detection is active */ + Features m_audioCaps; /*!< the on current playback on KODI supported audio features */ + int m_MenuName; /*!< current menu name, needed to get after the dialog was closed for addon */ + + /*! Settings control selection and information data */ + std::string m_InputChannels; + std::string m_InputChannelNames; + std::string m_InputSamplerate; + std::string m_OutputChannels; + std::string m_OutputChannelNames; + std::string m_OutputSamplerate; + std::string m_CPUUsage; + float m_volume; + }; +} diff --git a/xbmc/settings/dialogs/Makefile b/xbmc/settings/dialogs/Makefile index 0e4c899e35..101682c678 100644 --- a/xbmc/settings/dialogs/Makefile +++ b/xbmc/settings/dialogs/Makefile @@ -1,4 +1,5 @@ SRCS=GUIDialogAudioDSPManager.cpp \ + GUIDialogAudioDSPSettings.cpp \ GUIDialogContentSettings.cpp \ GUIDialogSettingsBase.cpp \ GUIDialogSettingsManagerBase.cpp \ diff --git a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp index a4e4744a58..56c367652b 100644 --- a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp +++ b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp @@ -30,6 +30,7 @@ #include "dialogs/GUIDialogYesNo.h" #include "filesystem/File.h" #include "guilib/LocalizeStrings.h" +#include "guilib/GUIWindowManager.h" #include "profiles/ProfilesManager.h" #include "settings/AdvancedSettings.h" #include "settings/MediaSettings.h" @@ -52,6 +53,7 @@ #define SETTING_AUDIO_STREAM "audio.stream" #define SETTING_AUDIO_OUTPUT_TO_ALL_SPEAKERS "audio.outputtoallspeakers" #define SETTING_AUDIO_PASSTHROUGH "audio.digitalanalog" +#define SETTING_AUDIO_DSP "audio.dsp" #define SETTING_SUBTITLE_ENABLE "subtitles.enable" #define SETTING_SUBTITLE_DELAY "subtitles.delay" @@ -62,7 +64,8 @@ CGUIDialogAudioSubtitleSettings::CGUIDialogAudioSubtitleSettings() : CGUIDialogSettingsManualBase(WINDOW_DIALOG_AUDIO_OSD_SETTINGS, "VideoOSDSettings.xml"), - m_passthrough(false) + m_passthrough(false), + m_dspEnabled(false) { } CGUIDialogAudioSubtitleSettings::~CGUIDialogAudioSubtitleSettings() @@ -80,9 +83,12 @@ void CGUIDialogAudioSubtitleSettings::FrameMove() const CVideoSettings &videoSettings = CMediaSettings::Get().GetCurrentVideoSettings(); // these settings can change on the fly - m_settingsManager->SetNumber(SETTING_AUDIO_DELAY, videoSettings.m_AudioDelay); // TODO (needs special handling): m_settingsManager->SetInt(SETTING_AUDIO_STREAM, g_application.m_pPlayer->GetAudioStream()); - m_settingsManager->SetBool(SETTING_AUDIO_OUTPUT_TO_ALL_SPEAKERS, videoSettings.m_OutputToAllSpeakers); + if (!m_dspEnabled) //< The follow settings are on enabled DSP system separated to them and need no update here. + { + m_settingsManager->SetNumber(SETTING_AUDIO_DELAY, videoSettings.m_AudioDelay); + m_settingsManager->SetBool(SETTING_AUDIO_OUTPUT_TO_ALL_SPEAKERS, videoSettings.m_OutputToAllSpeakers); + } m_settingsManager->SetBool(SETTING_AUDIO_PASSTHROUGH, CSettings::Get().GetBool("audiooutput.passthrough")); // TODO: m_settingsManager->SetBool(SETTING_SUBTITLE_ENABLE, g_application.m_pPlayer->GetSubtitleVisible()); @@ -183,7 +189,11 @@ void CGUIDialogAudioSubtitleSettings::OnSettingAction(const CSetting *setting) CGUIDialogSettingsManualBase::OnSettingAction(setting); const std::string &settingId = setting->GetId(); - if (settingId == SETTING_SUBTITLE_BROWSER) + if (settingId == SETTING_AUDIO_DSP) + { + g_windowManager.ActivateWindow(WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS); + } + else if (settingId == SETTING_SUBTITLE_BROWSER) { std::string strPath; if (URIUtils::IsInRAR(g_application.CurrentFileItem().GetPath()) || URIUtils::IsInZIP(g_application.CurrentFileItem().GetPath())) @@ -303,7 +313,9 @@ void CGUIDialogAudioSubtitleSettings::InitializeSettings() ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition("IsPlayingPassthrough", "", "", true, m_settingsManager))); SettingDependencies depsAudioOutputPassthroughDisabled; depsAudioOutputPassthroughDisabled.push_back(dependencyAudioOutputPassthroughDisabled); - + + m_dspEnabled = CSettings::Get().GetBool("audiooutput.dspaddonsenabled"); + // audio settings // audio volume setting m_volume = g_application.GetVolume(false); @@ -311,15 +323,18 @@ void CGUIDialogAudioSubtitleSettings::InitializeSettings() settingAudioVolume->SetDependencies(depsAudioOutputPassthroughDisabled); static_cast(settingAudioVolume->GetControl())->SetFormatter(SettingFormatterPercentAsDecibel); + if (m_dspEnabled) + AddButton(groupAudio, SETTING_AUDIO_DSP, 24136, 0); + // audio volume amplification setting - if (SupportsAudioFeature(IPC_AUD_AMP)) + if (SupportsAudioFeature(IPC_AUD_AMP) && !m_dspEnabled) { CSettingNumber *settingAudioVolumeAmplification = AddSlider(groupAudio, SETTING_AUDIO_VOLUME_AMPLIFICATION, 660, 0, videoSettings.m_VolumeAmplification, 14054, VOLUME_DRC_MINIMUM * 0.01f, (VOLUME_DRC_MAXIMUM - VOLUME_DRC_MINIMUM) / 6000.0f, VOLUME_DRC_MAXIMUM * 0.01f); settingAudioVolumeAmplification->SetDependencies(depsAudioOutputPassthroughDisabled); } // audio delay setting - if (SupportsAudioFeature(IPC_AUD_OFFSET)) + if (SupportsAudioFeature(IPC_AUD_OFFSET) && !m_dspEnabled) { CSettingNumber *settingAudioDelay = AddSlider(groupAudio, SETTING_AUDIO_DELAY, 297, 0, videoSettings.m_AudioDelay, 0, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange, 297, usePopup); static_cast(settingAudioDelay->GetControl())->SetFormatter(SettingFormatterDelay); @@ -331,7 +346,7 @@ void CGUIDialogAudioSubtitleSettings::InitializeSettings() // audio output to all speakers setting // TODO: remove this setting - if (SupportsAudioFeature(IPC_AUD_OUTPUT_STEREO)) + if (SupportsAudioFeature(IPC_AUD_OUTPUT_STEREO) && !m_dspEnabled) AddToggle(groupAudio, SETTING_AUDIO_OUTPUT_TO_ALL_SPEAKERS, 252, 0, videoSettings.m_OutputToAllSpeakers); // audio digital/analog setting diff --git a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.h b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.h index 4de76b361b..2fd3a20bc4 100644 --- a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.h +++ b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.h @@ -69,6 +69,7 @@ protected: bool m_passthrough; int m_subtitleStream; bool m_subtitleVisible; + bool m_dspEnabled; typedef std::vector Features; Features m_audioCaps; diff --git a/xbmc/video/dialogs/GUIDialogVideoOSD.cpp b/xbmc/video/dialogs/GUIDialogVideoOSD.cpp index 73169364b3..097a2deb48 100644 --- a/xbmc/video/dialogs/GUIDialogVideoOSD.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoOSD.cpp @@ -44,6 +44,7 @@ void CGUIDialogVideoOSD::FrameMove() // check for movement of mouse or a submenu open if (CInputManager::Get().IsMouseActive() || g_windowManager.IsWindowActive(WINDOW_DIALOG_AUDIO_OSD_SETTINGS) + || g_windowManager.IsWindowActive(WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS) || g_windowManager.IsWindowActive(WINDOW_DIALOG_VIDEO_OSD_SETTINGS) || g_windowManager.IsWindowActive(WINDOW_DIALOG_VIDEO_BOOKMARKS) || g_windowManager.IsWindowActive(WINDOW_DIALOG_PVR_OSD_CHANNELS) @@ -90,6 +91,17 @@ bool CGUIDialogVideoOSD::OnMessage(CGUIMessage& message) Close(); } break; + case GUI_MSG_WINDOW_DEINIT: // fired when OSD is hidden + { + // Remove our subdialogs if visible + CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS); + if (pDialog && pDialog->IsDialogRunning()) + pDialog->Close(true); + pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_AUDIO_OSD_SETTINGS); + if (pDialog && pDialog->IsDialogRunning()) + pDialog->Close(true); + } + break; } return CGUIDialog::OnMessage(message); } -- cgit v1.2.3