From 6d742a5e5bb336d76e295b4d8239eb790710d880 Mon Sep 17 00:00:00 2001 From: pagefault <> Date: Tue, 4 Sep 2001 16:38:14 +0000 Subject: [PATCH] Added surround option to windows and linux port --- zsnes/src/cpu/dspproc.asm | 45 +++++++++++++++++++++++++++++++++++++- zsnes/src/gui/guikeys.inc | 8 ------- zsnes/src/gui/guimouse.inc | 5 ----- zsnes/src/gui/guiwindp.inc | 23 +------------------ zsnes/src/win/winlink.cpp | 14 +----------- 5 files changed, 46 insertions(+), 49 deletions(-) diff --git a/zsnes/src/cpu/dspproc.asm b/zsnes/src/cpu/dspproc.asm index 1bd19415..c65f6a8e 100644 --- a/zsnes/src/cpu/dspproc.asm +++ b/zsnes/src/cpu/dspproc.asm @@ -130,7 +130,7 @@ EXTSYM NoiseData,SoundCompD,Voice0Disable,csounddisable,dssel,spcRamcmp EXTSYM cfgecho,Surround,SoundBufEn EXTSYM echobuf,ENVDisable EXTSYM LowPassFilterType -EXTSYM UseCubicSpline,NoiseDisTemp +EXTSYM NoiseDisTemp NEWSYM DspProcAsmStart @@ -5639,6 +5639,7 @@ NEWSYM LPFstereo ; mov ecx, <------------------- # of samples to mix / 4 mov ebx,[LPFsample1] mov edx,[LPFsample2] + NEWSYM LPFstereoloop push ecx mov eax,[esi] @@ -5664,7 +5665,49 @@ NEWSYM LPFstereoloop jnz near LPFstereoloop mov [LPFsample1],ebx mov [LPFsample2],edx + NEWSYM LPFexit +%ifndef __MSDOS__ + cmp byte[Surround],1 + jnz near .nosurround + cmp byte[StereoSound],1 + jnz near .nosurround + mov esi,DSPBuffer + mov ecx,[BufferSizeB] + shr ecx,1 +.loop + mov eax,[esi] + mov edx,[esi+4] + add edx,eax + sar edx,1 + + sub eax,edx ; possibly eliminate center + shl eax,3 + + mov ebx,[esi+4] + sub [esi+4],eax + + sub ebx,edx ; possibly eliminate center + shl ebx,3 + + sub [esi],ebx + + sar dword[esi],1 + sar dword[esi+4],1 + + mov eax,[esi] + mov edx,[esi+4] + add edx,eax + sar edx,1 + + add [esi],edx + add [esi+4],edx + + add esi,8 + dec ecx + jnz near .loop +.nosurround +%endif ret NEWSYM stopsbsound16 diff --git a/zsnes/src/gui/guikeys.inc b/zsnes/src/gui/guikeys.inc index 41d59d9a..1ee5b74f 100644 --- a/zsnes/src/gui/guikeys.inc +++ b/zsnes/src/gui/guikeys.inc @@ -1226,18 +1226,10 @@ GUISoundKeys: jne .notrevst xor byte[RevStereo],1 .notrevst -%ifdef __MSDOS__ cmp dh,'U' jne .nosurround xor byte[Surround],1 .nosurround -%endif -%ifdef __WIN32__ - cmp dh,'X' - jne .noexclusivesound - xor byte[ExclusiveSound],1 -.noexclusivesound -%endif cmp dh,'B' jne .nosoundbuf xor byte[SoundBufEn],1 diff --git a/zsnes/src/gui/guimouse.inc b/zsnes/src/gui/guimouse.inc index 2c348637..419e5ca5 100644 --- a/zsnes/src/gui/guimouse.inc +++ b/zsnes/src/gui/guimouse.inc @@ -2323,12 +2323,7 @@ DisplayGUISoundClick: GUIClickCButtonS 11,111,byte[RevStereo] ; cmp byte[OSPort],3 ; je near .win32sound -%ifdef __MSDOS__ GUIClickCButton 11,121,byte[Surround] -%endif -%ifdef __WIN32__ - GUIClickCButton 11,121,byte[ExclusiveSound] -%endif ;.win32sound GUIClickCButton 11,131,byte[SoundBufEn] GUIClickCButton 11,141,byte[SPCDisable] diff --git a/zsnes/src/gui/guiwindp.inc b/zsnes/src/gui/guiwindp.inc index 2bad1c2d..59f93957 100644 --- a/zsnes/src/gui/guiwindp.inc +++ b/zsnes/src/gui/guiwindp.inc @@ -2171,13 +2171,8 @@ DisplayGUISound: GUIOuttextwin2u 6,26,116,GUISoundTextH,2 ; cmp byte[OSPort],3 ; je near .win32s2 -%ifdef __MSDOS__ GUIOuttextwin2u 6,26,126,GUISoundTextI,1 -%endif ;.win32s2 -%ifdef __WIN32__ - GUIOuttextwin2u 6,26,126,GUISoundTextO,1 -%endif GUIOuttextwin2u 6,26,136,GUISoundTextJ,6 GUIOuttextwin2u 6,26,146,GUISoundTextK,0 GUIOuttextwin2u 6,26,166,GUISoundTextQ,0 @@ -2199,13 +2194,8 @@ DisplayGUISound: GUIOuttextwin2 6,25,115,GUISoundTextH ; cmp byte[OSPort],3 ; je near .win32s -%ifdef __MSDOS__ GUIOuttextwin2 6,25,125,GUISoundTextI -%endif ;.win32s -%ifdef __WIN32__ - GUIOuttextwin2 6,25,125,GUISoundTextO -%endif GUIOuttextwin2 6,25,135,GUISoundTextJ GUIOuttextwin2 6,25,145,GUISoundTextK GUIOuttextwin2 6,25,165,GUISoundTextQ @@ -2243,6 +2233,7 @@ DisplayGUISound: mov dword[GUITemp],GUIIconDataCheckBoxC .nocheckbox1 GUIDisplayIconWin 6,11,30,[GUITemp] +%ifdef __MSDOS__ mov dword[GUITemp],GUIIconDataCheckBoxUC cmp byte[RaisePitch],0 je .nocheckbox1b @@ -2250,7 +2241,6 @@ DisplayGUISound: .nocheckbox1b ; cmp byte[OSPort],3 ; je near .win32 -%ifdef __MSDOS__ GUIDisplayIconWin 6,11,39,[GUITemp] %endif ;.win32 @@ -2266,24 +2256,14 @@ DisplayGUISound: mov dword[GUITemp],GUIIconDataCheckBoxC .nocheckbox3 GUIDisplayIconWin 6,11,111,[GUITemp] -%ifdef __WIN32__ - mov dword[GUITemp],GUIIconDataCheckBoxUC - cmp byte[ExclusiveSound],0 - je .nocheckbox32 - mov dword[GUITemp],GUIIconDataCheckBoxC -.nocheckbox32 - GUIDisplayIconWin 6,11,121,[GUITemp] -%endif ; cmp byte[OSPort],3 ; je near .nocheckbox42 -%ifdef __MSDOS__ mov dword[GUITemp],GUIIconDataCheckBoxUC cmp byte[Surround],0 je .nocheckbox4 mov dword[GUITemp],GUIIconDataCheckBoxC .nocheckbox4 GUIDisplayIconWin 6,11,121,[GUITemp] -%endif mov dword[GUITemp],GUIIconDataCheckBoxUC cmp byte[SoundBufEn],0 je .nocheckbox5 @@ -2419,7 +2399,6 @@ GUISoundTextH db 'REVERSE STEREO',0 GUISoundTextI db 'SURROUND SOUND',0 GUISoundTextJ db 'SOUND BUFFERING',0 GUISoundTextK db 'DISABLE SPC EMULATION',0 -GUISoundTextO db 'EXCLUSIVE MODE',0 GUISoundTextP db 'INTERPOLATION :',0 GUISoundTextQ db 'GAUSSIAN',0 GUISoundTextR db 'CUBIC SPLINE',0 diff --git a/zsnes/src/win/winlink.cpp b/zsnes/src/win/winlink.cpp index b5cd227c..41bacdbf 100644 --- a/zsnes/src/win/winlink.cpp +++ b/zsnes/src/win/winlink.cpp @@ -318,7 +318,6 @@ void DosExit(void); extern BYTE GUIOn2; extern BYTE StereoSound; extern DWORD SoundQuality; -extern BYTE ExclusiveSound; extern BYTE HighPriority; extern BYTE AlwaysOnTop; extern BYTE SaveMainWindowPos; @@ -628,18 +627,7 @@ InitSound() if (DS_OK == pDirectSoundCreate8(NULL, &lpDirectSound,NULL)) { - if (ExclusiveSound == 0) - { - if (DS_OK != lpDirectSound->SetCooperativeLevel(hMainWindow, DSSCL_NORMAL)) - { - if (DS_OK != lpDirectSound->SetCooperativeLevel(hMainWindow, DSSCL_EXCLUSIVE)) - { - SoundEnabled=0; - return FALSE; - } - } - } - else + if (DS_OK != lpDirectSound->SetCooperativeLevel(hMainWindow, DSSCL_NORMAL)) { if (DS_OK != lpDirectSound->SetCooperativeLevel(hMainWindow, DSSCL_EXCLUSIVE)) {