IDirectSound::CreateSoundBuffer
HRESULT CreateSoundBuffer(LPDSBUFFERDESC lpDSBufferDesc,
LPLPDIRECTSOUNDBUFFER * lplpDirectSoundBuffer,
IUnknown FAR * pUnkOuter);
Creates a DirectSoundBuffer object to hold a sequence of audio samples.
·Returns DS_OK if successful, or one of the following error values otherwise:
DSERR_ALLOCATED | DSERR_BADFORMAT |
DSERR_INVALIDPARAM | DSERR_NOAGGREGATION |
DSERR_OUTOFMEMORY | DSERR_UNINITIALIZED |
DSERR_UNSUPPORTED |
lpDSBufferDesc
Address of a DSBUFFERDESC structure that contains the description of the sound buffer to be created.
lplpDirectSoundBuffer
Address of a pointer to the new DirectSoundBuffer object or NULL if the buffer cannot be created.
pUnkOuter
Controlling unknown of the aggregate. Its value must be NULL.
Before it can play any sound buffers, the application must specify a cooperative level for a DirectSound object by using the IDirectSound::SetCooperativeLevel method.
The lpDSBufferDesc parameter points to a structure that describes the type of buffer desired, including format, size, and capabilities. The application must specify the needed capabilities, or they will not be available. For example, if the application creates a DirectSoundBuffer object without specifying the DSBCAPS_CTRLFREQUENCY flag, any call to IDirectSoundBuffer::SetFrequency will fail.
The DSBCAPS_STATIC flag can also be specified, in which case DirectSound stores the buffer in onboard memory, if available, in order to take advantage of hardware mixing. To force the buffer to use either hardware or software mixing, use the DSBCAPS_LOCHARDWARE or DSBCAPS_LOCSOFTWARE flags.