Skip to content
Permalink
Browse files

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.
  • Loading branch information
icculus committed Jul 30, 2014
1 parent e76fecc commit db1dd7560e29e5017d8a1309ca16fdeade7560b8
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/audio/xaudio2/SDL_xaudio2.c
@@ -241,14 +241,14 @@ XAUDIO2_WaitDone(_THIS)
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

0 comments on commit db1dd75

Please sign in to comment.