Merge pull request #2472 from degasus/master

AudioCommon: Remove lock on Pause state
This commit is contained in:
Markus Wick 2015-05-30 23:40:46 +02:00
commit c12f04eefa
5 changed files with 0 additions and 27 deletions

View File

@ -121,25 +121,6 @@ namespace AudioCommon
return backends;
}
void PauseAndLock(bool doLock, bool unpauseOnUnlock)
{
if (g_sound_stream)
{
// audio typically doesn't maintain its own "paused" state
// (that's already handled by the CPU and whatever else being paused)
// so it should be good enough to only lock/unlock here.
CMixer* pMixer = g_sound_stream->GetMixer();
if (pMixer)
{
std::mutex& csMixing = pMixer->MixerCritical();
if (doLock)
csMixing.lock();
else
csMixing.unlock();
}
}
}
void UpdateSoundStream()
{
if (g_sound_stream)

View File

@ -17,7 +17,6 @@ namespace AudioCommon
SoundStream* InitSoundStream();
void ShutdownSoundStream();
std::vector<std::string> GetSoundBackends();
void PauseAndLock(bool doLock, bool unpauseOnUnlock = true);
void UpdateSoundStream();
void ClearAudioBuffer(bool mute);
void SendAIBuffer(short* samples, unsigned int num_samples);

View File

@ -108,8 +108,6 @@ unsigned int CMixer::Mix(short* samples, unsigned int num_samples, bool consider
if (!samples)
return 0;
std::lock_guard<std::mutex> lk(m_csMixing);
memset(samples, 0, num_samples * 2 * sizeof(short));
if (PowerPC::GetState() != PowerPC::CPU_RUNNING)

View File

@ -108,8 +108,6 @@ public:
}
}
std::mutex& MixerCritical() { return m_csMixing; }
float GetCurrentSpeed() const { return m_speed.load(); }
void UpdateSpeed(float val) { m_speed.store(val); }
@ -155,7 +153,5 @@ protected:
bool m_log_dtk_audio;
bool m_log_dsp_audio;
std::mutex m_csMixing;
std::atomic<float> m_speed; // Current rate of the emulation (1.0 = 100% speed)
};

View File

@ -690,7 +690,6 @@ bool PauseAndLock(bool doLock, bool unpauseOnUnlock)
ExpansionInterface::PauseAndLock(doLock, unpauseOnUnlock);
// audio has to come after CPU, because CPU thread can wait for audio thread (m_throttle).
AudioCommon::PauseAndLock(doLock, unpauseOnUnlock);
DSP::GetDSPEmulator()->PauseAndLock(doLock, unpauseOnUnlock);
// video has to come after CPU, because CPU thread can wait for video thread (s_efbAccessRequested).