Win32 - more turbo sound skip fix. Sound is completely bypassed if muteturbo is set

This commit is contained in:
adelikat 2008-12-19 16:17:07 +00:00
parent 9716bd99e3
commit 5a0185c0ad
3 changed files with 22 additions and 9 deletions

View File

@ -40,9 +40,10 @@ LPDIRECTINPUT7 lpDI=0;
void InitInputPorts(bool fourscore); void InitInputPorts(bool fourscore);
int tempwinsync = 0; int tempwinsync = 0; //Temp variable used by turbo to turn of sync settings
int tempsoundquality = 0; //Temp variable used by turbo to turn of sound quality settings
extern int winsync; extern int winsync;
extern int soundquality;
//UsrInputType[] is user-specified. InputType[] is current //UsrInputType[] is user-specified. InputType[] is current
// (game/savestate/movie loading can override user settings) // (game/savestate/movie loading can override user settings)
@ -1481,22 +1482,32 @@ void FCEUD_TurboOn (void)
{ {
tempwinsync = winsync; //Store winsync setting tempwinsync = winsync; //Store winsync setting
winsync = 0; //turn off winsync for turbo (so that turbo can function even with VBlank sync methods winsync = 0; //turn off winsync for turbo (so that turbo can function even with VBlank sync methods
tempsoundquality = soundquality; //Store sound quality settings
FCEUI_SetSoundQuality(0); //Turn sound quality to low
turbo = true; turbo = true;
if (muteTurbo && soundo) TrashSound(); if (muteTurbo && soundo) TrashSound();
} }
void FCEUD_TurboOff (void) void FCEUD_TurboOff (void)
{ {
winsync = tempwinsync; //Restore winsync setting winsync = tempwinsync; //Restore winsync setting
soundquality = tempsoundquality; //Restore sound quality settings
FCEUI_SetSoundQuality(soundquality);
turbo = false; turbo = false;
if (muteTurbo && soundo) InitSound(); if (muteTurbo && soundo) InitSound();
} }
void FCEUD_TurboToggle(void) void FCEUD_TurboToggle(void)
{ {
if (turbo) winsync = tempwinsync; //If turbo was on, restore winsync if (turbo) {
winsync = tempwinsync; //If turbo was on, restore winsync
soundquality = tempsoundquality; //and restore sound quality setting
FCEUI_SetSoundQuality(soundquality);
}
else else
{ {
tempwinsync = winsync; tempwinsync = winsync; //Store video sync settings
winsync = 0; //If turbo was off, turn off winsync (so that turbo can function even with VBlank sync methods tempsoundquality = soundquality; //Store sound quality settings
winsync = 0; //If turbo was off, turn off winsync (so that turbo can function even with VBlank sync methods
FCEUI_SetSoundQuality(0); //Set sound quality to low
} }
turbo = !turbo; turbo = !turbo;

View File

@ -693,7 +693,7 @@ doloopy:
{ {
frameSkipCounter--; frameSkipCounter--;
if (muteTurbo) skippy = 2; //If mute turbo is on, we want to bypass sound too, so set it to 2 if (muteTurbo) skippy = 2; //If mute turbo is on, we want to bypass sound too, so set it to 2
skippy = 1; //Else set it to 1 to just frameskip else skippy = 1; //Else set it to 1 to just frameskip
} }
} }

View File

@ -26,6 +26,8 @@
#include "common.h" #include "common.h"
#include "main.h" #include "main.h"
extern bool turbo; //If turbo is running
/// controls whether playback is muted /// controls whether playback is muted
static bool mute = false; static bool mute = false;
/// indicates whether we've been coerced into outputting 8bit audio /// indicates whether we've been coerced into outputting 8bit audio
@ -503,7 +505,7 @@ case WM_COMMAND:
if(soundrate<44100) if(soundrate<44100)
{ {
soundquality=0; soundquality=0;
FCEUI_SetSoundQuality(0); if (!turbo) FCEUI_SetSoundQuality(0); ///If turbo is running, don't do this call, turbo will handle it instead
UpdateSD(hwndDlg); UpdateSD(hwndDlg);
} }
if(soundo) if(soundo)
@ -519,7 +521,7 @@ case WM_COMMAND:
case COMBO_SOUND_QUALITY: case COMBO_SOUND_QUALITY:
soundquality=SendDlgItemMessage(hwndDlg,COMBO_SOUND_QUALITY,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); soundquality=SendDlgItemMessage(hwndDlg,COMBO_SOUND_QUALITY,CB_GETCURSEL,0,(LPARAM)(LPSTR)0);
if(soundrate<44100) soundquality=0; if(soundrate<44100) soundquality=0;
FCEUI_SetSoundQuality(soundquality); if (!turbo) FCEUI_SetSoundQuality(soundquality); //If turbo is running, don't do this call, turbo will handle it instead
UpdateSD(hwndDlg); UpdateSD(hwndDlg);
break; break;
} }