I have got this done.
Here is the source diff
diff -rdu c:\Share\old\snes9xw-improvement9-src/resource.h c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/resource.h
--- c:\Share\old\snes9xw-improvement9-src/resource.h 2006-02-12 01:10:00.000000000 -0800
+++ c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/resource.h 2007-07-13 15:33:37.859375000 -0700
@@ -483,7 +483,14 @@
#define ID_TURBO_UP 40125
#define ID_TURBO_RIGHT 40126
#define ID_TURBO_DOWN 40127
-
+#define ID_SOUND_TOGGLECHANNEL0 40200
+#define ID_SOUND_TOGGLECHANNEL1 40201
+#define ID_SOUND_TOGGLECHANNEL2 40202
+#define ID_SOUND_TOGGLECHANNEL3 40203
+#define ID_SOUND_TOGGLECHANNEL4 40204
+#define ID_SOUND_TOGGLECHANNEL5 40205
+#define ID_SOUND_TOGGLECHANNEL6 40206
+#define ID_SOUND_TOGGLECHANNEL7 40207
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
diff -rdu c:\Share\old\snes9xw-improvement9-src/snes9x/gfx.cpp c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/snes9x/gfx.cpp
--- c:\Share\old\snes9xw-improvement9-src/snes9x/gfx.cpp 2006-02-12 14:52:04.000000000 -0800
+++ c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/snes9x/gfx.cpp 2007-03-08 10:10:49.093000000 -0800
@@ -3608,7 +3608,7 @@
{
int j = KeyOrder[i];
int mask = (1 << (j+1));
- string[strlen("P?: ")+i]= ((IPPU.Joypads[J] & mask)!=0 || (IPPU.Joypads[J+5] & mask)!=0) ? KeyMap[j] : ' ';
+ string[strlen("P?: ")+i]= ((IPPU.Joypads[J] & mask)!=0) ? KeyMap[j] : ' '; // fix the input display for p4 and p5
}
len=strlen(string);
diff -rdu c:\Share\old\snes9xw-improvement9-src/snes9x/globals.cpp c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/snes9x/globals.cpp
--- c:\Share\old\snes9xw-improvement9-src/snes9x/globals.cpp 2004-07-11 21:50:58.000000000 -0700
+++ c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/snes9x/globals.cpp 2007-07-14 02:51:36.468750000 -0700
@@ -130,6 +130,7 @@
struct SSA1 SA1;
SSoundData SoundData;
+bool8 ChannelEnabled[NUM_CHANNELS] = {1,1,1,1,1,1,1,1};
SnesModel M1SNES={1,3,2};
SnesModel M2SNES={2,4,3};
diff -rdu c:\Share\old\snes9xw-improvement9-src/snes9x/snapshot.cpp c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/snes9x/snapshot.cpp
diff -rdu c:\Share\old\snes9xw-improvement9-src/snes9x/soundux.cpp c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/snes9x/soundux.cpp
--- c:\Share\old\snes9xw-improvement9-src/snes9x/soundux.cpp 2005-03-09 23:43:54.000000000 -0800
+++ c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/snes9x/soundux.cpp 2007-07-14 03:00:49.281250000 -0700
@@ -1149,11 +1149,15 @@
if (pitch_mod & (1 << (J + 1)))
wave [I / 2] = ch->sample * ch->envx;
-
- MixBuffer [I ^ Settings.ReverseStereo] += VL;
- MixBuffer [I + (1 ^ Settings.ReverseStereo)] += VR;
- ch->echo_buf_ptr [I ^ Settings.ReverseStereo] += VL;
- ch->echo_buf_ptr [I + (1 ^ Settings.ReverseStereo)] += VR;
+
+ if (ChannelEnabled[J])
+ {
+ MixBuffer [I ^ Settings.ReverseStereo] += VL;
+ MixBuffer [I + (1 ^ Settings.ReverseStereo)] += VR;
+
+ ch->echo_buf_ptr [I ^ Settings.ReverseStereo] += VL;
+ ch->echo_buf_ptr [I + (1 ^ Settings.ReverseStereo)] += VR;
+ }
}
stereo_exit: ;
}
@@ -1437,8 +1441,11 @@
}
}
- MixBuffer [I] += V;
- ch->echo_buf_ptr [I] += V;
+ if (ChannelEnabled[J])
+ {
+ MixBuffer [I] += V;
+ ch->echo_buf_ptr [I] += V;
+ }
if (pitch_mod & (1 << (J + 1)))
wave [I] = ch->sample * ch->envx;
diff -rdu c:\Share\old\snes9xw-improvement9-src/snes9x/soundux.h c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/snes9x/soundux.h
--- c:\Share\old\snes9xw-improvement9-src/snes9x/soundux.h 2004-07-11 21:51:00.000000000 -0700
+++ c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/snes9x/soundux.h 2007-07-14 02:51:36.531250000 -0700
@@ -181,6 +181,7 @@
uint32 dummy [8];
// unsigned short last_valid_header;
} Channel;
+extern bool8 ChannelEnabled[NUM_CHANNELS];
typedef struct
{
diff -rdu c:\Share\old\snes9xw-improvement9-src/snes9x.rc c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/snes9x.rc
--- c:\Share\old\snes9xw-improvement9-src/snes9x.rc 2006-02-12 01:09:58.000000000 -0800
+++ c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/snes9x.rc 2007-07-13 15:47:02.234375000 -0700
@@ -1436,6 +1436,17 @@
MENUITEM "&320ms", ID_SOUND_1S, GRAYED
MENUITEM "64&0ms", ID_SOUND_2S, GRAYED
END
+ POPUP "&Channels"
+ BEGIN
+ MENUITEM "Channel &0", ID_SOUND_TOGGLECHANNEL0, CHECKED
+ MENUITEM "Channel &1", ID_SOUND_TOGGLECHANNEL1, CHECKED
+ MENUITEM "Channel &2", ID_SOUND_TOGGLECHANNEL2, CHECKED
+ MENUITEM "Channel &3", ID_SOUND_TOGGLECHANNEL3, CHECKED
+ MENUITEM "Channel &4", ID_SOUND_TOGGLECHANNEL4, CHECKED
+ MENUITEM "Channel &5", ID_SOUND_TOGGLECHANNEL5, CHECKED
+ MENUITEM "Channel &6", ID_SOUND_TOGGLECHANNEL6, CHECKED
+ MENUITEM "Channel &7", ID_SOUND_TOGGLECHANNEL7, CHECKED
+ END
MENUITEM "&16-Bit Sound", ID_SOUND_16BIT
MENUITEM "&Stereo", ID_SOUND_STEREO
MENUITEM "&Reverse Stereo\tAlt+R", ID_SOUND_REVERSE_STEREO
diff -rdu c:\Share\old\snes9xw-improvement9-src/wsnes9x.cpp c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/wsnes9x.cpp
--- c:\Share\old\snes9xw-improvement9-src/wsnes9x.cpp 2006-02-12 16:30:28.000000000 -0800
+++ c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/wsnes9x.cpp 2007-07-14 03:02:32.265625000 -0700
@@ -113,6 +113,7 @@
#include "snes9x/movie.h"
#include "AVIOutput.h"
#include "InputCustom.h"
+#include "snes9x/soundux.h"
#include <vector>
#include <TCHAR.H>
@@ -473,6 +474,14 @@
{0,0}, // Select save slot 7
{0,0}, // Select save slot 8
{0,0}}, // Select save slot 9
+ {{0,0}, // Toggle sound channel 0
+ {0,0}, // Toggle sound channel 1
+ {0,0}, // Toggle sound channel 2
+ {0,0}, // Toggle sound channel 3
+ {0,0}, // Toggle sound channel 4
+ {0,0}, // Toggle sound channel 5
+ {0,0}, // Toggle sound channel 6
+ {0,0}}, // Toggle sound channel 7
};
@@ -1241,6 +1250,20 @@
hitHotKey = true;
}
}
+ for(int i = 0 ; i < 8 ; i++)
+ {
+ if(wParam == CustomKeys.ToggleSound[i].key && modifiers == CustomKeys.ToggleSound[i].modifiers)
+ {
+ ChannelEnabled[i] =! ChannelEnabled[i];
+
+ static char str [64];
+ sprintf(str, "Sound Channel %d %sabled", i, (ChannelEnabled[i])?"en":"dis");
+ CheckMenuItem(GUI.hMenu, ID_SOUND_TOGGLECHANNEL0 + i, (ChannelEnabled[i])?MFS_CHECKED:MFS_UNCHECKED);
+// S9xSetInfoString(str);
+
+ hitHotKey = true;
+ }
+ }
if(wParam == CustomKeys.Transparency.key
&& modifiers == CustomKeys.Transparency.modifiers)
@@ -1803,7 +1826,21 @@
SetupSound (Settings.SoundPlaybackRate,
Settings.SixteenBitSound, Settings.Stereo);
break;
-
+ case ID_SOUND_TOGGLECHANNEL0:
+ case ID_SOUND_TOGGLECHANNEL1:
+ case ID_SOUND_TOGGLECHANNEL2:
+ case ID_SOUND_TOGGLECHANNEL3:
+ case ID_SOUND_TOGGLECHANNEL4:
+ case ID_SOUND_TOGGLECHANNEL5:
+ case ID_SOUND_TOGGLECHANNEL6:
+ case ID_SOUND_TOGGLECHANNEL7:
+ ChannelEnabled[wParam - ID_SOUND_TOGGLECHANNEL0] = !ChannelEnabled[wParam - ID_SOUND_TOGGLECHANNEL0];
+ static char str [64];
+ sprintf(str, "Sound Channel %d %sabled", wParam - ID_SOUND_TOGGLECHANNEL0, ((ChannelEnabled[wParam - ID_SOUND_TOGGLECHANNEL0])?"en":"dis"));
+ CheckMenuItem(GUI.hMenu, wParam, (ChannelEnabled[wParam - ID_SOUND_TOGGLECHANNEL0])?MFS_CHECKED:MFS_UNCHECKED);
+// S9xSetInfoString(str);
+ break;
+
case ID_SOUND_STEREO:
Settings.Stereo = !Settings.Stereo;
SetupSound (Settings.SoundPlaybackRate,
@@ -8477,6 +8514,10 @@
for(int i = 0 ; i < 10 ; i++)
SendDlgItemMessage(hDlg,IDC_HOTKEY1+i,WM_USER+44,CustomKeys.SelectSave[i].key,CustomKeys.SelectSave[i].modifiers);
break;
+ case 4:
+ for(int i = 0 ; i < 8 ; i++)
+ SendDlgItemMessage(hDlg,IDC_HOTKEY1+i,WM_USER+44,CustomKeys.ToggleSound[i].key,CustomKeys.ToggleSound[i].modifiers);
+ break;
}
SendDlgItemMessage(hDlg,IDC_SLOTPLUS,WM_USER+44,CustomKeys.SlotPlus.key,CustomKeys.SlotPlus.modifiers);
@@ -8548,6 +8589,17 @@
SetDlgItemText(hDlg,IDC_LABEL_HK1+i,INPUTCONFIG_LABEL_UNUSED);
break;
+ case 4:
+ for(int i = 0 ; i < 8 ; i++)
+ {
+ char temp [128];
+ sprintf(temp, "Toggle Sound %d", i);
+ SetDlgItemText(hDlg,IDC_LABEL_HK1+i,temp);
+ }
+ for(int i = 8 ; i < 13 ; i++)
+ SetDlgItemText(hDlg,IDC_LABEL_HK1+i,INPUTCONFIG_LABEL_UNUSED);
+
+ break;
}
}
@@ -8577,7 +8629,7 @@
SetWindowText(hDlg,HOTKEYS_TITLE);
// insert hotkey page list items
- for(i=1 ; i <= 4 ; i++)
+ for(i=1 ; i <= 5 ; i++)
{
char temp[256];
sprintf(temp,HOTKEYS_HKCOMBO,i);
@@ -8633,48 +8685,56 @@
if(index == 1) CustomKeys.BGL1.key = wParam, CustomKeys.BGL1.modifiers = modifiers;
if(index == 2) CustomKeys.TurboA.key = wParam, CustomKeys.TurboA.modifiers = modifiers;
if(index == 3) CustomKeys.SelectSave[0].key = wParam, CustomKeys.SelectSave[0].modifiers = modifiers;
+ if(index == 4) CustomKeys.ToggleSound[0].key = wParam, CustomKeys.ToggleSound[0].modifiers = modifiers;
break;
case IDC_HOTKEY2:
if(index == 0) CustomKeys.SpeedDown.key = wParam, CustomKeys.SpeedDown.modifiers = modifiers;
if(index == 1) CustomKeys.BGL2.key = wParam, CustomKeys.BGL2.modifiers = modifiers;
if(index == 2) CustomKeys.TurboB.key = wParam, CustomKeys.TurboB.modifiers = modifiers;
if(index == 3) CustomKeys.SelectSave[1].key = wParam, CustomKeys.SelectSave[1].modifiers = modifiers;
+ if(index == 4) CustomKeys.ToggleSound[1].key = wParam, CustomKeys.ToggleSound[1].modifiers = modifiers;
break;
case IDC_HOTKEY3:
if(index == 0) CustomKeys.Pause.key = wParam, CustomKeys.Pause.modifiers = modifiers;
if(index == 1) CustomKeys.BGL3.key = wParam, CustomKeys.BGL3.modifiers = modifiers;
if(index == 2) CustomKeys.TurboY.key = wParam, CustomKeys.TurboY.modifiers = modifiers;
if(index == 3) CustomKeys.SelectSave[2].key = wParam, CustomKeys.SelectSave[2].modifiers = modifiers;
+ if(index == 4) CustomKeys.ToggleSound[2].key = wParam, CustomKeys.ToggleSound[2].modifiers = modifiers;
break;
case IDC_HOTKEY4:
if(index == 0) CustomKeys.FrameAdvance.key = wParam, CustomKeys.FrameAdvance.modifiers = modifiers;
if(index == 1) CustomKeys.BGL4.key = wParam, CustomKeys.BGL4.modifiers = modifiers;
if(index == 2) CustomKeys.TurboX.key = wParam, CustomKeys.TurboX.modifiers = modifiers;
if(index == 3) CustomKeys.SelectSave[3].key = wParam, CustomKeys.SelectSave[3].modifiers = modifiers;
+ if(index == 4) CustomKeys.ToggleSound[3].key = wParam, CustomKeys.ToggleSound[3].modifiers = modifiers;
break;
case IDC_HOTKEY5:
if(index == 0) CustomKeys.FastForward.key = wParam, CustomKeys.FastForward.modifiers = modifiers;
if(index == 1) CustomKeys.BGL5.key = wParam, CustomKeys.BGL5.modifiers = modifiers;
if(index == 2) CustomKeys.TurboL.key = wParam, CustomKeys.TurboL.modifiers = modifiers;
if(index == 3) CustomKeys.SelectSave[4].key = wParam, CustomKeys.SelectSave[4].modifiers = modifiers;
+ if(index == 4) CustomKeys.ToggleSound[4].key = wParam, CustomKeys.ToggleSound[4].modifiers = modifiers;
break;
case IDC_HOTKEY6:
if(index == 0) CustomKeys.SkipUp.key = wParam, CustomKeys.SkipUp.modifiers = modifiers;
if(index == 1) CustomKeys.ClippingWindows.key = wParam, CustomKeys.ClippingWindows.modifiers = modifiers;
if(index == 2) CustomKeys.TurboR.key = wParam, CustomKeys.TurboR.modifiers = modifiers;
- if(index == 3) CustomKeys.SelectSave[5].key = wParam, CustomKeys.SelectSave[5].modifiers = modifiers;
+ if(index == 3) CustomKeys.SelectSave[5].key = wParam, CustomKeys.SelectSave[5].modifiers = modifiers;
+ if(index == 4) CustomKeys.ToggleSound[5].key = wParam, CustomKeys.ToggleSound[5].modifiers = modifiers;
break;
case IDC_HOTKEY7:
if(index == 0) CustomKeys.SkipDown.key = wParam, CustomKeys.SkipDown.modifiers = modifiers;
if(index == 1) CustomKeys.BGLHack.key = wParam, CustomKeys.BGLHack.modifiers = modifiers;
if(index == 2) CustomKeys.TurboStart.key = wParam, CustomKeys.TurboStart.modifiers = modifiers;
if(index == 3) CustomKeys.SelectSave[6].key = wParam, CustomKeys.SelectSave[6].modifiers = modifiers;
+ if(index == 4) CustomKeys.ToggleSound[6].key = wParam, CustomKeys.ToggleSound[6].modifiers = modifiers;
break;
case IDC_HOTKEY8:
if(index == 0) CustomKeys.ScopeTurbo.key = wParam, CustomKeys.ScopeTurbo.modifiers = modifiers;
if(index == 1) CustomKeys.Transparency.key = wParam, CustomKeys.Transparency.modifiers = modifiers;
if(index == 2) CustomKeys.TurboSelect.key = wParam, CustomKeys.TurboSelect.modifiers = modifiers;
if(index == 3) CustomKeys.SelectSave[7].key = wParam, CustomKeys.SelectSave[7].modifiers = modifiers;
+ if(index == 4) CustomKeys.ToggleSound[7].key = wParam, CustomKeys.ToggleSound[7].modifiers = modifiers;
break;
case IDC_HOTKEY9:
if(index == 0) CustomKeys.ScopePause.key = wParam, CustomKeys.ScopePause.modifiers = modifiers;
diff -rdu c:\Share\old\snes9xw-improvement9-src/wsnes9x.h c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/wsnes9x.h
--- c:\Share\old\snes9xw-improvement9-src/wsnes9x.h 2006-02-12 00:39:10.000000000 -0800
+++ c:\Share\snes9xw-improvement9-src\snes9xw-improvement9-src/wsnes9x.h 2007-07-13 15:08:14.734375000 -0700
@@ -270,6 +270,7 @@
SCustomKey SwitchControllers;
SCustomKey TurboA, TurboB, TurboY, TurboX, TurboL, TurboR, TurboStart, TurboSelect, TurboLeft, TurboUp, TurboRight, TurboDown;
SCustomKey SelectSave [10];
+ SCustomKey ToggleSound [8];
};
struct SJoypad {
And a link to the executables
http://jxq.skuzz.com/tas/snes9x-soundmod.zip