Looping Sounds

DirectSound does not directly support looping within a buffer, or repetition of only a portion of a sound. (The DSBPLAY_LOOPING flag causes the entire buffer to play again when the play cursor reaches the end.) Although it is possible to implement looping on a static buffer by resetting the play cursor to the start of the loop each time it reaches the end of the loop, doing so might result in audio glitches, as DirectSound must discard any preprocessed data and begin preprocessing again.

To repeat a portion of a sound, play the sound in a streaming buffer and implement the loop in your source data.

See Also

Using Streaming Buffers