Play Management

Your application can use the IDirectSoundBuffer::Play and IDirectSoundBuffer::Stop methods to control the real-time playback of sound. The application can also play a sound by using IDirectSoundBuffer::Play. The buffer stops automatically when its end is reached. However, if the application specifies looping, the buffer repeats until the application calls IDirectSoundBuffer::Stop.

The IDirectSoundBuffer::Lock method retrieves a write pointer to the current sound buffer. After writing audio data to the buffer, you must unlock the buffer by using the IDirectSoundBuffer::Unlock method. You should not leave the buffer locked for extended periods.

To retrieve or set the current position in the sound buffer, call the IDirectSoundBuffer::GetCurrentPosition or IDirectSoundBuffer::SetCurrentPosition method.