From b3d8dd9a8a7027a017bd753178cf7adb0f8d7c0e Mon Sep 17 00:00:00 2001 From: spacy51 Date: Sun, 31 Aug 2008 20:03:39 +0000 Subject: [PATCH] ADDED gbSoundDeclicking option git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@675 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/win32/AudioCoreSettingsDlg.cpp | 12 ++++++++ src/win32/AudioCoreSettingsDlg.h | 3 ++ src/win32/MainWnd.cpp | 2 +- src/win32/MainWnd.h | 2 +- src/win32/MainWndOptions.cpp | 5 ++- src/win32/VBA.cpp | 4 +++ src/win32/VBA.rc | 49 +++++++++++++++--------------- src/win32/resource.h | 2 ++ 8 files changed, 52 insertions(+), 27 deletions(-) diff --git a/src/win32/AudioCoreSettingsDlg.cpp b/src/win32/AudioCoreSettingsDlg.cpp index 421ab862..94517dcf 100644 --- a/src/win32/AudioCoreSettingsDlg.cpp +++ b/src/win32/AudioCoreSettingsDlg.cpp @@ -12,8 +12,10 @@ AudioCoreSettingsDlg::AudioCoreSettingsDlg(CWnd* pParent /*=NULL*/) : CDialog(AudioCoreSettingsDlg::IDD, pParent) , m_enabled( false ) , m_surround( false ) + , m_declicking( false ) , m_echo( 0.0f ) , m_stereo( 0.0f ) + , m_volume( 0.0f ) , toolTip( NULL ) { } @@ -32,10 +34,12 @@ void AudioCoreSettingsDlg::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_ECHO, echo); DDX_Control(pDX, IDC_STEREO, stereo); DDX_Control(pDX, IDC_VOLUME, volume); + DDX_Control(pDX, IDC_DECLICKING, declicking); if( pDX->m_bSaveAndValidate == TRUE ) { m_enabled = BST_CHECKED == enhance_sound.GetCheck(); m_surround = BST_CHECKED == surround.GetCheck(); + m_declicking = BST_CHECKED == declicking.GetCheck(); m_echo = (float)echo.GetPos() / 100.0f; m_stereo = (float)stereo.GetPos() / 100.0f; m_volume = (float)volume.GetPos() / 100.0f; @@ -85,6 +89,11 @@ BOOL AudioCoreSettingsDlg::OnTtnNeedText(UINT id, NMHDR *pNMHDR, LRESULT *pResul _tcscpy_s( buf, _countof( buf ), res.GetString() ); t3->lpszText = buf; break; + case IDC_DECLICKING: + res.LoadString( IDS_TOOLTIP_DECLICKING ); + _tcscpy_s( buf, _countof( buf ), res.GetString() ); + t3->lpszText = buf; + break; default: i_provided_tooltip_with_text = FALSE; break; @@ -112,12 +121,15 @@ BOOL AudioCoreSettingsDlg::OnInitDialog() toolTip->AddTool( GetDlgItem( IDC_DEFAULT_VOLUME ) ); toolTip->AddTool( GetDlgItem( IDC_ENHANCE_SOUND ) ); toolTip->AddTool( GetDlgItem( IDC_SURROUND ) ); + toolTip->AddTool( GetDlgItem( IDC_DECLICKING ) ); toolTip->Activate( TRUE ); enhance_sound.SetCheck( m_enabled ? BST_CHECKED : BST_UNCHECKED ); surround.SetCheck( m_surround ? BST_CHECKED : BST_UNCHECKED ); + declicking.SetCheck( m_declicking ? BST_CHECKED : BST_UNCHECKED ); + echo.SetRange( 0, 100 ); echo.SetPos( (int)( m_echo * 100.0f ) ); diff --git a/src/win32/AudioCoreSettingsDlg.h b/src/win32/AudioCoreSettingsDlg.h index ac8f55f8..f1f9dd44 100644 --- a/src/win32/AudioCoreSettingsDlg.h +++ b/src/win32/AudioCoreSettingsDlg.h @@ -1,6 +1,7 @@ #pragma once #include "stdafx.h" +#include "afxwin.h" // AudioCoreSettingsDlg dialog @@ -12,6 +13,7 @@ class AudioCoreSettingsDlg : public CDialog public: bool m_enabled; bool m_surround; + bool m_declicking; float m_echo; float m_stereo; float m_volume; @@ -35,6 +37,7 @@ protected: private: CButton enhance_sound; CButton surround; + CButton declicking; CSliderCtrl echo; CSliderCtrl stereo; CSliderCtrl volume; diff --git a/src/win32/MainWnd.cpp b/src/win32/MainWnd.cpp index 57a5ba9f..80255d4f 100644 --- a/src/win32/MainWnd.cpp +++ b/src/win32/MainWnd.cpp @@ -423,7 +423,7 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd) ON_COMMAND(ID_OUTPUTAPI_XAUDIO2CONFIG, &MainWnd::OnOutputapiXaudio2config) ON_UPDATE_COMMAND_UI(ID_OUTPUTAPI_XAUDIO2CONFIG, &MainWnd::OnUpdateOutputapiXaudio2config) ON_WM_ENTERSIZEMOVE() - ON_COMMAND(ID_AUDIO_CORE_SETTINGS, &MainWnd::OnAudioEffects) + ON_COMMAND(ID_AUDIO_CORE_SETTINGS, &MainWnd::OnAudioCoreSettings) END_MESSAGE_MAP() diff --git a/src/win32/MainWnd.h b/src/win32/MainWnd.h index 0b60bd9a..00b9245d 100644 --- a/src/win32/MainWnd.h +++ b/src/win32/MainWnd.h @@ -388,5 +388,5 @@ public: DECLARE_MESSAGE_MAP() afx_msg void OnEnterSizeMove(); - afx_msg void OnAudioEffects(); + afx_msg void OnAudioCoreSettings(); }; diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp index e4c6379f..f51bb11d 100644 --- a/src/win32/MainWndOptions.cpp +++ b/src/win32/MainWndOptions.cpp @@ -800,7 +800,7 @@ void MainWnd::OnUpdateOptionsEmulatorBmpformat(CCmdUI* pCmdUI) pCmdUI->SetCheck(theApp.captureFormat == 1); } -void MainWnd::OnAudioEffects() +void MainWnd::OnAudioCoreSettings() { AudioCoreSettingsDlg dlg; @@ -809,6 +809,7 @@ void MainWnd::OnAudioEffects() dlg.m_echo = gb_effects_config.echo; dlg.m_stereo = gb_effects_config.stereo; dlg.m_volume = soundGetVolume(); + dlg.m_declicking = gbSoundGetDeclicking(); if( IDOK == dlg.DoModal() ) { gb_effects_config_t _new; @@ -821,6 +822,8 @@ void MainWnd::OnAudioEffects() gbSoundConfigEffects( _new ); soundSetVolume( dlg.m_volume ); + + gbSoundSetDeclicking( dlg.m_declicking ); } } diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 0b8b349e..9ef0c740 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -1595,6 +1595,8 @@ void VBA::loadSettings() gb_effects_config.echo = (float)regQueryDwordValue( "gbSoundEffectsEcho", 20 ) / 100.0f; gb_effects_config.stereo = (float)regQueryDwordValue( "gbSoundEffectsStereo", 15 ) / 100.0f; + gbSoundSetDeclicking( 1 == regQueryDwordValue( "gbSoundDeclicking", 1 ) ); + tripleBuffering = regQueryDwordValue("tripleBuffering", false) ? true : false; #ifndef NO_D3D @@ -2590,6 +2592,8 @@ void VBA::saveSettings() regSetDwordValue( "gbSoundEffectsEcho", (DWORD)( gb_effects_config.echo * 100.0f ) ); regSetDwordValue( "gbSoundEffectsStereo", (DWORD)( gb_effects_config.stereo * 100.0f ) ); + regSetDwordValue( "gbSoundDeclicking", gbSoundGetDeclicking() ? 1 : 0 ); + regSetDwordValue("tripleBuffering", tripleBuffering); #ifndef NO_D3D diff --git a/src/win32/VBA.rc b/src/win32/VBA.rc index c926e320..916a04bf 100644 --- a/src/win32/VBA.rc +++ b/src/win32/VBA.rc @@ -1167,30 +1167,30 @@ BEGIN RTEXT "Device:",IDC_STATIC,6,6,48,12 END -IDD_AUDIO_CORE_SETTINGS DIALOGEX 0, 0, 256, 144 +IDD_AUDIO_CORE_SETTINGS DIALOGEX 0, 0, 168, 211 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Audio Core Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "OK",IDOK,150,126,48,14 - PUSHBUTTON "Cancel",IDCANCEL,204,126,48,14 - GROUPBOX "Game Boy only",IDC_STATIC,6,6,126,114 - CONTROL "Enhance sound",IDC_ENHANCE_SOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,18,65,10 - CONTROL "Surround",IDC_SURROUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,30,45,10 - GROUPBOX "Echo",IDC_STATIC,24,42,102,36 - CONTROL "",IDC_ECHO,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,30,54,90,12 - LTEXT "None",IDC_STATIC,30,66,36,8,SS_CENTERIMAGE - RTEXT "Lots",IDC_STATIC,84,66,36,8,SS_CENTERIMAGE - GROUPBOX "Stereo",IDC_STATIC,24,78,102,36 - CONTROL "",IDC_STEREO,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,30,90,90,12 - LTEXT "Center",IDC_STATIC,30,102,36,8,SS_CENTERIMAGE - RTEXT "Left/Right",IDC_STATIC,84,102,36,8,SS_CENTERIMAGE - GROUPBOX "Game Boy Advance only",IDC_STATIC,138,6,114,114 - GROUPBOX "Volume",IDC_STATIC,144,18,102,42 - CONTROL "",IDC_VOLUME,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,150,30,90,12 - LTEXT "Mute",IDC_STATIC,150,42,18,12,SS_CENTERIMAGE - RTEXT "Max",IDC_STATIC,222,42,18,12,SS_CENTERIMAGE - PUSHBUTTON "Default",IDC_DEFAULT_VOLUME,174,42,42,12,BS_NOTIFY + DEFPUSHBUTTON "OK",IDOK,60,192,48,14 + PUSHBUTTON "Cancel",IDCANCEL,114,192,48,14 + GROUPBOX "Game Boy only",IDC_STATIC,6,54,156,132 + CONTROL "Enhance sound",IDC_ENHANCE_SOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,66,65,10 + CONTROL "Surround",IDC_SURROUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,78,45,10 + GROUPBOX "Echo",IDC_STATIC,24,102,132,36 + CONTROL "",IDC_ECHO,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,30,114,120,12 + LTEXT "None",IDC_STATIC,30,126,36,8,SS_CENTERIMAGE + RTEXT "Lots",IDC_STATIC,114,126,36,8,SS_CENTERIMAGE + GROUPBOX "Stereo",IDC_STATIC,24,144,132,36 + CONTROL "",IDC_STEREO,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,30,156,120,12 + LTEXT "Center",IDC_STATIC,30,168,36,8,SS_CENTERIMAGE + RTEXT "Left/Right",IDC_STATIC,114,168,36,8,SS_CENTERIMAGE + GROUPBOX "Volume",IDC_STATIC,6,6,156,42 + CONTROL "",IDC_VOLUME,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,12,18,144,12 + LTEXT "Mute",IDC_STATIC,12,30,48,12,SS_CENTERIMAGE + RTEXT "Maximum",IDC_STATIC,108,30,48,12,SS_CENTERIMAGE + PUSHBUTTON "Default",IDC_DEFAULT_VOLUME,66,30,36,12,BS_NOTIFY + CONTROL "Declicking",IDC_DECLICKING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,90,47,10 END @@ -1546,9 +1546,9 @@ BEGIN IDD_AUDIO_CORE_SETTINGS, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 249 + RIGHTMARGIN, 161 TOPMARGIN, 7 - BOTTOMMARGIN, 137 + BOTTOMMARGIN, 204 END END #endif // APSTUDIO_INVOKED @@ -1835,15 +1835,14 @@ BEGIN BEGIN POPUP "&Throttle" BEGIN + MENUITEM "No throttle", ID_OPTIONS_FRAMESKIP_THROTTLE_NOTHROTTLE MENUITEM "25%", ID_OPTIONS_FRAMESKIP_THROTTLE_25 MENUITEM "50%", ID_OPTIONS_FRAMESKIP_THROTTLE_50 MENUITEM "100%", ID_OPTIONS_FRAMESKIP_THROTTLE_100 MENUITEM "150%", ID_OPTIONS_FRAMESKIP_THROTTLE_150 MENUITEM "200%", ID_OPTIONS_FRAMESKIP_THROTTLE_200 MENUITEM "&Other...", ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER - MENUITEM "No throttle", ID_OPTIONS_FRAMESKIP_THROTTLE_NOTHROTTLE END - MENUITEM SEPARATOR POPUP "&Frame Skip" BEGIN MENUITEM "&No frame skip", ID_OPTIONS_VIDEO_FRAMESKIP_0 @@ -1857,6 +1856,7 @@ BEGIN MENUITEM "&8 frames", ID_OPTIONS_VIDEO_FRAMESKIP_8 MENUITEM "&9 frames", ID_OPTIONS_VIDEO_FRAMESKIP_9 END + MENUITEM SEPARATOR MENUITEM "Turbo mode", ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE END MENUITEM SEPARATOR @@ -2220,6 +2220,7 @@ BEGIN IDS_TOOLTIP_DEFAULT_VOLUME "Reset to default volume (100%)." IDS_TOOLTIP_ENHANCE_SOUND "Enable the following sound enhancements." IDS_TOOLTIP_SURROUND "Inverts the phase of some channels, making it sound as if sound is coming from behind." + IDS_TOOLTIP_DECLICKING "When enabled, clicks are reduced by using GBA sound hardware. Note that clicks are normal for GB and GBC sound hardware." END STRINGTABLE diff --git a/src/win32/resource.h b/src/win32/resource.h index 648abe8e..35fbe740 100644 --- a/src/win32/resource.h +++ b/src/win32/resource.h @@ -49,6 +49,7 @@ #define IDS_UNSUPPORTED_GAMESHARK_CODE 43 #define IDS_TOOLTIP_ENHANCE_SOUND 43 #define IDS_TOOLTIP_SURROUND 44 +#define IDS_TOOLTIP_DECLICKING 45 #define IDI_MAINICON 101 #define IDD_REGISTERS 102 #define IDD_DEBUG 103 @@ -550,6 +551,7 @@ #define IDC_SLIDER2 1291 #define IDC_VOLUME 1291 #define IDC_DEFAULT_VOLUME 1292 +#define IDC_DECLICKING 1293 #define IDS_OAL_NODEVICE 2000 #define IDS_OAL_NODLL 2001 #define IDS_AVI_CANNOT_CREATE_AVI 2002