SecondaryBuffer.GetEffects Method

Language:

Note: This documentation is preliminary and is subject to change.
How Do I...?

Retrieves a range of Microsoft® DirectSound® effect objects from a SecondaryBuffer object.

Definition

Visual Basic .NET Public Function GetEffects( _
    ByVal startIndex As Integer, _
    ByVal count As Integer _
) As Object()
C# public object[] GetEffects(
    int startIndex,
    int count
);
Managed C++ public: Object* GetEffects(
    int startIndex,
    int count
) __gc[];
JScript .NET public function GetEffects(
    startIndex : int,
    count : int
) : Object[];

Parameters

startIndex System.Int32. Starting index of the range of Microsoft® DirectSound® effect objects to retrieve from the SecondaryBuffer object.
count System.Int32. The number of Microsoft® DirectSound® effect objects to retrieve from the SecondaryBuffer object.

Return Value

System.Object[]. An array of Microsoft® DirectSound® effect objects, such as EchoEffect, from the SecondaryBuffer object.

Remarks

To retrieve an effect object out of the returned array, first retrieve it as an object, than cast it into the appropriate effect object type as seen in the example below.

[C#]
object[] effects_objects = buffer.GetEffects(0,1); WavesReverbEffect wre = (WavesReverbEffect)effects_objects[0];

Exceptions
ArgumentException Leave Site An invalid parameter was passed to the called method.
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.
ObjectNotFoundException The requested object was not found.
SoundException Root exception type for all Microsoft® DirectSound® exceptions. Derives from DirectXException.

How Do I...?

Use Effect Parameters

This C# example demonstrates how to use the parameters of an effect object from a SecondaryBuffer object.

The buffer object in this code snippet is assumed to be the SecondaryBuffer from the code in Add Effects to a SecondaryBuffer Object.

              [C#]
              
//Retrieve the effects object and //the effect param sturctures and edit parameters. EchoEffect echo = (EchoEffect)buffer.GetEffects(0); EffectsEcho echo_params = echo.AllParameters; echo_params.LeftDelay = 250.0f; echo_params.RightDelay = 100.0f; echo_params.Feedback = 85.0f; echo_params.PanDelay = 1; echo_params.WetDryMix = 50.0f; ChorusEffect chorus = (ChorusEffect)buffer.GetEffects(1); EffectsChorus chorus_params = chorus.AllParameters; chorus_params.Delay = 15.0f; chorus_params.Depth = ChorusEffect.DepthMax; chorus_params.Phase = ChorusEffect.PhaseNegative90; chorus_params.Waveform = ChorusEffect.WaveSin; chorus_params.WetDryMix = 50.0f; //Set the new parameters and play the buffer. echo.AllParameters = echo_params; chorus.AllParameters = chorus_params; buffer.Play(0,BufferPlayFlags.Default);

See Also


© 2004 Microsoft Corporation. All rights reserved. Terms of use.

Feedback? Please provide us with your comments on this topic.