Play Management

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

The IDirectSoundBuffer::Lock method retrieves a write pointer into the current sound buffer. After writing audio data into 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.