XAudio2: Use XAUDIO2_VOICE_NOSAMPLESPLAYED when possible.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 30 Jul 2014 09:54:01 -0400
changeset 9030 3ac4c7b7c769
parent 9025 d09d4b578e77
child 9031 e963a13a720c
XAudio2: Use XAUDIO2_VOICE_NOSAMPLESPLAYED when possible. For versions of XAudio2 with an IXAudio2SourceVoice::GetState() that offers a flags parameter, we can use XAUDIO2_VOICE_NOSAMPLESPLAYED, since we don't need this information in our current calls. According to MSDN, this makes the the call about 3x faster.
src/audio/xaudio2/SDL_xaudio2.c
--- a/src/audio/xaudio2/SDL_xaudio2.c	Tue Jul 29 08:04:15 2014 -0700
+++ b/src/audio/xaudio2/SDL_xaudio2.c	Wed Jul 30 09:54:01 2014 -0400
@@ -241,14 +241,14 @@
     SDL_assert(!this->enabled);  /* flag that stops playing. */
     IXAudio2SourceVoice_Discontinuity(source);
 #if SDL_XAUDIO2_WIN8
-    IXAudio2SourceVoice_GetState(source, &state, 0);
+    IXAudio2SourceVoice_GetState(source, &state, XAUDIO2_VOICE_NOSAMPLESPLAYED);
 #else
     IXAudio2SourceVoice_GetState(source, &state);
 #endif
     while (state.BuffersQueued > 0) {
         SDL_SemWait(this->hidden->semaphore);
 #if SDL_XAUDIO2_WIN8
-        IXAudio2SourceVoice_GetState(source, &state, 0);
+        IXAudio2SourceVoice_GetState(source, &state, XAUDIO2_VOICE_NOSAMPLESPLAYED);
 #else
         IXAudio2SourceVoice_GetState(source, &state);
 #endif