DSDM_CREATEBUFFER

This message requests that the driver create a hardware sound buffer with specific attributes. If the driver is able to create the sound buffer and allocate the required resources, it returns a pointer to the buffer instance data that DirectSound uses to control the sound buffer. Otherwise the driver fails the request by returning an error code.

typedef struct {
  DWORD dwMsg;
  PDWORD pdwInstance;
  DWORD dwDeviceIndex;
  LPCDSBUFFERDESC pDesc;
} DSDMP_CREATEBUFFER;

Members

  • dwMsg
    Equals DSDM_CREATEBUFFER.
  • pdwInstance
    Pointer to instance data for new buffer.
  • dwDeviceIndex
    Index of the device in which to create the buffer.
  • pDesc
    Pointer to a DSBUFFERDESC structure that contains the description of the sound buffer to be created.

Return Values

Returns DS_OK if successful, or one of the following error values otherwise.

Error value Description
DSERR_ALLOCATED The call failed because resources are already being used by another caller.
DSERR_INVALIDPARAM An invalid parameter was passed to the returning function.
DSERR_OUTOFMEMORY Not enough free memory is available to complete the operation.
DSERR_BADFORMAT The specified format is not supported.

Remarks

The driver should always check the DSBCAPS_CTRLXXX flags passed in the dwFlags parameter. If the driver cannot create a buffer with the requested control attributes, it should fail the creation request. If the driver succeeds the creation request, it is required to succeed the control requests when called on this buffer.

The DSBUFFERDESC structure pointed to by pDesc will not persist after the driver handles the DSDM_CREATEBUFFER message. If the driver must reference the WAVEFORMATEX structure pointed to by pDesc->lpwfxFormat, it must make a private copy.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Dsdriver.h.

See Also

DSBUFFERDESC | WAVEFORMATEX | DirectSound Driver Messages

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.