Looping Playback
You can control looping playback on a waveform-audio output device with the WAVEHDR structure passed into waveOutWrite.
To loop playback
- Set the WHDR_BEGINLOOP flag in the dwFlags member of the WAVEHDR structure.
This flag defines the beginning data block of a message loop.
- Set the number of loops in the dwLoops member of the same WAVEHDR structure.
- Pass this, and the remaining data blocks, to waveOutWrite.
- Pass the final data block to waveOutWrite with the WHDR_ENDLOOP flag set in the WAVEHDR structure.
This causes your device to begin looping.
- Use waveOutBreakLoop to break out of the loop prematurely.
Note Loop a single block by setting the WHDR_BEGINLOOP and WHDR_ENDLOOP flags in the same WAVEHDR structure.