Platform SDK: DirectX

DirectSound.CreateSoundBufferFromResource

The DirectSound.CreateSoundBufferFromResource method creates a DirectSoundBuffer object to hold a sequence of audio samples, and loads the data from the resource into the buffer. The sound resource must be of type WAV or WAVE.

object.CreateSoundBufferFromResource( _
    dll As String, _
    resourceName As String, _
    bufferDesc As DSBUFFERDESC, _
    format As WAVEFORMATEX) As DirectSoundBuffer

Parameters

object
Object expression that resolves to a DirectSound object.
dll
Name of the DLL that contains the resource, or an empty string 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 lBufferBytes member is ignored.
format
WAVEFORMATEX type that receives information about the wave format of the resource. The members do not have to be initialized before this type is passed to the method.

Return Values

If the method succeeds, a DirectSoundBuffer is returned.

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_OUTOFMEMORY
DSERR_UNINITIALIZED
DSERR_UNSUPPORTED

See Also

DirectSound.CreateSoundBuffer, DirectSound.CreateSoundBufferFromFile, DirectSound.DuplicateSoundBuffer