This patch fix two problem: 1. the improper play position return by DSOUND_PrimaryGetPosition - beffer underrun, 2. and the notify mechanics we used - sound data skipped. Please refer to the comment for the first problem. DSOUND_CheckEvent(IDirectSoundBufferImpl *dsb, int len) original use current play position and the count of data TO BE played to check if a notify should be generated. That's to say, an application may be notified before the data at the desired offset really played. Since the application got the notify that the data in it's demand region is useless (played), it might call IDirectSoundBufferImpl_Lock to lock this region, which contains useful data, IDirectSoundBufferImpl_Lock will handle the conflict by cancelling the region by default. NOTE: There are still problems with DSBPN_OFFSETSTOP event. If the buffer's state is STATE_STOPPED, my patch will set the event each time DSOUND_PerformMix called by the timer! I know it's a bad idea, so if anyone have a better solution, please re-patch it. ChangeLog: - Fixed buffer underrun & sound chunks left out.
Attachment:
patch.diff
Description: Binary data