Microsoft DirectX 8.1 (C++) |
The CreateSoundBuffer method creates a DirectSoundBuffer object to hold a sequence of audio samples.
Syntax
HRESULT CreateSoundBuffer(
LPCDSBUFFERDESC pcDSBufferDesc,
LPDIRECTSOUNDBUFFER * ppDSBuffer,
LPUNKNOWN pUnkOuter
);
Parameters
pcDSBufferDesc
Address of a DSBUFFERDESC structure that describes the sound buffer to create.
ppDSBuffer
Address of a variable that receives the IDirectSoundBuffer interface of the new buffer object. Use QueryInterface to obtain IDirectSoundBuffer8. IDirectSoundBuffer8 is not available for the
pUnkOuter
Address of the controlling object's IUnknown interface for COM aggregation. Must be NULL.
Return Values
If the method succeeds, the return value is DS_OK, or DS_NO_VIRTUALIZATION if a requested 3-D algorithm was not available and stereo panning was substituted. See the description of the guid3DAlgorithm member of DSBUFFERDESC.
If the method fails, the return value may be one of the error values shown in the following table.
Remarks
DirectSound does not initialize the contents of the buffer, and the application cannot assume that it contains silence.
If the application is multithreaded, the thread that creates the buffer must continue to exist for the lifetime of the buffer. Buffers created on WDM drivers stop playing when the thread is terminated.
If an attempt is made to create a buffer with the DSBCAPS_LOCHARDWARE flag on a system where hardware acceleration is not available, the method fails with either DSERR_CONTROLUNAVAIL or DSERR_INVALIDCALL, depending on the operating system.
Requirements
Header: Declared in dsound.h.
See Also