Microsoft DirectX 8.1 (Visual Basic)

DirectSound8.CreateSoundBufferFromResource

The CreateSoundBufferFromResource method creates a secondary buffer to mix audio samples into the primary buffer, and loads data from a resource into the buffer. The sound resource must be of type WAV or WAVE.

Syntax

object.CreateSoundBufferFromResource( _
  dll As String, _
  resourceName As String, _
  bufferDesc As DSBUFFERDESC _
) As DirectSoundSecondaryBuffer8

Parts

object

Resolves to a DirectSound8 object.

dll

Name of the DLL that contains the resource, or vbNullString if the resource is contained in the executable file.

resourceName

Name of the resource to load into the created sound buffer.

bufferDesc

DSBUFFERDESC type that specifies the description of the sound buffer to create. The fxFormat and lBufferBytes members are ignored, as the method determines the format and size from the data itself.

Return Values

Returns a DirectSoundSecondaryBuffer8 object.

Error Codes

If the method fails, an error is raised and Err.Number may be one of the following error values.

DSERR_ALLOCATED
DSERR_BADFORMAT
DSERR_BUFFERTOOSMALL
DSERR_CONTROLUNAVAIL
DSERR_INVALIDCALL
DSERR_OUTOFMEMORY
DSERR_UNINITIALIZED
DSERR_UNSUPPORTED

Remarks

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 DSERR_CONTROLUNAVAIL on Windows 98. On Windows 2000, it returns DSERR_INVALIDCALL.

See Also