diff --git a/project/vc2008_mfc/VBA2008.vcproj b/project/vc2008_mfc/VBA2008.vcproj
index 6c07343d..5a00efb7 100644
--- a/project/vc2008_mfc/VBA2008.vcproj
+++ b/project/vc2008_mfc/VBA2008.vcproj
@@ -248,6 +248,10 @@
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
+
+
@@ -952,6 +956,10 @@
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
+
+
@@ -1499,7 +1507,7 @@
diff --git a/src/dmg/gbSound.h b/src/dmg/gbSound.h
index 62402aa4..d37f4935 100644
--- a/src/dmg/gbSound.h
+++ b/src/dmg/gbSound.h
@@ -17,6 +17,9 @@
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef GBSOUND_H
+#define GBSOUND_H
+
#define NR10 0xff10
#define NR11 0xff11
#define NR12 0xff12
@@ -72,3 +75,5 @@ struct gb_effects_config_t
// Changes effects configuration
void gbSoundConfigEffects( gb_effects_config_t const& );
extern gb_effects_config_t gb_effects_config; // current configuration
+
+#endif
diff --git a/src/win32/AudioEffectsDlg.cpp b/src/win32/AudioEffectsDlg.cpp
new file mode 100644
index 00000000..52b667d8
--- /dev/null
+++ b/src/win32/AudioEffectsDlg.cpp
@@ -0,0 +1,70 @@
+// ..\..\src\win32\AudioEffectsDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "AudioEffectsDlg.h"
+
+// Has to be in int range!
+#define SLIDER_RESOLUTION ( 100 )
+// We do everything in percents.
+
+
+// AudioEffectsDlg dialog
+
+IMPLEMENT_DYNAMIC(AudioEffectsDlg, CDialog)
+
+AudioEffectsDlg::AudioEffectsDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(AudioEffectsDlg::IDD, pParent)
+ , m_enabled( false )
+ , m_surround( false )
+ , m_echo( 0.0f )
+ , m_stereo( 0.0f )
+{
+}
+
+AudioEffectsDlg::~AudioEffectsDlg()
+{
+}
+
+void AudioEffectsDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+
+ CButton *enhance_sound = (CButton *)GetDlgItem( IDC_ENHANCE_SOUND );
+ CButton *surround = (CButton * )GetDlgItem( IDC_SURROUND );
+ CSliderCtrl *echo = (CSliderCtrl *)GetDlgItem( IDC_ECHO );
+ CSliderCtrl *stereo = (CSliderCtrl *)GetDlgItem( IDC_STEREO );
+
+ if( pDX->m_bSaveAndValidate == TRUE ) {
+ m_enabled = BST_CHECKED == enhance_sound->GetCheck();
+ m_surround = BST_CHECKED == surround->GetCheck();
+ m_echo = (float)echo->GetPos() / (float)SLIDER_RESOLUTION;
+ m_stereo = (float)stereo->GetPos() / (float)SLIDER_RESOLUTION;
+ } else {
+ enhance_sound->SetCheck( m_enabled ? BST_CHECKED : BST_UNCHECKED );
+ surround->SetCheck( m_surround ? BST_CHECKED : BST_UNCHECKED );
+ echo->SetPos( (int)( m_echo * (float)SLIDER_RESOLUTION ) );
+ stereo->SetPos( (int)( m_stereo * (float)SLIDER_RESOLUTION ) );
+ }
+}
+
+
+BEGIN_MESSAGE_MAP(AudioEffectsDlg, CDialog)
+END_MESSAGE_MAP()
+
+
+// AudioEffectsDlg message handlers
+
+BOOL AudioEffectsDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ CSliderCtrl *echo = (CSliderCtrl *)GetDlgItem( IDC_ECHO );
+ echo->SetRange( 0, SLIDER_RESOLUTION );
+
+ CSliderCtrl *stereo = (CSliderCtrl *)GetDlgItem( IDC_STEREO );
+ stereo->SetRange( 0, SLIDER_RESOLUTION );
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
diff --git a/src/win32/AudioEffectsDlg.h b/src/win32/AudioEffectsDlg.h
new file mode 100644
index 00000000..a4befc2b
--- /dev/null
+++ b/src/win32/AudioEffectsDlg.h
@@ -0,0 +1,28 @@
+#pragma once
+
+
+// AudioEffectsDlg dialog
+
+class AudioEffectsDlg : public CDialog
+{
+ DECLARE_DYNAMIC(AudioEffectsDlg)
+
+public:
+ bool m_enabled;
+ bool m_surround;
+ float m_echo;
+ float m_stereo;
+
+ AudioEffectsDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~AudioEffectsDlg();
+
+// Dialog Data
+ enum { IDD = IDD_AUDIO_EFFECTS };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+public:
+ virtual BOOL OnInitDialog();
+};
diff --git a/src/win32/MainWnd.cpp b/src/win32/MainWnd.cpp
index 5f2ea77b..7fb32ab6 100644
--- a/src/win32/MainWnd.cpp
+++ b/src/win32/MainWnd.cpp
@@ -437,6 +437,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_EFFECTS, &MainWnd::OnAudioEffects)
END_MESSAGE_MAP()
diff --git a/src/win32/MainWnd.h b/src/win32/MainWnd.h
index c1ad10d7..6f28eae3 100644
--- a/src/win32/MainWnd.h
+++ b/src/win32/MainWnd.h
@@ -402,4 +402,5 @@ public:
DECLARE_MESSAGE_MAP()
afx_msg void OnEnterSizeMove();
+ afx_msg void OnAudioEffects();
};
diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp
index e1785947..91f399dc 100644
--- a/src/win32/MainWndOptions.cpp
+++ b/src/win32/MainWndOptions.cpp
@@ -17,6 +17,7 @@
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
+#include "VBA.h"
#include "MainWnd.h"
#include "Associate.h"
@@ -35,6 +36,7 @@
#include "OALConfig.h"
#include "XAudio2_Config.h"
#include "BIOSDialog.h"
+#include "AudioEffectsDlg.h"
#include "../System.h"
#include "../agb/agbprint.h"
@@ -44,13 +46,11 @@
#include "../dmg/GB.h"
#include "../dmg/gbGlobals.h"
#include "../dmg/gbPrinter.h"
+#include "../dmg/gbSound.h"
#include "../agb/GBALink.h"
+
#include
-extern int emulating;
-
-extern void CPUUpdateRenderBuffers(bool force);
-
void MainWnd::OnOptionsFrameskipThrottleNothrottle()
{
@@ -821,6 +821,27 @@ void MainWnd::OnUpdateOptionsSoundEcho(CCmdUI* pCmdUI)
pCmdUI->SetCheck(soundEcho);
}
+void MainWnd::OnAudioEffects()
+{
+ AudioEffectsDlg dlg;
+
+ dlg.m_enabled = gb_effects_config.enabled;
+ dlg.m_surround = gb_effects_config.surround;
+ dlg.m_echo = gb_effects_config.echo;
+ dlg.m_stereo = gb_effects_config.stereo;
+
+ if( IDOK == dlg.DoModal() ) {
+ gb_effects_config_t _new;
+
+ _new.enabled = dlg.m_enabled;
+ _new.surround = dlg.m_surround;
+ _new.echo = dlg.m_echo;
+ _new.stereo = dlg.m_stereo;
+
+ gbSoundConfigEffects( _new );
+ }
+}
+
void MainWnd::OnOptionsSoundLowpassfilter()
{
soundLowPass = !soundLowPass;
diff --git a/src/win32/VBA.rc b/src/win32/VBA.rc
index 96e96ce4..918513b6 100644
--- a/src/win32/VBA.rc
+++ b/src/win32/VBA.rc
@@ -1167,6 +1167,26 @@ BEGIN
RTEXT "Device:",IDC_STATIC,6,6,48,12
END
+IDD_AUDIO_EFFECTS DIALOGEX 0, 0, 136, 144
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Audio Effects"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,30,126,48,14
+ PUSHBUTTON "Cancel",IDCANCEL,84,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,90,12
+ CONTROL "Surround",IDC_SURROUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,30,90,12
+ GROUPBOX "Echo",IDC_STATIC,24,42,102,36
+ CONTROL "",IDC_ECHO,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | 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 | 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
+END
+
/////////////////////////////////////////////////////////////////////////////
//
@@ -1516,6 +1536,14 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 89
END
+
+ IDD_AUDIO_EFFECTS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 129
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 137
+ END
END
#endif // APSTUDIO_INVOKED
@@ -1769,6 +1797,7 @@ BEGIN
END
MENUITEM SEPARATOR
MENUITEM "&Echo", ID_OPTIONS_SOUND_ECHO
+ MENUITEM "Effects...", ID_AUDIO_EFFECTS
MENUITEM SEPARATOR
POPUP "Sound Channels"
BEGIN
diff --git a/src/win32/resource.h b/src/win32/resource.h
index e1f4ae4f..9051038c 100644
--- a/src/win32/resource.h
+++ b/src/win32/resource.h
@@ -101,6 +101,7 @@
#define IDD_BIOS 161
#define IDD_FULLSCREEN 162
#define IDD_XAUDIO2_CONFIG 163
+#define IDD_AUDIO_EFFECTS 164
#define IDC_R0 1000
#define IDC_EDIT_UP 1000
#define IDC_R1 1001
@@ -536,9 +537,14 @@
#define IDC_CHECK1 1284
#define IDC_ALWAYSLASTROMDIR 1284
#define IDC_CHECK_UPMIX 1284
+#define IDC_ENHANCE_SOUND 1284
#define IDC_COMBO_DEV 1285
#define IDC_SLIDER_BUFFER 1286
#define IDC_INFO_BUFFER 1287
+#define IDC_SURROUND 1288
+#define IDC_ECHO 1289
+#define IDC_STEREO 1290
+#define IDC_SLIDER2 1291
#define IDS_OAL_NODEVICE 2000
#define IDS_OAL_NODLL 2001
#define IDS_AVI_CANNOT_CREATE_AVI 2002
@@ -858,14 +864,15 @@
#define ID_LOADGAME_DONOTCHANGEBATTERYSAVE 40362
#define ID_OUTPUTAPI_CONFIGURATION40363 40363
#define ID_OUTPUTAPI_XAUDIO2CONFIG 40364
+#define ID_AUDIO_EFFECTS 40365
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 164
-#define _APS_NEXT_COMMAND_VALUE 40365
-#define _APS_NEXT_CONTROL_VALUE 1288
+#define _APS_NEXT_RESOURCE_VALUE 165
+#define _APS_NEXT_COMMAND_VALUE 40366
+#define _APS_NEXT_CONTROL_VALUE 1292
#define _APS_NEXT_SYMED_VALUE 103
#endif
#endif