Microsoft DirectX 8.0 (Visual Basic)

DirectSound8.CreateSoundBufferFromFile

Creates a secondary buffer to mix audio samples into the primary buffer, and loads data from a file into the buffer.

object.CreateSoundBufferFromFile( _
  filename As String, _
  bufferDesc As DSBUFFERDESC _
) As DirectSoundSecondaryBuffer8

Parts

object
Resolves to a DirectSound8 object.
filename
Name of the wave file to load into the created 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 95 and Windows 98. On Windows 2000, it returns DSERR_INVALIDCALL.

See Also

DirectSound8.CreateSoundBuffer, DirectSound8.CreateSoundBufferFromResource, DirectSound8.DuplicateSoundBuffer