I'm trying to stream an MS ADPCM file using XAudio2 (in C++, but this problem doesn't appear to be language related).
The file is encoded with ADPCMEncode.exe, this gives a WAV file with a format tag of WAVE_FORMAT_ADPCM.
Like any stream, I create a IXAudio2SourceVoice (with the full ADPCMWAVEFORMAT from the start of the file) and feed it block-aligned buffers as it requests them. The data appears to be playing fine, until the time comes to loop.
The looping reader is as you would expect: If a short read happens, return the offset to the start and do another read to fill up the rest of the buffer. Fine for PCM, but for MS ADPCM sometimes the voice will stop. It appears to stop asking for more buffers, and so runs out and stops.
The timing of the error varies. Sometimes it happens as soon as the data loops, sometimes after looping several times. There's obviously some additional information I need to pass via the XAUDIO2_BUFFER, but I can't find any docs telling me what.
Can anybody point me in the right direction?