Platform SDK: DirectX

DirectSound.DuplicateSoundBuffer

The DirectSound.DuplicateSoundBuffer method creates a new DirectSoundBuffer object that uses the same buffer memory as the original object.

object.DuplicateSoundBuffer( _
    original As DirectSoundBuffer) _
    As DirectSoundBuffer

Parameters

object
Object expression that resolves to a DirectSound object.
original
DirectSoundBuffer object to duplicate.

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_INVALIDCALL
DSERR_OUTOFMEMORY
DSERR_UNINITIALIZED

Remarks

The new object can be used just like the original.

Initially, the duplicate buffer has the same parameters as the original buffer. However, the application can change the parameters of each buffer independently, and each can be played or stopped without affecting the other.

If data in the buffer is changed through one object, the change is normally reflected in the other object because the buffer memory is shared. However, this behavior should not be relied on, because in some circumstances the duplicate buffer has its own memory.

The buffer memory will be released when the last object referencing it is released.

Applications cannot assume that an attempt to duplicate a sound buffer will succeed. In particular, DirectSound does not create a software duplicate of a hardware buffer.

See Also

DirectSound.CreateSoundBuffer, DirectSound.CreateSoundBufferFromFile, DirectSound.CreateSoundBufferFromResource