Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MMEBUDDY] Implement support for looped wave playback
Fix playing wave header multiple times in case the caller requests to do it. In Windows, it is supported by WHDR_BEGINLOOP and WHDR_ENDLOOP flags (specified together) and dwLoops member of WAVEHDR structure (ususally set to 0xFFFFFFFF (INFINITE constant)). - Check whenther WHDR_BEGINLOOP | WHDR_ENDLOOP flags are set by the caller. - If they are, get the amount of times to play the header from WAVEHDR.dwLoops. - Perform wave header competion only when the loop count is equal to zero. Otherwise, don't do it. - When the header is entirely committed, in case completion is not needed, reset committed bytes count to the starting value to allow the header play again. - Decrement loop count in that case, to mark loop as played correctly. When this count becomes zero, the playback is finished. - Do this only for WaveOut devices, since MSDN states it works only with output buffers. Hence, there is nothing changed for WaveIn. - Update an appropriate statement about unimplemented functionality from mmebuddy notes. TODO: probably handle the case when multiple headers are requested to be looped (WHDR_BEGINLOOP and WHDR_ENDLOOP are set separatedly: 1st flag - in the 1st header, and 2nd in the last header). Currently, only looping a single wave header is supported (if I'm not wrong here). This fixes the playback in the apps those request looped wave playback of some audio data (e. g., BRD Demo app, which did play its sound only first 500 ms before, now it plays endlessly until closing it manually). CORE-10118
- Loading branch information