From c2751af7f544ce601118e42f591ef2fb044d162b Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 10 Jul 2009 18:46:50 +0000 Subject: [PATCH] spu and win32: add individual channel muting capability --- desmume/src/windows/resource.h | 53 ++++++++++++++++++++---------- desmume/src/windows/resources.rc | Bin 683598 -> 685100 bytes desmume/src/windows/soundView.cpp | 48 ++++++++++++++++++++++++--- 3 files changed, 78 insertions(+), 23 deletions(-) diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 4f67bc62c..f652b8258 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -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 diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index 8ecf524e7aec042f417f9f09e5b03a74f9c4d1fd..7d05d0a9cf1a3c2ba09dcca845f144cf6f7191cf 100644 GIT binary patch delta 697 zcmaKnJxD@P6vwaL_v~m;PNo!s4WT0T{K${ZCBY$w$gRP0Y;kr72f;DI;m{&)Du^@+ z=`Ixx4v`|^Bq3(f&=d|$Oa$>Jm+1?kORm9;unF z$$$wDX_6TmUe$Ov|F8^@?D`b^$b)E<$T4nc3wvGzLWch8i(hpk1Zd&)C-; zGzUdK&w$B$04$g2puI0K-y^&Zh)@N7lurIJGUo#w@06?Xp%fJ#XN|9RT%mu16)oD} z-udS-?`*kBS-C1St?c$&aO|NRQ~~zF+ECUW5qW5MEHHZnHcoNr4eTgwiyE3BN9Z~S zlPHlL5<}M}jbXIO3vS}T_b{yF^k?f6=qeq8+5mBo0P)WvO`>~by4Yu3{CQ{7o@v@k zq}jB0n)c1}-kPR^Wafn?(KkuE`QCG`^pEJ}{*`XNhex?qLQ7JxpcK~~qQ0g!V=pCG ZbDaYN?$-nz>%?`tG@EV%OSiT4lV8)^+;#u} delta 110 zcmZ4ULi5}m&4w1n7N#xCRnxa`n9reQIlVxWO=)_?O^#jd4HucWH(X?qP@ewa1GC)Z z2fQrX7kpt+37IbNlY?dYF&|Ekb{jwbbt}Iyq diff --git a/desmume/src/windows/soundView.cpp b/desmume/src/windows/soundView.cpp index f71543a9a..128568ad8 100644 --- a/desmume/src/windows/soundView.cpp +++ b/desmume/src/windows/soundView.cpp @@ -25,6 +25,7 @@ #include "../common.h" #include "../matrix.h" #include "resource.h" +#include "NDSSystem.h" #include #include #include @@ -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);