summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon
diff options
context:
space:
mode:
authorayuanx <ayuanx@gmail.com>2010-01-14 10:52:14 +0000
committerayuanx <ayuanx@gmail.com>2010-01-14 10:52:14 +0000
commit571a47ef9abb4f6ec01d3f1202b74750f9964d0d (patch)
tree46c90bb862b128cebc588745afc253be8121287e /Source/Core/AudioCommon
parentb186f0821eb6120c395e8ebd4eba1b6835936dbc (diff)
This could alleviate the suffering of dual core synchronization a bit.
But I doubt you would notice it in most cases. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4830 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/AudioCommon')
-rw-r--r--Source/Core/AudioCommon/Src/DSoundStream.cpp8
-rw-r--r--Source/Core/AudioCommon/Src/DSoundStream.h3
-rw-r--r--Source/Core/AudioCommon/Src/OpenALStream.h3
3 files changed, 2 insertions, 12 deletions
diff --git a/Source/Core/AudioCommon/Src/DSoundStream.cpp b/Source/Core/AudioCommon/Src/DSoundStream.cpp
index 2e6cd69146..3d4c868cdb 100644
--- a/Source/Core/AudioCommon/Src/DSoundStream.cpp
+++ b/Source/Core/AudioCommon/Src/DSoundStream.cpp
@@ -106,7 +106,6 @@ void DSound::SoundLoop()
while (!threadData)
{
// No blocking inside the csection
- soundCriticalSection.Enter();
dsBuffer->GetCurrentPosition((DWORD*)&currentPos, 0);
int numBytesToRender = FIX128(ModBufferSize(currentPos - lastPos));
if (numBytesToRender >= 256)
@@ -117,7 +116,6 @@ void DSound::SoundLoop()
WriteDataToBuffer(lastPos, (char*)realtimeBuffer, numBytesToRender);
lastPos = ModBufferSize(lastPos + numBytesToRender);
}
- soundCriticalSection.Leave();
soundSyncEvent.Wait();
}
}
@@ -149,10 +147,8 @@ void DSound::SetVolume(int volume)
// This is in "dBA attenuation" from 0 to -10000, logarithmic
m_volume = (int)floor(log10((float)volume) * 5000.0f) - 10000;
- soundCriticalSection.Enter();
if (dsBuffer != NULL)
dsBuffer->SetVolume(m_volume);
- soundCriticalSection.Leave();
}
void DSound::Update()
@@ -164,7 +160,6 @@ void DSound::Clear(bool mute)
{
m_muted = mute;
- soundCriticalSection.Enter();
if (m_muted)
{
dsBuffer->Stop();
@@ -173,7 +168,6 @@ void DSound::Clear(bool mute)
{
dsBuffer->Play(0, 0, DSBPLAY_LOOPING);
}
- soundCriticalSection.Leave();
}
void DSound::Stop()
@@ -182,13 +176,11 @@ void DSound::Stop()
// kick the thread if it's waiting
soundSyncEvent.Set();
- soundCriticalSection.Enter();
delete thread;
thread = NULL;
dsBuffer->Stop();
dsBuffer->Release();
ds->Release();
- soundCriticalSection.Leave();
soundSyncEvent.Shutdown();
}
diff --git a/Source/Core/AudioCommon/Src/DSoundStream.h b/Source/Core/AudioCommon/Src/DSoundStream.h
index fcf0413ee7..adbeaeb468 100644
--- a/Source/Core/AudioCommon/Src/DSoundStream.h
+++ b/Source/Core/AudioCommon/Src/DSoundStream.h
@@ -32,8 +32,7 @@ class DSound : public SoundStream
{
#ifdef _WIN32
Common::Thread *thread;
- Common::CriticalSection soundCriticalSection;
- Common::Event soundSyncEvent;
+ Common::EventEx soundSyncEvent;
void *hWnd;
IDirectSound8* ds;
diff --git a/Source/Core/AudioCommon/Src/OpenALStream.h b/Source/Core/AudioCommon/Src/OpenALStream.h
index 57bf2e34b7..8aebf32068 100644
--- a/Source/Core/AudioCommon/Src/OpenALStream.h
+++ b/Source/Core/AudioCommon/Src/OpenALStream.h
@@ -64,8 +64,7 @@ public:
private:
Common::Thread *thread;
- Common::CriticalSection soundCriticalSection;
- Common::Event soundSyncEvent;
+ Common::EventEx soundSyncEvent;
short realtimeBuffer[OAL_MAX_SAMPLES * 2];
ALuint uiBuffers[OAL_NUM_BUFFERS];