Microsoft DirectX 8.1 (Visual Basic)

DirectSoundSecondaryBuffer8.AcquireResources

The AcquireResources method allocates resources for a buffer created with the DSBCAPS_LOCDEFER flag.

Syntax

object.AcquireResources( _
  lFlags As Long, _
  lEffectsResults() As Long)

Parts

object

Resolves to a DirectSoundSecondaryBuffer8 object.

lFlags

One or more flags from the CONST_DSBPLAYFLAGS enumeration, other than DSBPLAY_LOOPING, specifying how resources are to be allocated.

lEffectsResults

Array of variables of type Long that receives information about the effects associated with the buffer. The number of elements must be equal to the number of effects previously set on the buffer by using DirectSoundSecondaryBuffer8.SetFX. For each effect, one of the following constants from the CONST_DSOUNDFX enumeration is returned.

Value Description
DSFXR_FAILED No effect was created because resources weren't available.
DSFXR_LOCHARDWARE Effect is instantiated in hardware.
DSFXR_LOCSOFTWARE Effect is instantiated in software.
DSFXR_PRESENT The effect is available but was not created because the method failed for some other reason.
DSFXR_UNKNOWN No effect was created because the effect isn't registered on the system.

Error Codes

If the method fails, an error is raised. Possible values for Err.Number include the following:

DSERR_CONTROLUNAVAIL
DSERR_INVALIDCALL
DSERR_INVALIDPARAM

Remarks

Normally, buffers created with DSBCAPS_LOCDEFER are not given resources until DirectSoundSecondaryBuffer8.Play is called. DirectSoundSecondaryBuffer8.AcquireResources can be used to allocate resources for deferred buffers. By doing so, the application can retrieve information about effects processing and set effect parameters before the buffer is played.

If the method fails, the value for each effect in lEffectsResults is either DSFXF_PRESENT or DSFXR_UNKNOWN. Check these values to determine which effects caused the failure.

A buffer with acquired resources that is not yet playing is not a candidate for premature termination by the voice management flags passed to the Play method.

If AcquireResources is called on a buffer on which it has already been called, the status of the effects is returned but no additional resources are allocated.

Resources are released when playback is stopped.

If an attempt is made to acquire resources for a buffer with the DSBCAPS_LOCHARDWARE flag on a system where hardware acceleration is not available, the method fails with either DSERR_CONTROLUNAVAIL or DSERR_INVALIDCALL, depending on the operating system.