Microsoft DirectX 8.1 (C++) |
The DuplicateSoundBuffer method creates a new DirectSoundBuffer object that duplicates or shares the original buffer's memory.
This method is deprecated. Duplicate buffers do not share memory on most modern systems, and effects set on the original buffer are not set on the duplicate.
Syntax
HRESULT DuplicateSoundBuffer(
LPDIRECTSOUNDBUFFER pDSBufferOriginal,
LPDIRECTSOUNDBUFFER * ppDSBufferDuplicate
);
Parameters
pDSBufferOriginal
Address of the IDirectSoundBuffer or IDirectSoundBuffer8 interface of the buffer to duplicate.
ppDSBufferDuplicate
Address of a variable that receives the IDirectSoundBuffer interface pointer for the new buffer. The IDirectSoundBuffer8 interface cannot be obtained from duplicate buffers.
Return Values
If the method succeeds, the return value is DS_OK.
If the method fails, the return value may be one of the following error values:
Return code |
DSERR_ALLOCATED |
DSERR_INVALIDCALL |
DSERR_INVALIDPARAM |
DSERR_OUTOFMEMORY |
DSERR_UNINITIALIZED |
Remarks
This method is not valid for buffers created with the DSBCAPS_CTRLFX flag.
Initially, the duplicate buffer will have 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.
The buffer memory is released when the last object referencing it is released.
Although duplicate buffers often share the same memory, this is not always the case. Changes in the data stored in one buffer are not necessarily reflected in its duplicates.
Requirements
Header: Declared in dsound.h.
See Also