diff options
| author | hyperiris <hyperiris@gmail.com> | 2009-06-12 14:40:50 +0000 |
|---|---|---|
| committer | hyperiris <hyperiris@gmail.com> | 2009-06-12 14:40:50 +0000 |
| commit | ff0ec2b3f861038baae8a9ec2ba9dee86fb02066 (patch) | |
| tree | 5597cb3b7a69ca6a6b33bcef6d21096eff80443c /Source/Core/AudioCommon/Src/OpenALStream.cpp | |
| parent | b8d3cae6e327fae1d5bc28bcc86b4aca765fbf73 (diff) | |
a NEED DEBUG version of openal sound system, nakee, try to FIX it! :)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3409 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/AudioCommon/Src/OpenALStream.cpp')
| -rw-r--r-- | Source/Core/AudioCommon/Src/OpenALStream.cpp | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/Source/Core/AudioCommon/Src/OpenALStream.cpp b/Source/Core/AudioCommon/Src/OpenALStream.cpp index 3d21b9c7b7..672d581151 100644 --- a/Source/Core/AudioCommon/Src/OpenALStream.cpp +++ b/Source/Core/AudioCommon/Src/OpenALStream.cpp @@ -86,7 +86,10 @@ void OpenALStream::Stop() void OpenALStream::Update()
{
- soundSyncEvent.Set();
+ //if (m_mixer->GetDataSize()) //here need debug
+ {
+ soundSyncEvent.Set();
+ }
}
THREAD_RETURN OpenALStream::ThreadFunc(void* args)
@@ -120,28 +123,37 @@ void OpenALStream::SoundLoop() while (!threadData)
{
- ALint iBuffersProcessed = 0;
- alGetSourcei(uiSource, AL_BUFFERS_PROCESSED, &iBuffersProcessed);
+ soundCriticalSection.Enter();
+ int numBytesToRender = 32768; //ya, this is a hack, we need real data count
+ int numBytesRender = m_mixer->Mix(realtimeBuffer, numBytesToRender >> 2);
+ soundCriticalSection.Leave();
- if (iBuffersProcessed)
+ //if (numBytesRender) //here need debug
{
- // Remove the Buffer from the Queue. (uiBuffer contains the Buffer ID for the unqueued Buffer)
- ALuint uiTempBuffer = 0;
- alSourceUnqueueBuffers(uiSource, 1, &uiTempBuffer);
+ ALint iBuffersProcessed = 0;
+ alGetSourcei(uiSource, AL_BUFFERS_PROCESSED, &iBuffersProcessed);
- soundCriticalSection.Enter();
- int numBytesToRender = 32768; //ya, this is a hack, we need real data count
- m_mixer->Mix(realtimeBuffer, numBytesToRender >> 2);
- soundCriticalSection.Leave();
-
- unsigned long ulBytesWritten = 0;
- //if (ulBytesWritten)
+ if (iBuffersProcessed)
{
- //alBufferData(uiTempBuffer, ulFormat, pDecodeBuffer, ulBytesWritten, ulFrequency);
- alBufferData(uiTempBuffer, AL_FORMAT_STEREO16, realtimeBuffer, numBytesToRender, ulFrequency);
+ // Remove the Buffer from the Queue. (uiBuffer contains the Buffer ID for the unqueued Buffer)
+ ALuint uiTempBuffer = 0;
+ alSourceUnqueueBuffers(uiSource, 1, &uiTempBuffer);
+/*
+ soundCriticalSection.Enter();
+ int numBytesToRender = 32768; //ya, this is a hack, we need real data count
+ m_mixer->Mix(realtimeBuffer, numBytesToRender >> 2);
+ soundCriticalSection.Leave();
+
+ unsigned long ulBytesWritten = 0;
+*/
+ //if (numBytesRender)
+ {
+ alBufferData(uiTempBuffer, AL_FORMAT_STEREO16, realtimeBuffer, numBytesToRender, ulFrequency);
+ }
alSourceQueueBuffers(uiSource, 1, &uiTempBuffer);
}
}
+
if (!threadData)
soundSyncEvent.Wait();
}
|
