|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
The IDsDriverBuffer::GetPositionmethod is called when DirectSound is querying the current position of the specified sound buffer.
HRESULT GetCurrentPosition( LPDWORD lpdwCurrentPlayCursor , LPDWORD lpdwCurrentWriteCursor );
Returns DS_OK if successful, or one of the following error values otherwise:
The driver returns two values: the current play cursor, and the current write cursor. The play cursor is the position which is currently being played. The write cursor is the next position at which it is acceptable to write new data into the buffer. The write cursor should be as close as possible to the play cursor — preferably within one or two samples. Note that DirectSound does not return these exact values to applications; instead it adds a buffer zone of about 10 milliseconds to the write cursor to cover multi-tasking delays, and so on.
Some hardware may not be able to notify DirectSound when a one-shot buffer has finished playing. Therefore, if the driver returns a position that is equal to the length of the buffer, DirectSound assumes that the buffer has finished playing and should stop. DirectSound then calls IDsDriverBuffer::Stopon that buffer. This should only happen for one-shot secondary buffers.
Last updated on Tuesday, July 13, 2004