Microsoft DirectX 8.1 (Visual Basic)

DirectSoundPrimaryBuffer8.WriteBuffer

The WriteBuffer method writes audio data to the buffer.

It is not recommended that applications write directly to the primary buffer. Calling DirectSoundSecondaryBuffer8.Play causes data from the secondary buffer to be mixed into the primary buffer.

Syntax

object.WriteBuffer( _
  start As Long, _
  size As Long, _
  buffer As Any, _
  flags As CONST_DSBLOCKFLAGS)

Parts

object

Resolves to a DirectSoundPrimaryBuffer8 object.

start

Offset, in bytes, from the start of the buffer to where the read begins. This parameter is ignored if DSBLOCK_FROMWRITECURSOR constant is specified in the flags parameter.

size

Size, in bytes, of the portion of the buffer to read. The sound buffer is conceptually circular, so this value can be greater than the number of bytes between start and the end of the buffer. This parameter is ignored if DSBLOCK_ENTIREBUFFER constant is specified in the flags parameter.

buffer

Variable that contains the data to write to the sound buffer. Typically this is an array of bytes, and you pass the first element of the array.

flags

One of the constants of the CONST_DSBLOCKFLAGS enumeration specifying how to write the data.

Error Codes

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

DSERR_BUFFERLOST
DSERR_INVALIDCALL
DSERR_INVALIDPARAM
DSERR_PRIOLEVELNEEDED