Fixed annoying sound when pausing/shutting down (please test for ALL backends) (couldn't do this for CoreAudio and PulseAudio too)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4676 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY
2009-12-10 21:00:52 +00:00
parent d901fd2e38
commit 6bea0a2f53
10 changed files with 67 additions and 3 deletions

View File

@ -42,6 +42,7 @@ PLUGIN_GLOBALS* globals = NULL;
DSPInitialize g_dspInitialize;
u8* g_pMemory;
extern std::vector<std::string> sMailLog, sMailTime;
bool g_bMuted = false;
SoundStream *soundStream = NULL;
@ -204,6 +205,8 @@ void Initialize(void *init)
{
g_dspInitialize = *(DSPInitialize*)init;
g_bMuted = false;
g_Config.Load();
g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
@ -314,6 +317,10 @@ unsigned short DSP_ReadControlRegister()
void DSP_Update(int cycles)
{
// Handle muting
if(g_bMuted && !*g_dspInitialize.pEmulatorState && soundStream)
soundStream->Mute(g_bMuted = false);
// This is called OFTEN - better not do anything expensive!
CDSPHandler::GetInstance().Update(cycles);
}
@ -365,4 +372,6 @@ void DSP_ClearAudioBuffer()
{
if (soundStream)
soundStream->Clear();
if(*g_dspInitialize.pEmulatorState && soundStream && !g_bMuted)
soundStream->Mute(g_bMuted = true);
}