[PATCH 2/3] xaudio2: Don't report mid-buffer positions

Andrew Eikum aeikum at codeweavers.com
Thu Sep 24 14:34:14 CDT 2015


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---

We update the position every period cycle, which should be
fine-grained enough for applications. This fixes a broken audio issue
with the Avatar: The Game demo, where having more accurate position
reporting caused it to overwrite some parts of the buffer that were
still in use.

 dlls/xaudio2_7/xaudio_dll.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c
index 4f8c76b..5c67ffb 100644
--- a/dlls/xaudio2_7/xaudio_dll.c
+++ b/dlls/xaudio2_7/xaudio_dll.c
@@ -776,13 +776,9 @@ static void WINAPI XA2SRC_GetState(IXAudio2SourceVoice *iface,
 
     EnterCriticalSection(&This->lock);
 
-    if(!(Flags & XAUDIO2_VOICE_NOSAMPLESPLAYED)){
-        ALint bufpos = 0;
-
-        alGetSourcei(This->al_src, AL_SAMPLE_OFFSET, &bufpos);
-
-        pVoiceState->SamplesPlayed = This->played_frames + bufpos;
-    }else
+    if(!(Flags & XAUDIO2_VOICE_NOSAMPLESPLAYED))
+        pVoiceState->SamplesPlayed = This->played_frames;
+    else
         pVoiceState->SamplesPlayed = 0;
 
     if(This->nbufs)
-- 
2.5.3





More information about the wine-patches mailing list