Microsoft Windows CE 3.0  

IDirectSoundBuffer::Play

Important:
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 IDirectSoundBuffer::Playmethod causes the sound buffer to play from the current position.

HRESULT Play(
DWORD
dwReserved1
,
DWORD
dwReserved2
,
DWORD
dwFlags
);

Parameters

dwReserved1
This parameter is reserved. Its value must be 0.
dwReserved2
This parameter is reserved. Its value must be 0.
dwFlags
Flags specifying how to play the buffer. The following flag is defined:
Flag Description
DSBPLAY_LOOPING Once the end of the audio buffer is reached, play restarts at the beginning of the buffer. Play continues until explicitly stopped. This flag must be set when playing primary sound buffers.

Return Values

If the method succeeds, the return value is DS_OK.

If the method fails, the return value may be one of the following error values:

Remarks

This method will cause a secondary sound buffer to be mixed into the primary buffer and sent to the sound device. If this is the first buffer to play, it will implicitly create a primary buffer and start playing that buffer; the application need not explicitly direct the primary buffer to play.

If the buffer specified in the method is already playing, the call to the method will succeed and the buffer will continue to play. However, the flags defined in the most recent call supersede flags defined in previous calls.

Primary buffers must be played with the DSBPLAY_LOOPING flag set.

This method will cause primary sound buffers to start playing to the sound device. If the application is set to the DSSCL_WRITEPRIMARY cooperative level, this will cause the audio data in the primary buffer to be sent to the sound device. However, if the application is set to any other cooperative level, this method will ensure that the primary buffer is playing even when no secondary buffers are playing; in that case, silence will be played. This can reduce processing overhead when sounds are started and stopped in sequence, because the primary buffer will be playing continuously rather than stopping and starting between secondary buffers.

Note   Before this method can be called on any sound buffer, the application should call the IDirectSound::SetCooperativeLevelmethod and specify a cooperative level, typically DSSCL_NORMAL. If IDirectSound::SetCooperativeLevelhas not been called, the IDirectSoundBuffer::Playmethod returns with DS_OK, but no sound will be produced until IDirectSound::SetCooperativeLevelis called.

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 2.12 or later. Version 2.12 requires DXPAK 1.0 or later. dsound.h   dsound.lib
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

IDirectSoundBuffer, IDirectSound::SetCooperativeLevel