DirectX SDK

DirectSoundBuffer.WriteBuffer

The DirectSoundBuffer.WriteBuffer method writes to a segment of the sound buffer from a variable holding audio data.

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

Parameters

object
Object expression that resolves to a DirectSoundBuffer 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. Note that the sound buffer is conceptually circular.
buffer
Variable with the data to be written to the sound buffer. Must be the same size as the sound buffer. You must pass the first element of the array.
flags
One of the following constants of the CONST_DSBLOCKFLAGS enumeration that modifies what is read:
DSBLOCK_FROMWRITECURSOR
Writes from the current write position, making a call to DirectSoundBuffer.GetCurrentPosition method unnecessary. If this flag is specified, the start parameter is ignored.
DSBLOCK_ENTIREBUFFER
Writes to the entire buffer. The size parameter is ignored.

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