Skip to content

Commit

Permalink
Merge pull request #2472 from degasus/master
Browse files Browse the repository at this point in the history
AudioCommon: Remove lock on Pause state
  • Loading branch information
degasus committed May 30, 2015
2 parents ff29ffe + 9a96e3c commit c12f04e
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 27 deletions.
19 changes: 0 additions & 19 deletions Source/Core/AudioCommon/AudioCommon.cpp
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion Source/Core/AudioCommon/AudioCommon.h
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/AudioCommon/Mixer.cpp
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions Source/Core/AudioCommon/Mixer.h
Expand Up @@ -108,8 +108,6 @@ class CMixer {
}
}

std::mutex& MixerCritical() { return m_csMixing; }

float GetCurrentSpeed() const { return m_speed.load(); }
void UpdateSpeed(float val) { m_speed.store(val); }

Expand Down Expand Up @@ -155,7 +153,5 @@ class CMixer {
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)
};
1 change: 0 additions & 1 deletion Source/Core/Core/Core.cpp
Expand Up @@ -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).
Expand Down

0 comments on commit c12f04e

Please sign in to comment.