ADDED soundInterpolation & soundFiltering options to audio core settings dialog

CHANGED soundInterpolation type from int to bool
REMOVED soundInterpolation settings from menu
This commit is contained in:
spacy51 2008-08-31 21:54:57 +00:00
parent 5fb91e0a92
commit c599c978f1
10 changed files with 64 additions and 74 deletions

View File

@ -59,11 +59,11 @@ int const SOUND_CLOCK_TICKS_ = 167772; // 1/100 second
u16 soundFinalWave [1470];
int soundBufferLen = sizeof soundFinalWave;
int soundQuality = 2;
int soundInterpolation = 0;
int soundQuality = 1;
bool soundInterpolation = true;
bool soundPaused = true;
float soundFiltering = 1;
float soundVolume = 1;
float soundFiltering = 0.5f;
float soundVolume = 1.0f;
bool soundEcho = false;
int SOUND_CLOCK_TICKS = SOUND_CLOCK_TICKS_;
int soundTicks = SOUND_CLOCK_TICKS_;

View File

@ -45,8 +45,8 @@ void soundSetQuality( int quality );
extern int soundQuality; // current sound quality
// Sound settings
extern int soundInterpolation; // 1 if PCM should have low-pass filtering
extern float soundFiltering; // 0.0 = none, 1.0 = max (only if soundInterpolation is 1)
extern bool soundInterpolation; // 1 if PCM should have low-pass filtering
extern float soundFiltering; // 0.0 = none, 1.0 = max
//// GBA sound emulation

View File

@ -13,9 +13,11 @@ AudioCoreSettingsDlg::AudioCoreSettingsDlg(CWnd* pParent /*=NULL*/)
, m_enabled( false )
, m_surround( false )
, m_declicking( false )
, m_sound_interpolation( false )
, m_echo( 0.0f )
, m_stereo( 0.0f )
, m_volume( 0.0f )
, m_sound_filtering( 0.0f )
, toolTip( NULL )
{
}
@ -35,14 +37,18 @@ void AudioCoreSettingsDlg::DoDataExchange(CDataExchange* pDX)
DDX_Control(pDX, IDC_STEREO, stereo);
DDX_Control(pDX, IDC_VOLUME, volume);
DDX_Control(pDX, IDC_DECLICKING, declicking);
DDX_Control(pDX, IDC_SOUND_INTERPOLATION, sound_interpolation);
DDX_Control(pDX, IDC_SOUND_FILTERING, sound_filtering);
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_sound_interpolation = BST_CHECKED == sound_interpolation.GetCheck();
m_echo = (float)echo.GetPos() / 100.0f;
m_stereo = (float)stereo.GetPos() / 100.0f;
m_volume = (float)volume.GetPos() / 100.0f;
m_sound_filtering = (float)sound_filtering.GetPos() / 100.0f;
}
}
@ -74,6 +80,9 @@ BOOL AudioCoreSettingsDlg::OnTtnNeedText(UINT id, NMHDR *pNMHDR, LRESULT *pResul
case IDC_STEREO:
_stprintf_s( t3->szText, _countof( t3->szText ), _T( "%i%%" ), stereo.GetPos() );
break;
case IDC_SOUND_FILTERING:
_stprintf_s( t3->szText, _countof( t3->szText ), _T( "%i%%" ), sound_filtering.GetPos() );
break;
case IDC_DEFAULT_VOLUME:
res.LoadString( IDS_TOOLTIP_DEFAULT_VOLUME );
_tcscpy_s( buf, _countof( buf ), res.GetString() );
@ -130,12 +139,17 @@ BOOL AudioCoreSettingsDlg::OnInitDialog()
declicking.SetCheck( m_declicking ? BST_CHECKED : BST_UNCHECKED );
sound_interpolation.SetCheck( m_sound_interpolation ? BST_CHECKED : BST_UNCHECKED );
echo.SetRange( 0, 100 );
echo.SetPos( (int)( m_echo * 100.0f ) );
stereo.SetRange( 0, 100 );
stereo.SetPos( (int)( m_stereo * 100.0f ) );
sound_filtering.SetRange( 0, 100 );
sound_filtering.SetPos( (int)( m_sound_filtering * 100.0f ) );
volume.SetRange( (int)( MIN_VOLUME * 100.0f ), (int)( MAX_VOLUME * 100.0f ) );
volume.SetPos( (int)( m_volume * 100.0f ) );

View File

@ -2,6 +2,7 @@
#include "stdafx.h"
#include "afxwin.h"
#include "afxcmn.h"
// AudioCoreSettingsDlg dialog
@ -14,9 +15,11 @@ public:
bool m_enabled;
bool m_surround;
bool m_declicking;
bool m_sound_interpolation;
float m_echo;
float m_stereo;
float m_volume;
float m_sound_filtering;
AudioCoreSettingsDlg(CWnd* pParent = NULL); // standard constructor
virtual ~AudioCoreSettingsDlg();
@ -38,8 +41,10 @@ private:
CButton enhance_sound;
CButton surround;
CButton declicking;
CButton sound_interpolation;
CSliderCtrl echo;
CSliderCtrl stereo;
CSliderCtrl volume;
CSliderCtrl sound_filtering;
CToolTipCtrl *toolTip;
};

View File

@ -398,8 +398,6 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN1280X1024, OnUpdateOptionsVideoFullscreen1280x1024)
ON_COMMAND(ID_OPTIONS_FILTER_LCDCOLORS, OnOptionsFilterLcdcolors)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_FILTER_LCDCOLORS, OnUpdateOptionsFilterLcdcolors)
ON_COMMAND_EX_RANGE(ID_OPTIONS_SOUND_PCMINTERPOLATION_NONE, ID_OPTIONS_SOUND_PCMINTERPOLATION_LIBRESAMPLE, OnOptionsSoundPcminterpolation)
ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_SOUND_PCMINTERPOLATION_NONE, ID_OPTIONS_SOUND_PCMINTERPOLATION_LIBRESAMPLE, OnUpdateOptionsSoundPcminterpolation)
ON_COMMAND(ID_OUTPUTAPI_DIRECTSOUND, &MainWnd::OnOutputapiDirectsound)
ON_UPDATE_COMMAND_UI(ID_OUTPUTAPI_DIRECTSOUND, &MainWnd::OnUpdateOutputapiDirectsound)
ON_COMMAND(ID_OUTPUTAPI_OPENAL, &MainWnd::OnOutputapiOpenal)

View File

@ -341,8 +341,6 @@ public:
afx_msg BOOL OnFileSaveSlot(UINT nID);
afx_msg void OnOptionsFilterLcdcolors();
afx_msg void OnUpdateOptionsFilterLcdcolors(CCmdUI *pCmdUI);
afx_msg BOOL OnOptionsSoundPcminterpolation(UINT nID);
afx_msg void OnUpdateOptionsSoundPcminterpolation(CCmdUI *pCmdUI);
afx_msg void OnOptionsSoundHardwareacceleration();
afx_msg void OnUpdateOptionsSoundHardwareacceleration(CCmdUI *pCmdUI);
afx_msg void OnOptionsVideoFullscreen1280x1024();

View File

@ -810,6 +810,8 @@ void MainWnd::OnAudioCoreSettings()
dlg.m_stereo = gb_effects_config.stereo;
dlg.m_volume = soundGetVolume();
dlg.m_declicking = gbSoundGetDeclicking();
dlg.m_sound_interpolation = soundInterpolation;
dlg.m_sound_filtering = soundFiltering;
if( IDOK == dlg.DoModal() ) {
gb_effects_config_t _new;
@ -824,6 +826,10 @@ void MainWnd::OnAudioCoreSettings()
soundSetVolume( dlg.m_volume );
gbSoundSetDeclicking( dlg.m_declicking );
soundInterpolation = dlg.m_sound_interpolation;
soundFiltering = dlg.m_sound_filtering;
}
}
@ -963,41 +969,6 @@ void MainWnd::OnUpdateOptionsSoundDirectsoundb(CCmdUI* pCmdUI)
pCmdUI->Enable(theApp.cartridgeType == 0);
}
BOOL MainWnd::OnOptionsSoundPcminterpolation(UINT nID)
{
switch (nID)
{
case ID_OPTIONS_SOUND_PCMINTERPOLATION_NONE:
soundInterpolation = 0;
break;
case ID_OPTIONS_SOUND_PCMINTERPOLATION_LINEAR:
soundInterpolation = 1;
break;
default:
return FALSE;
}
return TRUE;
}
void MainWnd::OnUpdateOptionsSoundPcminterpolation(CCmdUI *pCmdUI)
{
switch (pCmdUI->m_nID)
{
case ID_OPTIONS_SOUND_PCMINTERPOLATION_NONE:
pCmdUI->SetCheck(soundInterpolation == 0);
break;
case ID_OPTIONS_SOUND_PCMINTERPOLATION_LINEAR:
pCmdUI->SetCheck(soundInterpolation == 1);
break;
default:
return;
}
pCmdUI->Enable(theApp.cartridgeType == 0);
}
void MainWnd::OnOptionsGameboyBorder()
{
theApp.winGbBorderOn = !theApp.winGbBorderOn;

View File

@ -1586,10 +1586,6 @@ void VBA::loadSettings()
soundSetVolume( (float)(regQueryDwordValue("soundVolume", 100)) / 100.0f );
soundInterpolation = regQueryDwordValue("soundInterpolation", 0);
if(soundInterpolation < 0 || soundInterpolation > 1)
soundInterpolation = 0;
gb_effects_config.enabled = 1 == regQueryDwordValue( "gbSoundEffectsEnabled", 0 );
gb_effects_config.surround = 1 == regQueryDwordValue( "gbSoundEffectsSurround", 0 );
gb_effects_config.echo = (float)regQueryDwordValue( "gbSoundEffectsEcho", 20 ) / 100.0f;
@ -1597,6 +1593,9 @@ void VBA::loadSettings()
gbSoundSetDeclicking( 1 == regQueryDwordValue( "gbSoundDeclicking", 1 ) );
soundInterpolation = 1 == regQueryDwordValue( "gbaSoundInterpolation", 1 );
soundFiltering = (float)regQueryDwordValue( "gbaSoundFiltering", 50 ) / 100.0f;
tripleBuffering = regQueryDwordValue("tripleBuffering", false) ? true : false;
#ifndef NO_D3D
@ -2585,8 +2584,6 @@ void VBA::saveSettings()
regSetDwordValue("soundVolume", (DWORD)(soundGetVolume() * 100.0f));
regSetDwordValue("soundInterpolation", soundInterpolation);
regSetDwordValue( "gbSoundEffectsEnabled", gb_effects_config.enabled ? 1 : 0 );
regSetDwordValue( "gbSoundEffectsSurround", gb_effects_config.surround ? 1 : 0 );
regSetDwordValue( "gbSoundEffectsEcho", (DWORD)( gb_effects_config.echo * 100.0f ) );
@ -2594,6 +2591,9 @@ void VBA::saveSettings()
regSetDwordValue( "gbSoundDeclicking", gbSoundGetDeclicking() ? 1 : 0 );
regSetDwordValue( "gbaSoundInterpolation", soundInterpolation ? 1 : 0 );
regSetDwordValue( "gbaSoundFiltering", (DWORD)( soundFiltering * 100.0f ) );
regSetDwordValue("tripleBuffering", tripleBuffering);
#ifndef NO_D3D

View File

@ -1167,30 +1167,36 @@ BEGIN
RTEXT "Device:",IDC_STATIC,6,6,48,12
END
IDD_AUDIO_CORE_SETTINGS DIALOGEX 0, 0, 168, 211
IDD_AUDIO_CORE_SETTINGS DIALOGEX 0, 0, 330, 150
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,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
DEFPUSHBUTTON "OK",IDOK,222,132,48,14
PUSHBUTTON "Cancel",IDCANCEL,276,132,48,14
GROUPBOX "Game Boy only",IDC_STATIC,168,6,156,120
CONTROL "Enhance sound",IDC_ENHANCE_SOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,18,65,10
CONTROL "Surround",IDC_SURROUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,30,48,10
GROUPBOX "Echo",IDC_STATIC,186,42,132,36
CONTROL "",IDC_ECHO,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,192,54,120,12
LTEXT "None",IDC_STATIC,192,66,36,8,SS_CENTERIMAGE
RTEXT "Lots",IDC_STATIC,276,66,36,8,SS_CENTERIMAGE
GROUPBOX "Stereo",IDC_STATIC,186,84,132,36
CONTROL "",IDC_STEREO,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,192,97,120,12
LTEXT "Center",IDC_STATIC,192,108,36,8,SS_CENTERIMAGE
RTEXT "Left/Right",IDC_STATIC,276,108,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
CONTROL "Declicking",IDC_DECLICKING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,240,30,47,10
GROUPBOX "Game Boy Advance only",IDC_STATIC,6,60,156,66
CONTROL "Sound interpolation",IDC_SOUND_INTERPOLATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,72,78,10
GROUPBOX "Sound filtering",IDC_STATIC,12,84,144,36
CONTROL "",IDC_SOUND_FILTERING,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,18,97,132,12
LTEXT "None",IDC_STATIC,18,108,36,8,SS_CENTERIMAGE
RTEXT "Maximum",IDC_STATIC,114,108,36,8,SS_CENTERIMAGE
END
@ -1546,9 +1552,9 @@ BEGIN
IDD_AUDIO_CORE_SETTINGS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 161
RIGHTMARGIN, 323
TOPMARGIN, 7
BOTTOMMARGIN, 204
BOTTOMMARGIN, 143
END
END
#endif // APSTUDIO_INVOKED
@ -1787,11 +1793,6 @@ BEGIN
MENUITEM "&22050 Hz", ID_OPTIONS_SOUND_22KHZ
MENUITEM "&44100 Hz", ID_OPTIONS_SOUND_44KHZ
END
POPUP "PCM interpolation"
BEGIN
MENUITEM "On", ID_OPTIONS_SOUND_PCMINTERPOLATION_LINEAR
MENUITEM "Off", ID_OPTIONS_SOUND_PCMINTERPOLATION_NONE
END
MENUITEM SEPARATOR
POPUP "Sound Channels"
BEGIN
@ -2220,7 +2221,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."
IDS_TOOLTIP_DECLICKING "When enabled, clicks are reduced by using GBA sound hardware.\nNote that clicks are normal for GB and GBC sound hardware."
END
STRINGTABLE

View File

@ -50,6 +50,7 @@
#define IDS_TOOLTIP_ENHANCE_SOUND 43
#define IDS_TOOLTIP_SURROUND 44
#define IDS_TOOLTIP_DECLICKING 45
#define IDS_TOOLTIP_SOUND_INTERPOLATION 46
#define IDI_MAINICON 101
#define IDD_REGISTERS 102
#define IDD_DEBUG 103
@ -543,6 +544,7 @@
#define IDC_CHECK_UPMIX 1284
#define IDC_ENHANCE_SOUND 1284
#define IDC_COMBO_DEV 1285
#define IDC_SOUND_INTERPOLATION 1285
#define IDC_SLIDER_BUFFER 1286
#define IDC_INFO_BUFFER 1287
#define IDC_SURROUND 1288
@ -552,6 +554,7 @@
#define IDC_VOLUME 1291
#define IDC_DEFAULT_VOLUME 1292
#define IDC_DECLICKING 1293
#define IDC_SOUND_FILTERING 1294
#define IDS_OAL_NODEVICE 2000
#define IDS_OAL_NODLL 2001
#define IDS_AVI_CANNOT_CREATE_AVI 2002