From f1e8b46c6c3aa0f4f4d3226bd30d8db372179dd5 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Fri, 21 Nov 2008 02:53:54 +0000 Subject: [PATCH] Added Enable Other Audio option to DSP HLE git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1233 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DebuggerWX/Src/CodeWindow.cpp | 2 +- .../Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj | 4 +++ Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp | 19 +++++++---- Source/Plugins/Plugin_DSP_HLE/Src/Config.h | 1 + .../Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp | 17 ++++++++++ Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h | 4 +++ .../Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp | 7 +++- Source/Plugins/Plugin_DSP_HLE/Src/resource.h | 3 +- Source/Plugins/Plugin_DSP_HLE/Src/resource.rc | 32 ++++++++++--------- 9 files changed, 63 insertions(+), 26 deletions(-) diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index 8f819925fc..4c0a65f6c0 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -314,7 +314,7 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart GetHandle(), _LocalCoreStartupParameter.m_strVideoPlugin.c_str(), true, true - ); + ); } // don't have any else, just ignore it } diff --git a/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj b/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj index f3cae662c3..1f21cb99b5 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj +++ b/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj @@ -870,5 +870,9 @@ + diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp index c5de36e138..734cea624f 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp @@ -43,33 +43,38 @@ void CConfig::Load() IniFile file; file.Load(FULL_CONFIG_DIR "DSP.ini"); - file.Get("Config", "EnableHLEAudio", &m_EnableHLEAudio, true); + file.Get("Config", "EnableHLEAudio", &m_EnableHLEAudio, true); // Sound Settings file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true); + file.Get("Config", "EnableThrottle", &m_EnableThrottle, true); file.Get("Config", "Interpolation", &m_Interpolation, true); - file.Get("Config", "DumpSamples", &m_DumpSamples, false); + file.Get("Config", "AntiGap", &m_AntiGap, false); + + file.Get("Config", "DumpSamples", &m_DumpSamples, false); // Sample Dumping file.Get("Config", "DumpSampleMinLength", &m_DumpSampleMinLength, true); #ifdef _WIN32 file.Get("Config", "DumpSamplePath", &m_szSamplePath, "C:\\"); #else file.Get("Config", "DumpSamplePath", &m_szSamplePath, "/dev/null/"); -#endif - file.Get("Config", "AntiGap", &m_AntiGap, false); +#endif } void CConfig::Save() { IniFile file; file.Load(FULL_CONFIG_DIR "DSP.ini"); - file.Set("Config", "EnableHLEAudio", m_EnableHLEAudio); + file.Set("Config", "EnableHLEAudio", m_EnableHLEAudio); // Sound Settings file.Set("Config", "EnableDTKMusic", m_EnableDTKMusic); + file.Set("Config", "EnableThrottle", m_EnableThrottle); file.Set("Config", "Interpolation", m_Interpolation); - file.Set("Config", "DumpSamples", m_DumpSamples); + file.Set("Config", "AntiGap", m_AntiGap); + + file.Set("Config", "DumpSamples", m_DumpSamples); // Sample Dumping file.Set("Config", "DumpSampleMinLength", m_DumpSampleMinLength); #ifdef _WIN32 file.Set("Config", "DumpSamplePath", m_szSamplePath); #else file.Set("Config", "DumpSamplePath", m_szSamplePath); #endif - file.Set("Config", "AntiGap", m_AntiGap); + file.Save(FULL_CONFIG_DIR "DSP.ini"); } diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Config.h b/Source/Plugins/Plugin_DSP_HLE/Src/Config.h index 6ee9b31895..ceab47c6e0 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Config.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Config.h @@ -25,6 +25,7 @@ struct CConfig bool m_AntiGap; bool m_EnableHLEAudio; bool m_EnableDTKMusic; + bool m_EnableThrottle; bool m_Interpolation; bool m_DumpSamples; std::string m_szSamplePath; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp index 2dca38c5c1..ebc901ef45 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp @@ -23,18 +23,26 @@ LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { + // Load config settings g_Config.Load(); + + // Center window //CenterWindow(this->GetParent()); CenterWindow(GetParent()); + + // Get button handles m_buttonEnableHLEAudio = GetDlgItem(IDC_ENABLE_HLE_AUDIO); m_buttonEnableDTKMusic = GetDlgItem(IDC_ENABLE_DTK_MUSIC); + m_buttonEnableThrottle = GetDlgItem(IDC_ENABLE_THROTTLE); m_buttonAntiGap = GetDlgItem(IDC_ANTIGAP); m_buttonDumpSamples = GetDlgItem(IDC_DUMPSAMPLES); m_editDumpSamplePath = GetDlgItem(IDC_SAMPLEDUMPPATH); m_comboSampleRate = GetDlgItem(IDC_SAMPLERATE); + // Update checkboxes m_buttonEnableHLEAudio.SetCheck(g_Config.m_EnableHLEAudio ? BST_CHECKED : BST_UNCHECKED); m_buttonEnableDTKMusic.SetCheck(g_Config.m_EnableDTKMusic ? BST_CHECKED : BST_UNCHECKED); + m_buttonEnableThrottle.SetCheck(g_Config.m_EnableThrottle ? BST_CHECKED : BST_UNCHECKED); m_buttonAntiGap.SetCheck(g_Config.m_AntiGap ? BST_CHECKED : BST_UNCHECKED); m_buttonDumpSamples.SetCheck(g_Config.m_DumpSamples ? BST_CHECKED : BST_UNCHECKED); m_editDumpSamplePath.SetWindowText(g_Config.m_szSamplePath.c_str()); @@ -49,10 +57,12 @@ CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BO LRESULT CConfigDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { + // Save settings if (wID == IDOK) { g_Config.m_EnableHLEAudio = (m_buttonEnableHLEAudio.GetCheck() == BST_CHECKED) ? true : false; g_Config.m_EnableDTKMusic = (m_buttonEnableDTKMusic.GetCheck() == BST_CHECKED) ? true : false; + g_Config.m_EnableThrottle = (m_buttonEnableThrottle.GetCheck() == BST_CHECKED) ? true : false; g_Config.m_DumpSamples = (m_buttonDumpSamples.GetCheck() == BST_CHECKED) ? true : false; g_Config.m_AntiGap = (m_buttonAntiGap.GetCheck() == BST_CHECKED) ? true : false; char temp[MAX_PATH]; @@ -68,3 +78,10 @@ CConfigDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& / } + +LRESULT CConfigDlg::OnBnClickedEnableSpeedThrottle(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) +{ + // TODO: Add your control notification handler code here + + return 0; +} diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h index c170a68d6e..2721241b23 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h @@ -28,12 +28,14 @@ class CConfigDlg MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) COMMAND_ID_HANDLER(IDOK, OnCloseCmd) COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd) + COMMAND_HANDLER(IDC_ENABLE_SPEED_THROTTLE, BN_CLICKED, OnBnClickedEnableSpeedThrottle) END_MSG_MAP() private: CButton m_buttonEnableHLEAudio; CButton m_buttonEnableDTKMusic; + CButton m_buttonEnableThrottle; CButton m_buttonDumpSamples; CButton m_buttonAntiGap; CEdit m_editDumpSamplePath; @@ -46,4 +48,6 @@ class CConfigDlg LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/); +public: + LRESULT OnBnClickedEnableSpeedThrottle(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); }; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp index 1aa29923b8..d91d74b1ba 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp @@ -21,6 +21,7 @@ #include "../Config.h" #include "../Globals.h" #include "../DSPHandler.h" +#include "../Logging/Console.h" #include "Thread.h" #include "Mixer.h" #include "FixedSizeQueue.h" @@ -99,12 +100,16 @@ void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate) { static int acc=0; #ifdef _WIN32 - if (!GetAsyncKeyState(VK_TAB)) { + if (! (GetAsyncKeyState(VK_TAB)) && g_Config.m_EnableThrottle) { + + /* This is only needed for non-AX sound, currently directly streamed and + DTK sound. For AX we call DSound_UpdateSound in AXTask() for example. */ while (queue_size > queue_maxlength / 2) { DSound::DSound_UpdateSound(); Sleep(0); } } else { + wprintf("Tab"); return; } #else diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/resource.h b/Source/Plugins/Plugin_DSP_HLE/Src/resource.h index 347fa0133d..57e2a2ba0f 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/resource.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/resource.h @@ -9,14 +9,13 @@ #define IDC_SAMPLERATE 1001 #define IDC_EDIT1 1002 #define IDC_SAMPLEDUMPPATH 1002 -//#define IDC_CHECK1 1003 // these conflicted with CDebugger #define IDC_ENABLE_AUDIO 1003 #define IDC_ENABLE_HLE_AUDIO 1003 -//#define IDC_CHECK2 1004 #define IDC_ENABLE_DTK_MUSIC 1004 #define IDC_DUMPSAMPLES 1005 #define IDC_SAMPLEMINLENGTH 1006 #define IDC_BROWSE 1007 +#define IDC_ENABLE_THROTTLE 1008 #define IDC_ANTIGAP 1009 #define IDC_CHECK3 1010 diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/resource.rc b/Source/Plugins/Plugin_DSP_HLE/Src/resource.rc index 33bc63a084..62d2fb27e8 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/resource.rc +++ b/Source/Plugins/Plugin_DSP_HLE/Src/resource.rc @@ -52,24 +52,26 @@ END // Dialog // -IDD_SETTINGS DIALOGEX 0, 0, 241, 138 +IDD_SETTINGS DIALOGEX 0, 0, 281, 147 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dolphin DSP-HLE Plugin Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "OK",IDOK,129,116,50,14 - PUSHBUTTON "Cancel",IDCANCEL,184,116,50,14 - GROUPBOX "&Sound settings",IDC_STATIC,7,7,227,45 - EDITTEXT IDC_SAMPLEDUMPPATH,13,89,155,13,ES_AUTOHSCROLL | WS_DISABLED + DEFPUSHBUTTON "OK",IDOK,171,126,50,14 + PUSHBUTTON "Cancel",IDCANCEL,225,126,50,14 + GROUPBOX "&Sound settings",IDC_STATIC,7,7,267,57 + EDITTEXT IDC_SAMPLEDUMPPATH,13,99,192,13,ES_AUTOHSCROLL | WS_DISABLED CONTROL "&Enable HLE Audio",IDC_ENABLE_HLE_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,22,84,8 - GROUPBOX "Sample d&umping",IDC_STATIC,7,59,227,51 + GROUPBOX "Sample d&umping",IDC_STATIC,7,69,267,51 CONTROL "Enab&le DTK Music",IDC_ENABLE_DTK_MUSIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,36,102,8 - CONTROL "&Dump all samples longer than",IDC_DUMPSAMPLES,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,13,73,105,9 - EDITTEXT IDC_SAMPLEMINLENGTH,122,71,47,12,ES_AUTOHSCROLL | WS_DISABLED - LTEXT "seconds to:",IDC_STATIC,173,73,40,10 - PUSHBUTTON "&Browse...",IDC_BROWSE,173,89,54,14 - CONTROL "&Anti-gap (dangerous!)",IDC_ANTIGAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,22,96,9 - CONTROL "&Reverb",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,122,36,89,10 + CONTROL "&Dump all samples longer than",IDC_DUMPSAMPLES,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,13,83,105,9 + EDITTEXT IDC_SAMPLEMINLENGTH,122,80,47,12,ES_AUTOHSCROLL | WS_DISABLED + LTEXT "seconds to:",IDC_STATIC,173,83,40,10 + PUSHBUTTON "&Browse...",IDC_BROWSE,213,99,54,14 + CONTROL "&Anti-gap (dangerous!)",IDC_ANTIGAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,22,96,9 + CONTROL "&Reverb",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,147,36,89,10 + CONTROL "Enable Other Audio (Speed Throttle)",IDC_ENABLE_THROTTLE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,50,132,10 END IDD_ABOUT DIALOGEX 0, 0, 184, 65 @@ -94,12 +96,12 @@ BEGIN IDD_SETTINGS, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 234 + RIGHTMARGIN, 274 VERTGUIDE, 13 - VERTGUIDE, 122 + VERTGUIDE, 147 VERTGUIDE, 168 TOPMARGIN, 7 - BOTTOMMARGIN, 131 + BOTTOMMARGIN, 140 HORZGUIDE, 31 END