From a8e2e9ec5405d4df2a5c10221c5179765a8bb9e0 Mon Sep 17 00:00:00 2001 From: "sl1nk3.s" Date: Sat, 29 Jan 2011 04:16:05 +0000 Subject: [PATCH] Fix the Audio tab and merge the DSP config into one. Unify the DSP settings into DSP.ini git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6955 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../AudioCommon/Src/AudioCommonConfig.cpp | 16 +- .../Core/AudioCommon/Src/AudioCommonConfig.h | 6 +- Source/Core/Common/Src/CommonPaths.h | 1 + Source/Core/Common/Src/FileUtil.cpp | 4 + Source/Core/Common/Src/FileUtil.h | 1 + Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp | 19 -- Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h | 4 - Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp | 18 -- Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h | 4 - Source/Core/Core/Src/PluginDSP.cpp | 4 +- Source/Core/DolphinWX/CMakeLists.txt | 2 - Source/Core/DolphinWX/DolphinWX.vcproj | 16 -- Source/Core/DolphinWX/Src/ConfigMain.cpp | 220 +++++++++++++----- Source/Core/DolphinWX/Src/ConfigMain.h | 203 ++++++++-------- Source/Core/DolphinWX/Src/DSPHLEConfigDlg.cpp | 186 --------------- Source/Core/DolphinWX/Src/DSPHLEConfigDlg.h | 69 ------ Source/Core/DolphinWX/Src/DSPLLEConfigDlg.cpp | 159 ------------- Source/Core/DolphinWX/Src/DSPLLEConfigDlg.h | 69 ------ Source/Core/DolphinWX/Src/FrameTools.cpp | 13 +- Source/Dolphin.sln | 4 +- 20 files changed, 299 insertions(+), 719 deletions(-) delete mode 100644 Source/Core/DolphinWX/Src/DSPHLEConfigDlg.cpp delete mode 100644 Source/Core/DolphinWX/Src/DSPHLEConfigDlg.h delete mode 100644 Source/Core/DolphinWX/Src/DSPLLEConfigDlg.cpp delete mode 100644 Source/Core/DolphinWX/Src/DSPLLEConfigDlg.h diff --git a/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp b/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp index c3e35d05ed..3eb2fbaa6c 100644 --- a/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp +++ b/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp @@ -16,6 +16,8 @@ // http://code.google.com/p/dolphin-emu/ #include "AudioCommon.h" +#include "CommonPaths.h" +#include "FileUtil.h" AudioCommonConfig ac_Config; @@ -23,7 +25,11 @@ AudioCommonConfig ac_Config; SoundStream *soundStream; // Load from given file -void AudioCommonConfig::Load(IniFile &file) { +void AudioCommonConfig::Load() +{ + IniFile file; + file.Load(std::string(File::GetUserPath(F_DSPCONFIG_IDX)).c_str()); + file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true); file.Get("Config", "EnableThrottle", &m_EnableThrottle, true); file.Get("Config", "EnableJIT", &m_EnableJIT, true); @@ -41,13 +47,19 @@ void AudioCommonConfig::Load(IniFile &file) { } // Set the values for the file -void AudioCommonConfig::Set(IniFile &file) { +void AudioCommonConfig::SaveSettings() +{ + IniFile file; + file.Load(std::string(File::GetUserPath(F_DSPCONFIG_IDX)).c_str()); + file.Set("Config", "EnableDTKMusic", m_EnableDTKMusic); file.Set("Config", "EnableThrottle", m_EnableThrottle); file.Set("Config", "EnableJIT", m_EnableJIT); file.Set("Config", "Backend", sBackend); file.Set("Config", "Frequency", sFrequency); file.Set("Config", "Volume", m_Volume); + + file.Save((std::string(File::GetUserPath(F_DSPCONFIG_IDX)).c_str())); } // Update according to the values (stream/mixer) diff --git a/Source/Core/AudioCommon/Src/AudioCommonConfig.h b/Source/Core/AudioCommon/Src/AudioCommonConfig.h index ff35fb2229..71ad76602b 100644 --- a/Source/Core/AudioCommon/Src/AudioCommonConfig.h +++ b/Source/Core/AudioCommon/Src/AudioCommonConfig.h @@ -41,10 +41,10 @@ struct AudioCommonConfig std::string sFrequency; // Load from given file - void Load(IniFile &file); + void Load(); - // Set the values for the file - void Set(IniFile &file); + // Self explanatory + void SaveSettings(); // Update according to the values (stream/mixer) void Update(); diff --git a/Source/Core/Common/Src/CommonPaths.h b/Source/Core/Common/Src/CommonPaths.h index 751d95a10f..c2a42481eb 100644 --- a/Source/Core/Common/Src/CommonPaths.h +++ b/Source/Core/Common/Src/CommonPaths.h @@ -117,6 +117,7 @@ // Filenames // Files in the directory returned by GetUserPath(D_CONFIG_IDX) #define DOLPHIN_CONFIG "Dolphin.ini" +#define DSP_CONFIG "DSP.ini" #define DEBUGGER_CONFIG "Debugger.ini" #define LOGGER_CONFIG "Logger.ini" diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index f37ba1e669..33e3ea5b64 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -663,6 +663,7 @@ const char *GetUserPath(int DirIDX) static char MailLogsDir[MAX_PATH] = {0}; static char WiiSYSCONFDir[MAX_PATH] = {0}; static char DolphinConfig[MAX_PATH] = {0}; + static char DSPConfig[MAX_PATH] = {0}; static char DebuggerConfig[MAX_PATH] = {0}; static char LoggerConfig[MAX_PATH] = {0}; static char MainLog[MAX_PATH] = {0}; @@ -706,6 +707,7 @@ const char *GetUserPath(int DirIDX) snprintf(MailLogsDir, sizeof(MailLogsDir), "%s" MAIL_LOGS_DIR DIR_SEP, UserDir); snprintf(WiiSYSCONFDir, sizeof(WiiSYSCONFDir), "%s" WII_SYSCONF_DIR DIR_SEP, UserDir); snprintf(DolphinConfig, sizeof(DolphinConfig), "%s" DOLPHIN_CONFIG, ConfigDir); + snprintf(DSPConfig, sizeof(DSPConfig), "%s" DSP_CONFIG, ConfigDir); snprintf(DebuggerConfig, sizeof(DebuggerConfig), "%s" DEBUGGER_CONFIG, ConfigDir); snprintf(LoggerConfig, sizeof(LoggerConfig), "%s" LOGGER_CONFIG, ConfigDir); snprintf(MainLog, sizeof(MainLog), "%s" MAIN_LOG, LogsDir); @@ -760,6 +762,8 @@ const char *GetUserPath(int DirIDX) return WiiSYSCONFDir; case F_DOLPHINCONFIG_IDX: return DolphinConfig; + case F_DSPCONFIG_IDX: + return DSPConfig; case F_DEBUGGERCONFIG_IDX: return DebuggerConfig; case F_LOGGERCONFIG_IDX: diff --git a/Source/Core/Common/Src/FileUtil.h b/Source/Core/Common/Src/FileUtil.h index 1d7a24ee1e..75aa75547e 100644 --- a/Source/Core/Common/Src/FileUtil.h +++ b/Source/Core/Common/Src/FileUtil.h @@ -48,6 +48,7 @@ enum { D_MAILLOGS_IDX, D_WIISYSCONF_IDX, F_DOLPHINCONFIG_IDX, + F_DSPCONFIG_IDX, F_DEBUGGERCONFIG_IDX, F_LOGGERCONFIG_IDX, F_MAINLOG_IDX, diff --git a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp index 2f71f39759..1920558c0a 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp @@ -267,22 +267,3 @@ void DSPHLE::DSP_ClearAudioBuffer(bool mute) if (soundStream) soundStream->Clear(mute); } - - -#define HLE_CONFIG_FILE "DSP.ini" - -void DSPHLE_LoadConfig() -{ - // first load defaults - IniFile file; - file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + HLE_CONFIG_FILE).c_str()); - ac_Config.Load(file); -} - -void DSPHLE_SaveConfig() -{ - IniFile file; - file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + HLE_CONFIG_FILE).c_str()); - ac_Config.Set(file); - file.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + HLE_CONFIG_FILE).c_str()); -} diff --git a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h index 5c9056f46a..3b3d7a294b 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h +++ b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h @@ -101,8 +101,4 @@ private: bool m_bAssertInt; }; -// Hack to be deleted. -void DSPHLE_LoadConfig(); -void DSPHLE_SaveConfig(); - #endif // _DSPHLE_H diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp index 57816bf688..f9ab57a44d 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp @@ -345,21 +345,3 @@ void DSPLLE::DSP_ClearAudioBuffer(bool mute) if (soundStream) soundStream->Clear(mute); } - -#define LLE_CONFIG_FILE "DSPLLE.ini" - -void DSPLLE_LoadConfig() -{ - // first load defaults - IniFile file; - file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + LLE_CONFIG_FILE).c_str()); - ac_Config.Load(file); -} - -void DSPLLE_SaveConfig() -{ - IniFile file; - file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + LLE_CONFIG_FILE).c_str()); - ac_Config.Set(file); - file.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + LLE_CONFIG_FILE).c_str()); -} diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h index 76ca6f56c0..61c87d9e13 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h @@ -69,8 +69,4 @@ private: volatile u32 m_cycle_count; }; -// Hack to be deleted. -void DSPLLE_LoadConfig(); -void DSPLLE_SaveConfig(); - #endif // _DSPLLE_H diff --git a/Source/Core/Core/Src/PluginDSP.cpp b/Source/Core/Core/Src/PluginDSP.cpp index 87f479516a..5a4b5d1b06 100644 --- a/Source/Core/Core/Src/PluginDSP.cpp +++ b/Source/Core/Core/Src/PluginDSP.cpp @@ -22,14 +22,14 @@ PluginDSP *CreateDSPPlugin(bool HLE) { + ac_Config.Load(); + if (HLE) { - DSPHLE_LoadConfig(); return new DSPHLE(); } else { - DSPLLE_LoadConfig(); return new DSPLLE(); } } diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 0cf9d7892d..31054afaac 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -21,8 +21,6 @@ if(wxWidgets_FOUND) Src/ARCodeAddEdit.cpp Src/CheatsWindow.cpp Src/ConfigMain.cpp - Src/DSPHLEConfigDlg.cpp - Src/DSPLLEConfigDlg.cpp Src/Frame.cpp Src/FrameAui.cpp Src/FrameTools.cpp diff --git a/Source/Core/DolphinWX/DolphinWX.vcproj b/Source/Core/DolphinWX/DolphinWX.vcproj index 2f1448a357..1465e038a1 100644 --- a/Source/Core/DolphinWX/DolphinWX.vcproj +++ b/Source/Core/DolphinWX/DolphinWX.vcproj @@ -840,22 +840,6 @@ RelativePath=".\src\ConfigMain.h" > - - - - - - - - diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 675271f4fe..44929fd124 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -123,8 +123,12 @@ EVT_CHECKBOX(ID_DISPLAY_RENDERTOMAIN, CConfigMain::DisplaySettingsChanged) EVT_CHECKBOX(ID_DISPLAY_PROGSCAN, CConfigMain::DisplaySettingsChanged) EVT_CHECKBOX(ID_DISPLAY_NTSCJ, CConfigMain::DisplaySettingsChanged) -EVT_CHECKBOX(ID_AUDIO_DSP_HLE, CConfigMain::AudioSettingsChanged) -EVT_BUTTON(ID_AUDIO_CONFIG, CConfigMain::OnDSPConfig) +EVT_RADIOBOX(ID_DSPENGINE, CConfigMain::AudioSettingsChanged) +EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, CConfigMain::AudioSettingsChanged) +EVT_CHECKBOX(ID_ENABLE_THROTTLE, CConfigMain::AudioSettingsChanged) +EVT_CHOICE(ID_FREQUENCY, CConfigMain::AudioSettingsChanged) +EVT_CHOICE(ID_BACKEND, CConfigMain::AudioSettingsChanged) +EVT_SLIDER(ID_VOLUME, CConfigMain::AudioSettingsChanged) EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::DisplaySettingsChanged) EVT_CHECKBOX(ID_INTERFACE_USEPANICHANDLERS, CConfigMain::DisplaySettingsChanged) @@ -194,6 +198,18 @@ CConfigMain::~CConfigMain() { } +void CConfigMain::SetSelectedTab(int tab) +{ + // TODO : this is just a quick and dirty way to do it, possible cleanup + + switch (tab) + { + case ID_AUDIOPAGE: + this->Notebook->SetSelection(2); + break; + } +} + // Used to restrict changing of some options while emulator is running void CConfigMain::UpdateGUI() { @@ -217,8 +233,7 @@ void CConfigMain::UpdateGUI() NTSCJ->Disable(); // Disable stuff on AudioPage - DSP_HLE->Disable(); - DSPConfig->Disable(); + DSPEngine->Disable(); // Disable stuff on GamecubePage GCSystemLang->Disable(); @@ -257,6 +272,11 @@ void CConfigMain::InitializeGUILists() arrayStringFor_CPUEngine.Add(_("JIT Recompiler (recommended)")); arrayStringFor_CPUEngine.Add(_("JITIL experimental recompiler")); + // DSP Engine + arrayStringFor_DSPEngine.Add(_("DSP HLE emulation (fast)")); + arrayStringFor_DSPEngine.Add(_("DSP LLE recompiler")); + arrayStringFor_DSPEngine.Add(_("DSP LLE interpreter (slow)")); + // Display page // Resolutions @@ -322,6 +342,9 @@ void CConfigMain::InitializeGUILists() void CConfigMain::InitializeGUIValues() { const SCoreStartupParameter& startup_params = SConfig::GetInstance().m_LocalCoreStartupParameter; + + // Load DSP Settings. + ac_Config.Load(); // General - Basic CPUThread->SetValue(startup_params.bCPUThread); @@ -364,9 +387,23 @@ void CConfigMain::InitializeGUIValues() } } + // Audio DSP Engine + if (startup_params.bDSPHLE) + DSPEngine->SetSelection(0); + else + DSPEngine->SetSelection(ac_Config.m_EnableJIT ? 1 : 2); // Audio - DSP_HLE->SetValue(startup_params.bDSPHLE); + VolumeSlider->Enable(SupportsVolumeChanges(ac_Config.sBackend)); + VolumeSlider->SetValue(ac_Config.m_Volume); + VolumeText->SetLabel(wxString::Format(wxT("%d %%"), ac_Config.m_Volume)); + EnableDTKMusic->SetValue(ac_Config.m_EnableDTKMusic ? true : false); + EnableThrottle->SetValue(ac_Config.m_EnableThrottle ? true : false); + FrequencySelection->SetSelection( + FrequencySelection->FindString(wxString::FromAscii(ac_Config.sFrequency.c_str()))); + // add backends to the list + AddAudioBackends(); + // Gamecube - IPL GCSystemLang->SetSelection(startup_params.SelectedLanguage); @@ -435,6 +472,13 @@ void CConfigMain::InitializeGUITooltips() InterfaceLang->SetToolTip(_("Change the language of the user interface.\nRequires restart.")); + // Audio tooltips + EnableDTKMusic->SetToolTip(_("This is used to play music tracks, like BGM.")); + EnableThrottle->SetToolTip(_("This is used to control game speed by sound throttle.\nDisabling this could cause abnormal game speed, such as too fast.\nBut sometimes enabling this could cause constant noise.\n\nKeyboard Shortcut : Hold down to instantly disable Throttle.")); + DSPEngine->SetToolTip(_("please someone fill this tooltip i have no idea what to say :D")); + FrequencySelection->SetToolTip(_("Changing this will have no effect while the emulator is running!")); + BackendSelection->SetToolTip(_("Changing this will have no effect while the emulator is running!")); + // Gamecube - Devices GCEXIDevice[2]->SetToolTip(_("Serial Port 1 - This is the port which devices such as the net adapter use")); @@ -464,6 +508,7 @@ void CConfigMain::CreateGUIControls() Notebook->AddPage(PathsPage, _("Paths")); Notebook->AddPage(PluginsPage, _("Plugins")); + // General page // Core Settings - Basic sbBasic = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, _("Basic Settings")); @@ -473,7 +518,6 @@ void CConfigMain::CreateGUIControls() // Framelimit Framelimit = new wxChoice(GeneralPage, ID_FRAMELIMIT, wxDefaultPosition, wxDefaultSize, arrayStringFor_Framelimit, 0, wxDefaultValidator); UseFPSForLimiting = new wxCheckBox(GeneralPage, ID_FRAMELIMIT_USEFPSFORLIMITING, _("Use FPS For Limiting"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - // Core Settings - Advanced sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, _("Advanced Settings")); AlwaysHLE_BS2 = new wxCheckBox(GeneralPage, ID_ALWAYS_HLE_BS2, _("Skip GC BIOS"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); @@ -481,7 +525,7 @@ void CConfigMain::CreateGUIControls() LockThreads = new wxCheckBox(GeneralPage, ID_LOCKTHREADS, _("Lock threads to cores"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); DSPThread = new wxCheckBox(GeneralPage, ID_DSPTHREAD, _("DSPLLE on thread"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - // Populate the settings + // Populate the General settings sbBasic->Add(CPUThread, 0, wxALL, 5); sbBasic->Add(SkipIdle, 0, wxALL, 5); sbBasic->Add(EnableCheats, 0, wxALL, 5); @@ -496,15 +540,12 @@ void CConfigMain::CreateGUIControls() sbAdvanced->Add(LockThreads, 0, wxALL, 5); sbAdvanced->Add(DSPThread, 0, wxALL, 5); - // Populate the General page sGeneralPage = new wxBoxSizer(wxVERTICAL); sGeneralPage->Add(sbBasic, 0, wxEXPAND | wxALL, 5); sGeneralPage->Add(sbAdvanced, 0, wxEXPAND | wxALL, 5); - GeneralPage->SetSizer(sGeneralPage); - - - // Display page + + // General display settings sbDisplay = new wxStaticBoxSizer(wxVERTICAL, DisplayPage, _("Emulator Display Settings")); FullscreenResolution = new wxChoice(DisplayPage, ID_DISPLAY_FULLSCREENRES, wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenResolution, 0, wxDefaultValidator, arrayStringFor_FullscreenResolution[0]); @@ -519,31 +560,19 @@ void CConfigMain::CreateGUIControls() ProgressiveScan = new wxCheckBox(DisplayPage, ID_DISPLAY_PROGSCAN, _("Enable Progressive Scan"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); NTSCJ = new wxCheckBox(DisplayPage, ID_DISPLAY_NTSCJ, _("Set Console as NTSC-J"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + // Interface Language + InterfaceLang = new wxChoice(DisplayPage, ID_INTERFACE_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_InterfaceLang, 0, wxDefaultValidator); + // Hotkey configuration + // TODO : doesn't really belong to the display page, heh. + HotkeyConfig = new wxButton(DisplayPage, ID_HOTKEY_CONFIG, _("Hotkeys"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator); + // Themes - this should really be a wxChoice... + Theme = new wxRadioBox(DisplayPage, ID_INTERFACE_THEME, _("Theme"), wxDefaultPosition, wxDefaultSize, arrayStringFor_Themes, 1, wxRA_SPECIFY_ROWS); // Interface settings sbInterface = new wxStaticBoxSizer(wxVERTICAL, DisplayPage, _("Interface Settings")); ConfirmStop = new wxCheckBox(DisplayPage, ID_INTERFACE_CONFIRMSTOP, _("Confirm On Stop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); UsePanicHandlers = new wxCheckBox(DisplayPage, ID_INTERFACE_USEPANICHANDLERS, _("Use Panic Handlers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - - // Audio page - sAudioPage = new wxBoxSizer(wxVERTICAL); - DSP_HLE = new wxCheckBox(AudioPage, ID_AUDIO_DSP_HLE, _("DSP HLE emulation (fast)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - DSPConfig = new wxButton(AudioPage, ID_AUDIO_CONFIG, _("Configure DSP"), wxDefaultPosition, wxDefaultSize); - sAudioPage->Add(DSP_HLE); - sAudioPage->Add(DSPConfig); - AudioPage->SetSizer(sAudioPage); - // Themes - this should really be a wxChoice... - Theme = new wxRadioBox(DisplayPage, ID_INTERFACE_THEME, _("Theme"), wxDefaultPosition, wxDefaultSize, arrayStringFor_Themes, 1, wxRA_SPECIFY_ROWS); - - // Interface Language - // At the moment this only changes the language displayed in m_gamelistctrl - // If someone wants to control the whole GUI's language, it should be set here too - InterfaceLang = new wxChoice(DisplayPage, ID_INTERFACE_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_InterfaceLang, 0, wxDefaultValidator); - - // Hotkey configuration - HotkeyConfig = new wxButton(DisplayPage, ID_HOTKEY_CONFIG, _("Hotkeys"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator); - - // Populate the settings + // Populate the Display page wxBoxSizer* sDisplayRes = new wxBoxSizer(wxHORIZONTAL); sDisplayRes->Add(TEXT_BOX(DisplayPage, _("Fullscreen Display Resolution:")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); @@ -572,14 +601,54 @@ void CConfigMain::CreateGUIControls() sInterface->Add(HotkeyConfig, 0, wxALIGN_RIGHT | wxALL, 5); sbInterface->Add(sInterface, 0, wxEXPAND | wxALL, 5); - // Populate the Display page sDisplayPage = new wxBoxSizer(wxVERTICAL); sDisplayPage->Add(sbDisplay, 0, wxEXPAND | wxALL, 5); sDisplayPage->Add(sbInterface, 0, wxEXPAND | wxALL, 5); - DisplayPage->SetSizer(sDisplayPage); + + // Audio page + DSPEngine = new wxRadioBox(AudioPage, ID_DSPENGINE, _("DSP Emulator Engine"), wxDefaultPosition, wxDefaultSize, arrayStringFor_DSPEngine, 0, wxRA_SPECIFY_ROWS); + EnableDTKMusic = new wxCheckBox(AudioPage, ID_ENABLE_DTK_MUSIC, _("Enable DTK Music"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + EnableThrottle = new wxCheckBox(AudioPage, ID_ENABLE_THROTTLE, _("Enable Audio Throttle"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + VolumeSlider = new wxSlider(AudioPage, ID_VOLUME, 0, 1, 100, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL|wxSL_INVERSE); + VolumeText = new wxStaticText(AudioPage, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, 0); + BackendSelection = new wxChoice(AudioPage, ID_BACKEND, wxDefaultPosition, wxDefaultSize, wxArrayBackends, 0, wxDefaultValidator, wxEmptyString); + FrequencySelection = new wxChoice(AudioPage, ID_FREQUENCY, wxDefaultPosition, wxDefaultSize, wxArrayRates, 0, wxDefaultValidator, wxEmptyString); + FrequencySelection->Append(_("48,000 Hz")); + FrequencySelection->Append(_("32,000 Hz")); + // Create sizer and add items to dialog + wxStaticBoxSizer *sbAudioSettings = new wxStaticBoxSizer(wxVERTICAL, AudioPage, _("Sound Settings")); + sbAudioSettings->Add(DSPEngine, 0, wxALL | wxEXPAND, 5); + sbAudioSettings->Add(EnableDTKMusic, 0, wxALL, 5); + sbAudioSettings->Add(EnableThrottle, 0, wxALL, 5); + + wxStaticBoxSizer *sbVolume = new wxStaticBoxSizer(wxVERTICAL, AudioPage, _("Volume")); + sbVolume->Add(VolumeSlider, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER, 6); + sbVolume->Add(VolumeText, 0, wxALL|wxALIGN_LEFT, 4); + + wxBoxSizer *sBackendText = new wxBoxSizer(wxVERTICAL); + wxGridBagSizer *sBackend = new wxGridBagSizer(); + sBackendText->Add(TEXT_BOX(AudioPage, _("Audio Backend :")), 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + sBackend->Add(BackendSelection, wxGBPosition(0, 0), wxDefaultSpan, wxEXPAND|wxALL, 1); + sBackendText->Add(TEXT_BOX(AudioPage, _("Sample Rate :")), 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + sBackend->Add(FrequencySelection, wxGBPosition(1, 0), wxDefaultSpan, wxEXPAND|wxALL, 1); + wxStaticBoxSizer *sbBackend = new wxStaticBoxSizer(wxHORIZONTAL, AudioPage, _("Backend Settings")); + sbBackend->Add(sBackendText, 1, wxALL | wxEXPAND); + sbBackend->Add(sBackend, 0, wxALL | wxEXPAND); + + wxBoxSizer *sAudio = new wxBoxSizer(wxHORIZONTAL); + sAudio->Add(sbAudioSettings, 1, wxEXPAND|wxALL, 5); + sAudio->Add(sbVolume, 0, wxEXPAND|wxALL, 5); + + sAudioPage = new wxBoxSizer(wxVERTICAL); + sAudioPage->Add(sAudio, 0, wxALL|wxEXPAND); + sAudioPage->Add(sbBackend, 0, wxALL|wxEXPAND, 5); + AudioPage->SetSizerAndFit(sAudioPage); + + + // TODO : Warning the following code hurts // Gamecube page // IPL settings sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, _("IPL Settings")); @@ -604,7 +673,9 @@ void CConfigMain::CreateGUIControls() GCEXIDevice[2] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SP1, wxDefaultPosition, wxDefaultSize, numSP1Devices, SP1Devices, 0, wxDefaultValidator); GCMemcardPath[0] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTA_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator); GCMemcardPath[1] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTB_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator); + // Can't move this one without making the 4 const's etc. above class members/fields, + // TODO : lies, wxArrayString + wxChoice->Create. for (int i = 0; i < 3; ++i) { bool isMemcard = false; @@ -637,12 +708,14 @@ void CConfigMain::CreateGUIControls() if (!isMemcard && i < 2) GCMemcardPath[i]->Disable(); } + //SI Devices wxStaticText* GCSIDeviceText[4]; GCSIDeviceText[0] = TEXT_BOX(GamecubePage, _("Port 1")); GCSIDeviceText[1] = TEXT_BOX(GamecubePage, _("Port 2")); GCSIDeviceText[2] = TEXT_BOX(GamecubePage, _("Port 3")); GCSIDeviceText[3] = TEXT_BOX(GamecubePage, _("Port 4")); + // SIDEV_AM_BB_STR must be last! const wxString SIDevices[] = {_(DEV_NONE_STR),_(SIDEV_STDCONT_STR),_(SIDEV_GBA_STR),_(SIDEV_AM_BB_STR)}; static const int numSIDevices = sizeof(SIDevices)/sizeof(wxString); @@ -670,7 +743,7 @@ void CConfigMain::CreateGUIControls() } } - // Populate the settings + // Populate the Gamecube page sGamecubeIPLSettings = new wxGridBagSizer(); sGamecubeIPLSettings->Add(TEXT_BOX(GamecubePage, _("System Language:")), wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); @@ -693,12 +766,9 @@ void CConfigMain::CreateGUIControls() sSIDevices[i]->Add(GCSIDevice[i], 0, wxALL, 5); sbGamecubeDeviceSettings->Add(sSIDevices[i]); } - - // Populate the Gamecube page sGamecubePage = new wxBoxSizer(wxVERTICAL); sGamecubePage->Add(sbGamecubeIPLSettings, 0, wxEXPAND|wxALL, 5); sGamecubePage->Add(sbGamecubeDeviceSettings, 0, wxEXPAND|wxALL, 5); - GamecubePage->SetSizer(sGamecubePage); @@ -721,7 +791,7 @@ void CConfigMain::CreateGUIControls() WiiSDCard = new wxCheckBox(WiiPage, ID_WII_SD_CARD, _("Insert SD Card"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); WiiKeyboard = new wxCheckBox(WiiPage, ID_WII_KEYBOARD, _("Connect USB Keyboard"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - // Populate the settings + // Populate the Wii Page sWiimoteSettings = new wxGridBagSizer(); sWiimoteSettings->Add(TEXT_BOX(WiiPage, _("Sensor Bar Position:")), wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); @@ -746,12 +816,10 @@ void CConfigMain::CreateGUIControls() sbWiiDeviceSettings->Add(WiiSDCard, 0, wxALL, 5); sbWiiDeviceSettings->Add(WiiKeyboard, 0, wxALL, 5); - // Populate the Wii page sWiiPage = new wxBoxSizer(wxVERTICAL); sWiiPage->Add(sbWiimoteSettings, 0, wxEXPAND|wxALL, 5); sWiiPage->Add(sbWiiIPLSettings, 0, wxEXPAND|wxALL, 5); sWiiPage->Add(sbWiiDeviceSettings, 0, wxEXPAND|wxALL, 5); - WiiPage->SetSizer(sWiiPage); @@ -796,7 +864,6 @@ void CConfigMain::CreateGUIControls() sPathsPage = new wxBoxSizer(wxVERTICAL); sPathsPage->Add(sbISOPaths, 1, wxEXPAND|wxALL, 5); sPathsPage->Add(sOtherPaths, 0, wxEXPAND|wxALL, 5); - PathsPage->SetSizer(sPathsPage); @@ -849,6 +916,9 @@ void CConfigMain::OnOk(wxCommandEvent& WXUNUSED (event)) // Save the config. Dolphin crashes to often to save the settings on closing only SConfig::GetInstance().SaveSettings(); + + // Save Audio settings + ac_Config.SaveSettings(); } // Core settings @@ -962,12 +1032,56 @@ void CConfigMain::AudioSettingsChanged(wxCommandEvent& event) { switch (event.GetId()) { - case ID_AUDIO_DSP_HLE: - SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE = DSP_HLE->IsChecked(); + case ID_DSPENGINE: + SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE = DSPEngine->GetSelection() == 0; + ac_Config.m_EnableJIT = DSPEngine->GetSelection() == 1; + ac_Config.Update(); + break; + case ID_BACKEND: + VolumeSlider->Enable(SupportsVolumeChanges(std::string(BackendSelection->GetStringSelection().mb_str()))); + break; + case ID_VOLUME: + ac_Config.m_Volume = VolumeSlider->GetValue(); + ac_Config.Update(); + VolumeText->SetLabel(wxString::Format(wxT("%d %%"), VolumeSlider->GetValue())); + break; + default: + ac_Config.m_EnableDTKMusic = EnableDTKMusic->GetValue(); + ac_Config.m_EnableThrottle = EnableThrottle->GetValue(); + ac_Config.sBackend = BackendSelection->GetStringSelection().mb_str(); + ac_Config.sFrequency = FrequencySelection->GetStringSelection().mb_str(); + ac_Config.Update(); break; } } +void CConfigMain::AddAudioBackends() +{ + std::vector backends = AudioCommon::GetSoundBackends(); + // I'm sure Billiard will change this into an auto sometimes soon :P + for (std::vector::const_iterator iter = backends.begin(); + iter != backends.end(); ++iter) + { + BackendSelection->Append(wxString::FromAscii((*iter).c_str())); + int num = BackendSelection->\ + FindString(wxString::FromAscii(ac_Config.sBackend.c_str())); + BackendSelection->SetSelection(num); + } +} + +bool CConfigMain::SupportsVolumeChanges(std::string backend) +{ + //FIXME: this one should ask the backend whether it supports it. + // but getting the backend from string etc. is probably + // too much just to enable/disable a stupid slider... + return (backend == BACKEND_DIRECTSOUND || + backend == BACKEND_COREAUDIO || + backend == BACKEND_OPENAL || + backend == BACKEND_XAUDIO2 || + backend == BACKEND_PULSEAUDIO); +} + + // GC settings // ----------------------- void CConfigMain::GCSettingsChanged(wxCommandEvent& event) @@ -1227,24 +1341,6 @@ void CConfigMain::OnConfig(wxCommandEvent& event) } } -void CConfigMain::OnDSPConfig(wxCommandEvent& event) -{ - switch (event.GetId()) - { - case ID_AUDIO_CONFIG: - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE) { - DSPConfigDialogHLE *dlg = new DSPConfigDialogHLE(this); - dlg->ShowModal(); - dlg->Destroy(); - } else { - DSPConfigDialogLLE *dlg = new DSPConfigDialogLLE(this); - dlg->ShowModal(); - dlg->Destroy(); - } - break; - } -} - void CConfigMain::CallConfig(wxChoice* _pChoice) { diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index e38c6bc27b..0cb83601eb 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -44,10 +44,106 @@ public: void CloseClick(wxCommandEvent& event); void OnSelectionChanged(wxCommandEvent& event); void OnConfig(wxCommandEvent& event); - void OnDSPConfig(wxCommandEvent& event); + void SetSelectedTab(int tab); bool bRefreshList; + enum + { + ID_NOTEBOOK = 1000, + ID_GENERALPAGE, + ID_DISPLAYPAGE, + ID_AUDIOPAGE, + ID_GAMECUBEPAGE, + ID_WIIPAGE, + ID_PATHSPAGE, + ID_PLUGINPAGE, + + ID_CPUTHREAD, + ID_IDLESKIP, + ID_ENABLECHEATS, + ID_FRAMELIMIT, + ID_FRAMELIMIT_USEFPSFORLIMITING, + + ID_ALWAYS_HLE_BS2, + ID_ENABLE_OPENCL, + ID_CPUENGINE, + ID_LOCKTHREADS, + ID_DSPTHREAD, + + + ID_DISPLAY_FULLSCREENRES, + ID_DISPLAY_WINDOWWIDTH, + ID_DISPLAY_WINDOWHEIGHT, + ID_DISPLAY_AUTOSIZE, + ID_DISPLAY_FULLSCREEN, + ID_DISPLAY_HIDECURSOR, + ID_DISPLAY_RENDERTOMAIN, + ID_DISPLAY_PROGSCAN, + ID_DISPLAY_NTSCJ, + + // Audio Settings + ID_DSPENGINE, + ID_ENABLE_HLE_AUDIO, + ID_ENABLE_DTK_MUSIC, + ID_ENABLE_THROTTLE, + ID_FREQUENCY, + ID_BACKEND, + ID_VOLUME, + + // Interface settings + ID_INTERFACE_CONFIRMSTOP, + ID_INTERFACE_USEPANICHANDLERS, + ID_INTERFACE_THEME, + ID_INTERFACE_LANG, + ID_HOTKEY_CONFIG, + + + ID_GC_SRAM_LNG, + + ID_GC_EXIDEVICE_SLOTA, + ID_GC_EXIDEVICE_SLOTA_PATH, + ID_GC_EXIDEVICE_SLOTB, + ID_GC_EXIDEVICE_SLOTB_PATH, + ID_GC_EXIDEVICE_SP1, + ID_GC_SIDEVICE0, + ID_GC_SIDEVICE1, + ID_GC_SIDEVICE2, + ID_GC_SIDEVICE3, + + + ID_WII_BT_BAR, + ID_WII_BT_SENS, + ID_WII_BT_MOT, + + ID_WII_IPL_SSV, + ID_WII_IPL_E60, + ID_WII_IPL_AR, + ID_WII_IPL_LNG, + + ID_WII_SD_CARD, + ID_WII_KEYBOARD, + + + ID_ISOPATHS, + ID_RECURSIVEISOPATH, + ID_ADDISOPATH, + ID_REMOVEISOPATH, + + ID_DEFAULTISO, + ID_DVDROOT, + ID_APPLOADERPATH, + + + ID_GRAPHIC_CB, + ID_GRAPHIC_CONFIG, + ID_GRAPHIC_ABOUT, + + ID_DSP_CB, + ID_DSP_CONFIG, + ID_DSP_ABOUT, + }; + private: wxNotebook* Notebook; wxPanel* GeneralPage; @@ -91,8 +187,15 @@ private: // Audio wxBoxSizer* sAudioPage; // GC settings - wxCheckBox* DSP_HLE; - wxButton* DSPConfig; + wxRadioBox* DSPEngine; + wxSlider* VolumeSlider; + wxStaticText* VolumeText; + wxCheckBox* EnableDTKMusic; + wxCheckBox* EnableThrottle; + wxArrayString wxArrayBackends; + wxArrayString wxArrayRates; + wxChoice* BackendSelection; + wxChoice* FrequencySelection; // Interface wxCheckBox* ConfirmStop; @@ -163,6 +266,7 @@ private: wxArrayString arrayStringFor_Framelimit; wxArrayString arrayStringFor_CPUEngine; + wxArrayString arrayStringFor_DSPEngine; wxArrayString arrayStringFor_FullscreenResolution; wxArrayString arrayStringFor_Themes; wxArrayString arrayStringFor_InterfaceLang; @@ -172,97 +276,6 @@ private: wxArrayString arrayStringFor_WiiSystemLang; wxArrayString arrayStringFor_ISOPaths; - enum - { - ID_NOTEBOOK = 1000, - ID_GENERALPAGE, - ID_DISPLAYPAGE, - ID_AUDIOPAGE, - ID_GAMECUBEPAGE, - ID_WIIPAGE, - ID_PATHSPAGE, - ID_PLUGINPAGE, - - ID_CPUTHREAD, - ID_IDLESKIP, - ID_ENABLECHEATS, - ID_FRAMELIMIT, - ID_FRAMELIMIT_USEFPSFORLIMITING, - - ID_ALWAYS_HLE_BS2, - ID_ENABLE_OPENCL, - ID_CPUENGINE, - ID_LOCKTHREADS, - ID_DSPTHREAD, - - - ID_DISPLAY_FULLSCREENRES, - ID_DISPLAY_WINDOWWIDTH, - ID_DISPLAY_WINDOWHEIGHT, - ID_DISPLAY_AUTOSIZE, - ID_DISPLAY_FULLSCREEN, - ID_DISPLAY_HIDECURSOR, - ID_DISPLAY_RENDERTOMAIN, - ID_DISPLAY_PROGSCAN, - ID_DISPLAY_NTSCJ, - - // Audio Settings - ID_AUDIO_DSP_HLE, - ID_AUDIO_CONFIG, - - // Interface settings - ID_INTERFACE_CONFIRMSTOP, - ID_INTERFACE_USEPANICHANDLERS, - ID_INTERFACE_THEME, - ID_INTERFACE_LANG, - ID_HOTKEY_CONFIG, - - - ID_GC_SRAM_LNG, - - ID_GC_EXIDEVICE_SLOTA, - ID_GC_EXIDEVICE_SLOTA_PATH, - ID_GC_EXIDEVICE_SLOTB, - ID_GC_EXIDEVICE_SLOTB_PATH, - ID_GC_EXIDEVICE_SP1, - ID_GC_SIDEVICE0, - ID_GC_SIDEVICE1, - ID_GC_SIDEVICE2, - ID_GC_SIDEVICE3, - - - ID_WII_BT_BAR, - ID_WII_BT_SENS, - ID_WII_BT_MOT, - - ID_WII_IPL_SSV, - ID_WII_IPL_E60, - ID_WII_IPL_AR, - ID_WII_IPL_LNG, - - ID_WII_SD_CARD, - ID_WII_KEYBOARD, - - - ID_ISOPATHS, - ID_RECURSIVEISOPATH, - ID_ADDISOPATH, - ID_REMOVEISOPATH, - - ID_DEFAULTISO, - ID_DVDROOT, - ID_APPLOADERPATH, - - - ID_GRAPHIC_CB, - ID_GRAPHIC_CONFIG, - ID_GRAPHIC_ABOUT, - - ID_DSP_CB, - ID_DSP_CONFIG, - ID_DSP_ABOUT, - }; - void InitializeGUILists(); void InitializeGUIValues(); void InitializeGUITooltips(); @@ -278,6 +291,8 @@ private: void OnSpin(wxSpinEvent& event); void AudioSettingsChanged(wxCommandEvent& event); + bool SupportsVolumeChanges(std::string backend); + void AddAudioBackends(); void GCSettingsChanged(wxCommandEvent& event); void ChooseMemcardPath(std::string& strMemcard, bool isSlotA); diff --git a/Source/Core/DolphinWX/Src/DSPHLEConfigDlg.cpp b/Source/Core/DolphinWX/Src/DSPHLEConfigDlg.cpp deleted file mode 100644 index cb52a08ac4..0000000000 --- a/Source/Core/DolphinWX/Src/DSPHLEConfigDlg.cpp +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// 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, version 2.0. - -// 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 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#include -#include - -#include "HW/DSPHLE/DSPHLE.h" -#include "DSPHLEConfigDlg.h" - -BEGIN_EVENT_TABLE(DSPConfigDialogHLE, wxDialog) - EVT_BUTTON(wxID_OK, DSPConfigDialogHLE::SettingsChanged) - EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, DSPConfigDialogHLE::SettingsChanged) - EVT_CHECKBOX(ID_ENABLE_THROTTLE, DSPConfigDialogHLE::SettingsChanged) - EVT_CHOICE(ID_FREQUENCY, DSPConfigDialogHLE::SettingsChanged) - EVT_CHOICE(ID_BACKEND, DSPConfigDialogHLE::BackendChanged) - EVT_COMMAND_SCROLL(ID_VOLUME, DSPConfigDialogHLE::VolumeChanged) -END_EVENT_TABLE() - -DSPConfigDialogHLE::DSPConfigDialogHLE(wxWindow *parent, wxWindowID id, - const wxString &title, const wxPoint &position, const wxSize& size, long style) -: wxDialog(parent, id, title, position, size, style) -{ - DSPHLE_LoadConfig(); - wxButton *m_OK = new wxButton(this, wxID_OK, _("OK"), - wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - - wxStaticBoxSizer *sbSettings = new wxStaticBoxSizer(wxVERTICAL, this, _("Sound Settings")); - wxStaticBoxSizer *sbSettingsV = new wxStaticBoxSizer(wxVERTICAL, this, _("Volume")); - - // Create items - m_buttonEnableDTKMusic = new wxCheckBox(this, ID_ENABLE_DTK_MUSIC, _("Enable DTK Music"), - wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - m_buttonEnableThrottle = new wxCheckBox(this, ID_ENABLE_THROTTLE, _("Enable Audio Throttle"), - wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - - wxStaticText *FrequencyText = new wxStaticText(this, wxID_ANY, _("Sample Rate"), - wxDefaultPosition, wxDefaultSize, 0); - m_FrequencySelection = new wxChoice(this, ID_FREQUENCY, wxDefaultPosition, wxDefaultSize, - wxArrayRates, 0, wxDefaultValidator, wxEmptyString); - - wxStaticText *BackendText = new wxStaticText(this, wxID_ANY, _("Audio Backend"), - wxDefaultPosition, wxDefaultSize, 0); - m_BackendSelection = new wxChoice(this, ID_BACKEND, wxDefaultPosition, wxDefaultSize, - wxArrayBackends, 0, wxDefaultValidator, wxEmptyString); - - m_volumeSlider = new wxSlider(this, ID_VOLUME, ac_Config.m_Volume, 1, 100, - wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE); - m_volumeSlider->Enable(SupportsVolumeChanges(ac_Config.sBackend)); - m_volumeText = new wxStaticText(this, wxID_ANY, wxString::Format(wxT("%d %%"), - ac_Config.m_Volume), wxDefaultPosition, wxDefaultSize, 0); - - // Update values - m_buttonEnableDTKMusic->SetValue(ac_Config.m_EnableDTKMusic ? true : false); - m_buttonEnableThrottle->SetValue(ac_Config.m_EnableThrottle ? true : false); - - // Add tooltips - m_buttonEnableDTKMusic->SetToolTip(_("This is used to play music tracks, like BGM.")); - m_buttonEnableThrottle->SetToolTip(_("This is used to control game speed by sound throttle.\nDisabling this could cause abnormal game speed, such as too fast.\nBut sometimes enabling this could cause constant noise.\n\nKeyboard Shortcut : Hold down to instantly disable Throttle.")); - m_FrequencySelection-> - SetToolTip(_("Changing this will have no effect while the emulator is running!")); - m_BackendSelection-> - SetToolTip(_("Changing this will have no effect while the emulator is running!")); - - // Create sizer and add items to dialog - wxBoxSizer *sMain = new wxBoxSizer(wxVERTICAL); - wxBoxSizer *sSettings = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer *sBackend = new wxBoxSizer(wxVERTICAL); - wxBoxSizer *sFrequency = new wxBoxSizer(wxVERTICAL); - wxBoxSizer *sButtons = new wxBoxSizer(wxHORIZONTAL); - - sbSettings->Add(m_buttonEnableDTKMusic, 0, wxALL, 5); - sbSettings->Add(m_buttonEnableThrottle, 0, wxALL, 5); - - sFrequency->Add(FrequencyText, 0, wxALIGN_LEFT|wxALL, 1); - sFrequency->Add(m_FrequencySelection, 0, wxALL, 1); - - m_FrequencySelection->Append(_("48,000 Hz")); - m_FrequencySelection->Append(_("32,000 Hz")); - int num = m_FrequencySelection->\ - FindString(wxString::FromAscii(ac_Config.sFrequency.c_str())); - m_FrequencySelection->SetSelection(num); - - sbSettings->Add(sFrequency, 0, wxALL, 7); - - - sBackend->Add(BackendText, 0, wxALIGN_LEFT|wxALL, 1); - sBackend->Add(m_BackendSelection, 0, wxALL, 1); - sbSettings->Add(sBackend, 0, wxALL, 7); - - sbSettingsV->Add(m_volumeSlider, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER, 6); - sbSettingsV->Add(m_volumeText, 0, wxALL|wxALIGN_LEFT, 4); - - sSettings->Add(sbSettings, 0, wxALL|wxEXPAND, 4); - sSettings->Add(sbSettingsV, 0, wxALL|wxEXPAND, 4); - sMain->Add(sSettings, 0, wxALL|wxEXPAND, 4); - - sButtons->AddStretchSpacer(); - sButtons->Add(m_OK, 0, wxALL, 1); - sMain->Add(sButtons, 0, wxALL|wxEXPAND, 4); - SetSizerAndFit(sMain); - - // add backends - std::vector backends = AudioCommon::GetSoundBackends(); - - for (std::vector::const_iterator iter = backends.begin(); - iter != backends.end(); ++iter) - { - AddBackend((*iter).c_str()); - } - - // Center window - CenterOnParent(); -} - -// Add audio output options -void DSPConfigDialogHLE::AddBackend(const char* backend) -{ - // Update values - m_BackendSelection->Append(wxString::FromAscii(backend)); - int num = m_BackendSelection->\ - FindString(wxString::FromAscii(ac_Config.sBackend.c_str())); - m_BackendSelection->SetSelection(num); -} - -void DSPConfigDialogHLE::ClearBackends() -{ - m_BackendSelection->Clear(); -} - -DSPConfigDialogHLE::~DSPConfigDialogHLE() -{ -} - -void DSPConfigDialogHLE::VolumeChanged(wxScrollEvent& WXUNUSED(event)) -{ - ac_Config.m_Volume = m_volumeSlider->GetValue(); - ac_Config.Update(); - - m_volumeText->SetLabel(wxString::Format(wxT("%d %%"), m_volumeSlider->GetValue())); -} - -void DSPConfigDialogHLE::SettingsChanged(wxCommandEvent& event) -{ - ac_Config.m_EnableDTKMusic = m_buttonEnableDTKMusic->GetValue(); - ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue(); - - ac_Config.sBackend = m_BackendSelection->GetStringSelection().mb_str(); - ac_Config.sFrequency = m_FrequencySelection->GetStringSelection().mb_str(); - ac_Config.Update(); - DSPHLE_SaveConfig(); - - if (event.GetId() == wxID_OK) - EndModal(wxID_OK); -} - -bool DSPConfigDialogHLE::SupportsVolumeChanges(std::string backend) -{ - //FIXME: this one should ask the backend whether it supports it. - // but getting the backend from string etc. is probably - // too much just to enable/disable a stupid slider... - return (backend == BACKEND_DIRECTSOUND || - backend == BACKEND_COREAUDIO || - backend == BACKEND_OPENAL || - backend == BACKEND_XAUDIO2 || - backend == BACKEND_PULSEAUDIO); -} - -void DSPConfigDialogHLE::BackendChanged(wxCommandEvent& event) -{ - m_volumeSlider->Enable(SupportsVolumeChanges( - std::string(m_BackendSelection->GetStringSelection().mb_str()))); -} diff --git a/Source/Core/DolphinWX/Src/DSPHLEConfigDlg.h b/Source/Core/DolphinWX/Src/DSPHLEConfigDlg.h deleted file mode 100644 index 9f579572c0..0000000000 --- a/Source/Core/DolphinWX/Src/DSPHLEConfigDlg.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// 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, version 2.0. - -// 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 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __DSP_HLE_CONFIGDIALOG_h__ -#define __DSP_HLE_CONFIGDIALOG_h__ - -#include -#include -#include -#include -#include "AudioCommon.h" - -class DSPConfigDialogHLE : public wxDialog -{ -public: - DSPConfigDialogHLE(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString &title = _("DSP-HLE Settings"), - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE); - virtual ~DSPConfigDialogHLE(); - void AddBackend(const char *backend); - void ClearBackends(); - -private: - DECLARE_EVENT_TABLE(); - - wxSlider* m_volumeSlider; - wxStaticText* m_volumeText; - wxCheckBox* m_buttonEnableDTKMusic; - wxCheckBox* m_buttonEnableThrottle; - wxArrayString wxArrayBackends; - wxArrayString wxArrayRates; - wxChoice* m_BackendSelection; - wxChoice* m_FrequencySelection; - - enum - { - ID_ENABLE_HLE_AUDIO, - ID_ENABLE_DTK_MUSIC, - ID_ENABLE_THROTTLE, - ID_FREQUENCY, - ID_BACKEND, - ID_VOLUME - }; - - void OnOK(wxCommandEvent& event); - void SettingsChanged(wxCommandEvent& event); - void VolumeChanged(wxScrollEvent& event); - bool SupportsVolumeChanges(std::string backend); - void BackendChanged(wxCommandEvent& event); -}; - -#endif //__DSP_HLE_CONFIGDIALOG_h__ diff --git a/Source/Core/DolphinWX/Src/DSPLLEConfigDlg.cpp b/Source/Core/DolphinWX/Src/DSPLLEConfigDlg.cpp deleted file mode 100644 index 2793edeea9..0000000000 --- a/Source/Core/DolphinWX/Src/DSPLLEConfigDlg.cpp +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// 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, version 2.0. - -// 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 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#include "HW/DSPLLE/DSPLLE.h" -#include "DSPLLEConfigDlg.h" - -BEGIN_EVENT_TABLE(DSPConfigDialogLLE, wxDialog) - EVT_BUTTON(wxID_OK, DSPConfigDialogLLE::SettingsChanged) - EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, DSPConfigDialogLLE::SettingsChanged) - EVT_CHECKBOX(ID_ENABLE_THROTTLE, DSPConfigDialogLLE::SettingsChanged) - EVT_CHECKBOX(ID_ENABLE_JIT, DSPConfigDialogLLE::SettingsChanged) - EVT_CHOICE(ID_BACKEND, DSPConfigDialogLLE::BackendChanged) - EVT_COMMAND_SCROLL(ID_VOLUME, DSPConfigDialogLLE::VolumeChanged) -END_EVENT_TABLE() - -DSPConfigDialogLLE::DSPConfigDialogLLE(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) -: wxDialog(parent, id, title, position, size, style) -{ - DSPLLE_LoadConfig(); - - m_OK = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - - wxStaticBoxSizer *sbSettings = new wxStaticBoxSizer(wxVERTICAL, this, _("Sound Settings")); - wxStaticBoxSizer *sbSettingsV = new wxStaticBoxSizer(wxVERTICAL, this, _("Volume")); - - // Create items - m_buttonEnableDTKMusic = new wxCheckBox(this, ID_ENABLE_DTK_MUSIC, _("Enable DTK Music"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - m_buttonEnableThrottle = new wxCheckBox(this, ID_ENABLE_THROTTLE, _("Enable Audio Throttle"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - m_buttonEnableJIT = new wxCheckBox(this, ID_ENABLE_JIT, _("Enable JIT Dynarec"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - wxStaticText *BackendText = new wxStaticText(this, wxID_ANY, _("Audio Backend"), wxDefaultPosition, wxDefaultSize, 0); - m_BackendSelection = new wxChoice(this, ID_BACKEND, wxDefaultPosition, wxDefaultSize, wxArrayBackends, 0, wxDefaultValidator, wxEmptyString); - - m_volumeSlider = new wxSlider(this, ID_VOLUME, ac_Config.m_Volume, 1, 100, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL|wxSL_INVERSE); - m_volumeSlider->Enable(SupportsVolumeChanges(ac_Config.sBackend)); - m_volumeText = new wxStaticText(this, wxID_ANY, wxString::Format(wxT("%d %%"), ac_Config.m_Volume), wxDefaultPosition, wxDefaultSize, 0); - - // Update values - m_buttonEnableDTKMusic->SetValue(ac_Config.m_EnableDTKMusic ? true : false); - m_buttonEnableThrottle->SetValue(ac_Config.m_EnableThrottle ? true : false); - m_buttonEnableJIT->SetValue(ac_Config.m_EnableJIT ? true : false); - - // Add tooltips - m_buttonEnableDTKMusic->SetToolTip(_("This is used to play music tracks, like BGM.")); - m_buttonEnableThrottle->SetToolTip(_("This is used to control game speed by sound throttle.\nDisabling this could cause abnormal game speed, such as too fast.\nBut sometimes enabling this could cause constant noise.\n\nKeyboard Shortcut : Hold down to instantly disable Throttle.")); - m_buttonEnableJIT->SetToolTip(_("Enables dynamic recompilation of DSP code.\nChanging this will have no effect while the emulator is running!")); - m_BackendSelection->SetToolTip(_("Changing this will have no effect while the emulator is running!")); - - // Create sizer and add items to dialog - wxBoxSizer *sMain = new wxBoxSizer(wxVERTICAL); - wxBoxSizer *sSettings = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer *sBackend = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer *sButtons = new wxBoxSizer(wxHORIZONTAL); - - sbSettings->Add(m_buttonEnableDTKMusic, 0, wxALL, 5); - sbSettings->Add(m_buttonEnableThrottle, 0, wxALL, 5); - sbSettings->Add(m_buttonEnableJIT, 0, wxALL, 5); - - sBackend->Add(BackendText, 0, wxALIGN_CENTER|wxALL, 5); - sBackend->Add(m_BackendSelection, 0, wxALL, 1); - sbSettings->Add(sBackend, 0, wxALL, 2); - - sbSettingsV->Add(m_volumeSlider, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER, 6); - sbSettingsV->Add(m_volumeText, 0, wxALL|wxALIGN_LEFT, 4); - - sSettings->Add(sbSettings, 0, wxALL|wxEXPAND, 4); - sSettings->Add(sbSettingsV, 0, wxALL|wxEXPAND, 4); - sMain->Add(sSettings, 0, wxALL|wxEXPAND, 4); - - sButtons->AddStretchSpacer(); - sButtons->Add(m_OK, 0, wxALL, 1); - sMain->Add(sButtons, 0, wxALL|wxEXPAND, 4); - SetSizerAndFit(sMain); - - // add backends - std::vector backends = AudioCommon::GetSoundBackends(); - - for (std::vector::const_iterator iter = backends.begin(); - iter != backends.end(); ++iter) - { - AddBackend((*iter).c_str()); - } - - // Center window - CenterOnParent(); -} - -// Add audio output options -void DSPConfigDialogLLE::AddBackend(const char* backend) -{ - // Update value - m_BackendSelection->Append(wxString::FromAscii(backend)); - - int num = m_BackendSelection->\ - FindString(wxString::FromAscii(ac_Config.sBackend.c_str())); - m_BackendSelection->SetSelection(num); -} - -void DSPConfigDialogLLE::ClearBackends() -{ - m_BackendSelection->Clear(); -} - -DSPConfigDialogLLE::~DSPConfigDialogLLE() -{ -} - -void DSPConfigDialogLLE::VolumeChanged(wxScrollEvent& WXUNUSED(event)) -{ - ac_Config.m_Volume = m_volumeSlider->GetValue(); - ac_Config.Update(); - - m_volumeText->SetLabel(wxString::Format(wxT("%d %%"), m_volumeSlider->GetValue())); -} - -void DSPConfigDialogLLE::SettingsChanged(wxCommandEvent& event) -{ - ac_Config.m_EnableDTKMusic = m_buttonEnableDTKMusic->GetValue(); - ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue(); - ac_Config.m_EnableJIT = m_buttonEnableJIT->GetValue(); - - ac_Config.sBackend = m_BackendSelection->GetStringSelection().mb_str(); - ac_Config.Update(); - DSPLLE_SaveConfig(); - - if (event.GetId() == wxID_OK) - EndModal(wxID_OK); -} - -bool DSPConfigDialogLLE::SupportsVolumeChanges(std::string backend) -{ - //FIXME: this one should ask the backend whether it supports it. - // but getting the backend from string etc. is probably - // too much just to enable/disable a stupid slider... - return (backend == BACKEND_DIRECTSOUND || - backend == BACKEND_COREAUDIO || - backend == BACKEND_OPENAL || - backend == BACKEND_XAUDIO2 || - backend == BACKEND_PULSEAUDIO); -} - -void DSPConfigDialogLLE::BackendChanged(wxCommandEvent& event) -{ - m_volumeSlider->Enable(SupportsVolumeChanges(std::string(m_BackendSelection->GetStringSelection().mb_str()))); -} diff --git a/Source/Core/DolphinWX/Src/DSPLLEConfigDlg.h b/Source/Core/DolphinWX/Src/DSPLLEConfigDlg.h deleted file mode 100644 index d494481d44..0000000000 --- a/Source/Core/DolphinWX/Src/DSPLLEConfigDlg.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// 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, version 2.0. - -// 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 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __DSP_LLE_CONFIGDIALOG_h__ -#define __DSP_LLE_CONFIGDIALOG_h__ - -#include -#include -#include -#include - -#include "AudioCommon.h" - -class DSPConfigDialogLLE : public wxDialog -{ -public: - DSPConfigDialogLLE(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString &title = _("DSP-LLE Settings"), - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE); - virtual ~DSPConfigDialogLLE(); - void AddBackend(const char *backend); - void ClearBackends(); - -private: - DECLARE_EVENT_TABLE(); - - wxSlider *m_volumeSlider; - wxStaticText *m_volumeText; - wxButton *m_OK; - wxCheckBox *m_buttonEnableDTKMusic; - wxCheckBox *m_buttonEnableThrottle; - wxCheckBox *m_buttonEnableJIT; - wxArrayString wxArrayBackends; - wxChoice *m_BackendSelection; - - enum - { - ID_ENABLE_DTK_MUSIC, - ID_ENABLE_THROTTLE, - ID_ENABLE_JIT, - ID_BACKEND, - ID_VOLUME - }; - - void OnOK(wxCommandEvent& event); - void SettingsChanged(wxCommandEvent& event); - void VolumeChanged(wxScrollEvent& event); - bool SupportsVolumeChanges(std::string backend); - void BackendChanged(wxCommandEvent& event); -}; - -#endif //__DSP_LLE_CONFIGDIALOG_h__ diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 10818b2115..f5325ac16c 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -1061,15 +1061,10 @@ void CFrame::OnPluginGFX(wxCommandEvent& WXUNUSED (event)) void CFrame::OnPluginDSP(wxCommandEvent& WXUNUSED (event)) { - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE) { - DSPConfigDialogHLE *dlg = new DSPConfigDialogHLE(this); - dlg->ShowModal(); - dlg->Destroy(); - } else { - DSPConfigDialogLLE *dlg = new DSPConfigDialogLLE(this); - dlg->ShowModal(); - dlg->Destroy(); - } + CConfigMain ConfigMain(this); + ConfigMain.SetSelectedTab(CConfigMain::ID_AUDIOPAGE); + if (ConfigMain.ShowModal() == wxID_OK) + m_GameListCtrl->Update(); } void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event)) diff --git a/Source/Dolphin.sln b/Source/Dolphin.sln index 02ebf3dcbd..f65f9c7554 100644 --- a/Source/Dolphin.sln +++ b/Source/Dolphin.sln @@ -603,7 +603,9 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - AMDCaProjectFile = D:\Dev\Dolphin\trunk\Source\CodeAnalyst\Dolphin.caw + AMDCaPersistentConfig = Release|x64 + AMDCaPersistentStartup = Dolphin + AMDCaProjectFile = G:\Dolphin\Source\CodeAnalyst\Dolphin.caw EndGlobalSection GlobalSection(DPCodeReviewSolutionGUID) = preSolution DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}