spu and win32: add individual channel muting capability

This commit is contained in:
zeromus 2009-07-10 18:46:50 +00:00
parent 5d40f08ce2
commit c2751af7f5
3 changed files with 78 additions and 23 deletions

View File

@ -120,23 +120,23 @@
#define IDC_PNG 325
#define IDC_BMP 326
#define IDC_FORMATSTATIC 327
#define IDM_PATHSETTINGS 350
#define IDC_ROMPATHEDIT 351
#define IDC_BROWSEROMS 352
#define IDC_PATHDEFAULTS 353
#define IDC_SAVERAMPATHEDIT 354
#define IDC_BROWSESRAM 355
#define IDC_STATEPATHEDIT 356
#define IDC_BROWSESTATES 357
#define IDC_SCREENSHOTPATHEDIT 358
#define IDC_BROWSESCREENSHOTS 359
#define IDC_AVIPATHEDIT 360
#define IDC_BROWSEAVI 361
#define IDC_CHEATPATHEDIT 362
#define IDC_BROWSECHEATS 363
#define IDC_LUAPATHEDIT 364
#define IDC_BROWSELUA 365
#define IDD_PATHSETTINGS 366
#define IDM_PATHSETTINGS 350
#define IDC_ROMPATHEDIT 351
#define IDC_BROWSEROMS 352
#define IDC_PATHDEFAULTS 353
#define IDC_SAVERAMPATHEDIT 354
#define IDC_BROWSESRAM 355
#define IDC_STATEPATHEDIT 356
#define IDC_BROWSESTATES 357
#define IDC_SCREENSHOTPATHEDIT 358
#define IDC_BROWSESCREENSHOTS 359
#define IDC_AVIPATHEDIT 360
#define IDC_BROWSEAVI 361
#define IDC_CHEATPATHEDIT 362
#define IDC_BROWSECHEATS 363
#define IDC_LUAPATHEDIT 364
#define IDC_BROWSELUA 365
#define IDD_PATHSETTINGS 366
#define IDC_DES_BOX 402
#define IDC_R0 403
#define IDC_R1 404
@ -395,6 +395,15 @@
#define IDC_LIST 1069
#define IDC_SNUMBER 1071
#define IDC_CHECK1 1074
#define IDC_CHECK2 1075
#define IDC_CHECK3 1076
#define IDC_CHECK4 1077
#define IDC_CHECK6 1080
#define IDC_CHECK7 1082
#define IDC_CHECK8 1083
#define IDC_CHECK9 1088
#define IDM_FIRMSETTINGS 1100
#define IDD_FIRMSETTINGS 1101
#define IDC_EDIT1 1102
@ -608,6 +617,14 @@
#define IDC_SOUND5POSLEN 1451
#define IDC_SOUND6POSLEN 1452
#define IDC_SOUND7POSLEN 1453
#define IDC_SOUND0MUTE 2001
#define IDC_SOUND1MUTE 2002
#define IDC_SOUND2MUTE 2003
#define IDC_SOUND3MUTE 2004
#define IDC_SOUND4MUTE 2005
#define IDC_SOUND5MUTE 2006
#define IDC_SOUND6MUTE 2007
#define IDC_SOUND7MUTE 2008
#define IDC_GI_FATOFS 4464
#define IDC_INTERPOLATECOLOR 4464
#define IDC_GI_FATSIZE 4465
@ -773,7 +790,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40008
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Binary file not shown.

View File

@ -25,6 +25,7 @@
#include "../common.h"
#include "../matrix.h"
#include "resource.h"
#include "NDSSystem.h"
#include <algorithm>
#include <windows.h>
#include <windowsx.h>
@ -66,6 +67,11 @@ void SoundView_DeInit()
//////////////////////////////////////////////////////////////////////////////
inline int chanOfs()
{
return SoundView_Data->viewFirst8Channels ? 0 : 8;
}
BOOL SoundView_DlgOpen(HWND hParentWnd)
{
HWND hDlg;
@ -117,11 +123,10 @@ void SoundView_Refresh()
char buf[256];
HWND hDlg = SoundView_Data->hDlg;
int chanOfs = SoundView_Data->viewFirst8Channels ? 0 : 8;
static const int format_shift[] = { 2, 1, 3, 0 };
static const double ARM7_CLOCK = 33513982;
for(int chanId = 0; chanId < 8; chanId++) {
int chan = chanId + chanOfs;
int chan = chanId + chanOfs();
channel_struct &thischan = SPU_core->channels[chan];
SendDlgItemMessage(hDlg, IDC_SOUND0PANBAR+chanId, PBM_SETPOS, (WPARAM)spumuldiv7(128, thischan.pan), (LPARAM)0);
@ -204,6 +209,20 @@ void SoundView_Refresh()
//////////////////////////////////////////////////////////////////////////////
static void updateMute_toSettings(HWND hDlg, int chan)
{
for(int chanId = 0; chanId < 8; chanId++)
CommonSettings.spu_muteChannels[chanId+chanOfs()] = IsDlgButtonChecked(hDlg, IDC_SOUND0MUTE+chanId) == BST_CHECKED;
}
static void updateMute_fromSettings(HWND hDlg)
{
for(int chanId = 0; chanId < 8; chanId++)
SendDlgItemMessage(hDlg, IDC_SOUND0MUTE+chanId, BM_SETCHECK,
CommonSettings.spu_muteChannels[chanId+chanOfs()] ? TRUE : FALSE,
0);
}
static void SoundView_SwitchChanOfs(SoundView_DataStruct *data)
{
if (data == NULL)
@ -215,17 +234,19 @@ static void SoundView_SwitchChanOfs(SoundView_DataStruct *data)
data->viewFirst8Channels ? "V" : "^");
char buf[256];
int chanOfs = SoundView_Data->viewFirst8Channels ? 0 : 8;
for(int chanId = 0; chanId < 8; chanId++) {
int chan = chanId + chanOfs;
int chan = chanId + chanOfs();
sprintf(buf, "#%02d", chan);
SetDlgItemText(hDlg, IDC_SOUND0ID+chanId, buf);
}
updateMute_fromSettings(hDlg);
SoundView_Refresh();
}
BOOL CALLBACK SoundView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL CALLBACK SoundView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
SoundView_DataStruct *data = (SoundView_DataStruct*)GetWindowLong(hDlg, DWL_USER);
if((data == NULL) && (uMsg != WM_INITDIALOG))
@ -240,6 +261,11 @@ BOOL CALLBACK SoundView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
SendDlgItemMessage(hDlg, IDC_SOUND0PANBAR+chanId, PBM_SETRANGE, (WPARAM)0, MAKELPARAM(0, 128));
}
for(int chanId = 0; chanId < 8; chanId++) {
if(CommonSettings.spu_muteChannels[chanId])
SendDlgItemMessage(hDlg, IDC_SOUND0MUTE+chanId, BM_SETCHECK, TRUE, 0);
}
if(data == NULL)
{
data = (SoundView_DataStruct*)lParam;
@ -270,6 +296,18 @@ BOOL CALLBACK SoundView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
data->volModeAlternate = IsDlgButtonChecked(hDlg, IDC_BUTTON_VOLMODE);
return 1;
case IDC_SOUND0MUTE+0:
case IDC_SOUND0MUTE+1:
case IDC_SOUND0MUTE+2:
case IDC_SOUND0MUTE+3:
case IDC_SOUND0MUTE+4:
case IDC_SOUND0MUTE+5:
case IDC_SOUND0MUTE+6:
case IDC_SOUND0MUTE+7:
updateMute_toSettings(hDlg,LOWORD(wParam)-IDC_SOUND0MUTE);
return 1;
case IDC_SOUNDVIEW_CHANSWITCH:
{
SoundView_SwitchChanOfs(data);