Setting Effects on Buffers
Any number of effects can be set on a secondary buffer that was created with the BufferCaps.ControlEffects property. Effects might not work smoothly on very small buffers, and Microsoft DirectSound does not permit the creation of effects-capable buffers that hold less than 150 (BufferSize.FxMin) milliseconds of data.
To implement an effect on a buffer, use the SecondaryBuffer.SetEffects method. This method takes an array of EffectDescription structures that describe the effects. You can also use SetEffects to remove effects, by passing a null reference instead of an array. In either case, the buffer must not be playing.
Effects can be instantiated in hardware (that is, implemented by the sound card driver) or in software. For more information, see EffectDescription.The following Microsoft Visual Basic sample function sets the standard echo effect on a buffer.
[Visual Basic]Private Sub SetEcho(ByVal b As SecondaryBuffer) Dim fx As EffectDescription() ReDim fx(0) fx(0).GuidEffectClass = DSoundHelper.StandardEchoGuid Try b.SetEffects(fx) Catch e As ControlUnavailableException Debug.WriteLine("BufferDescription does not have ControlEffects set.") End Try End Sub