Share via


SecondaryBuffer.AcquireResources(Int32,Int32) Method (Microsoft.DirectX.DirectSound)

Allocates resources for a SecondaryBuffer object that was created with the DeferLocation flag set in the BufferDescription.

Definition

Visual Basic Public Function AcquireResources( _
    ByVal flags As Integer, _
    ByVal effectsCount As Integer _
) As EffectsReturnValue()
C# public EffectsReturnValue[] AcquireResources(
    int flags,
    int effectsCount
);
C++ public:
array<EffectsReturnValue>^ AcquireResources(
    int flags,
    int effectsCount
);
JScript public function AcquireResources(
    flags : int,
    effectsCount : int
) : EffectsReturnValue[];

Parameters

flags System.Int32
Specifies how resources are to be allocated for the SecondaryBuffer object. For a list of values, see the voice management and voice allocation flags in the BufferPlayFlags enumeration.
effectsCount System.Int32
Number of Microsoft DirectSound effect objects in the SecondaryBuffer set by the SetEffects method.

Return Value

Microsoft.DirectX.DirectSound.EffectsReturnValue[]
An array that contains one element for each of the DirectSound effect objects that was assigned to the SecondaryBuffer object by the SetEffects method. One of the following values is returned for each DirectSound effect object.

Remarks

In order to use the BufferPlayFlags enumeration in the flags parameter, you must cast it to an integer, as done in the following code.

[C#]int flags = (int)(BufferPlayFlags.LocateInSoftware | BufferPlayFlags.TerminateByTime);
EffectsReturnValue[] returnval = buffer.AcquireResources(flags,1);

If the DeferLocation flag is not set in the BufferDescription of the SecondaryBuffer object, an InvalidCallException is thrown.

If one of the BufferPlayFlags is set in the flags parameter and is not supported, a ControlUnavailableException is thrown.

Exceptions

ArgumentExceptionLeave Site

An invalid parameter was passed to the called method.

ArgumentNullExceptionLeave Site

A parameter is null.

ControlUnavailableException

The buffer control (volume, pan, and so on) requested by the caller is not available. Controls must be specified when the buffer is created.

InvalidCallException

The method call is invalid for the current state of this object.