Fixes Issue 2004

This also mutes the sound when paused in Debug mode.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4825 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx
2010-01-13 14:18:13 +00:00
parent 429691ce96
commit 5aac8a5437
5 changed files with 10 additions and 9 deletions

View File

@ -490,13 +490,9 @@ void SetState(EState _State)
break; break;
case CORE_PAUSE: case CORE_PAUSE:
CCPU::EnableStepping(true); // Break CCPU::EnableStepping(true); // Break
CPluginManager::GetInstance().GetDSP()->DSP_ClearAudioBuffer();
CPluginManager::GetInstance().EmuStateChange(PLUGIN_EMUSTATE_PAUSE);
break; break;
case CORE_RUN: case CORE_RUN:
CCPU::EnableStepping(false); CCPU::EnableStepping(false);
CPluginManager::GetInstance().GetDSP()->DSP_ClearAudioBuffer();
CPluginManager::GetInstance().EmuStateChange(PLUGIN_EMUSTATE_PLAY);
break; break;
default: default:
PanicAlert("Invalid state"); PanicAlert("Invalid state");

View File

@ -18,6 +18,7 @@
#include "Common.h" #include "Common.h"
#include "Thread.h" #include "Thread.h"
#include "../PluginManager.h"
#include "../PowerPC/PowerPC.h" #include "../PowerPC/PowerPC.h"
#include "../Host.h" #include "../Host.h"
#include "../Core.h" #include "../Core.h"
@ -117,12 +118,14 @@ void CCPU::EnableStepping(const bool _bStepping)
PowerPC::Pause(); PowerPC::Pause();
// TODO(ector): why a sleep? // TODO(ector): why a sleep?
Host_SetDebugMode(true); Host_SetDebugMode(true);
CPluginManager::GetInstance().EmuStateChange(PLUGIN_EMUSTATE_PAUSE);
} }
else else
{ {
Host_SetDebugMode(false); Host_SetDebugMode(false);
PowerPC::Start(); PowerPC::Start();
m_StepEvent.Set(); m_StepEvent.Set();
CPluginManager::GetInstance().EmuStateChange(PLUGIN_EMUSTATE_PLAY);
} }
} }

View File

@ -109,7 +109,7 @@ EXPORT void CALL DSP_StopSoundStream();
// __________________________________________________________________________________________________ // __________________________________________________________________________________________________
// Function: DSP_ClearAudioBuffer // Function: DSP_ClearAudioBuffer
// Purpose: Stops audio. Called while pausing to stop the annoying noises. // Purpose: Stops audio. Called while pausing to stop the annoying noises.
EXPORT void CALL DSP_ClearAudioBuffer(); EXPORT void CALL DSP_ClearAudioBuffer(bool mute);
#include "ExportEpilog.h" #include "ExportEpilog.h"
#endif #endif

View File

@ -245,6 +245,7 @@ void DoState(unsigned char **ptr, int mode)
void EmuStateChange(PLUGIN_EMUSTATE newState) void EmuStateChange(PLUGIN_EMUSTATE newState)
{ {
DSP_ClearAudioBuffer((newState == PLUGIN_EMUSTATE_PLAY) ? false : true);
} }
// Mailbox fuctions // Mailbox fuctions
@ -356,8 +357,8 @@ void DSP_SendAIBuffer(unsigned int address, unsigned int num_samples)
soundStream->Update(); soundStream->Update();
} }
void DSP_ClearAudioBuffer() void DSP_ClearAudioBuffer(bool mute)
{ {
if (soundStream) if (soundStream)
soundStream->Clear(!!*g_dspInitialize.pEmulatorState); soundStream->Clear(mute);
} }

View File

@ -192,6 +192,7 @@ void DoState(unsigned char **ptr, int mode)
void EmuStateChange(PLUGIN_EMUSTATE newState) void EmuStateChange(PLUGIN_EMUSTATE newState)
{ {
DSP_ClearAudioBuffer((newState == PLUGIN_EMUSTATE_PLAY) ? false : true);
} }
void DllDebugger(HWND _hParent, bool Show) void DllDebugger(HWND _hParent, bool Show)
@ -400,9 +401,9 @@ void DSP_SendAIBuffer(unsigned int address, unsigned int num_samples)
soundStream->Update(); soundStream->Update();
} }
void DSP_ClearAudioBuffer() void DSP_ClearAudioBuffer(bool mute)
{ {
if (soundStream) if (soundStream)
soundStream->Clear((*g_dspInitialize.pEmulatorState) ? true : false); soundStream->Clear(mute);
} }