public abstract class DmoEffectBase<TDXEffect, TDXEffectStruct> : DmoAggregator where TDXEffect : DirectSoundFxBase<TDXEffectStruct> where TDXEffectStruct : struct, ValueType
Base class for all DMO effects.
TDXEffect
DMO effect itself.
TDXEffectStruct
Parameter struct of the DMO effect.
DmoEffectBase(IWaveSource source)
Creates a new instance of DmoEffectBase class.
protected void DmoEffectBase(IWaveSource source)
Parameters
source
IWaveSourceThe base source, which feeds the effect with data.
CreateComObject()
Creates and returns a new instance of the native COM object.
protected abstract object CreateComObject()
Returns
A new instance of the native COM object.
CreateMediaObject(WaveFormat inputFormat, WaveFormat outputFormat)
Creates an MediaObject from the effect DMO.
protected MediaObject CreateMediaObject(WaveFormat inputFormat, WaveFormat outputFormat)
Parameters
inputFormat
WaveFormatThe input format of the MediaObject to create.
outputFormat
WaveFormatThe output format of the MediaObject to create.
Returns
The created MediaObject to use for processing audio data.
GetOutputFormat()
Gets the output format of the effect.
protected WaveFormat GetOutputFormat()
Returns
The output format of the effect.
Read(Byte[] buffer, Int32 offset, Int32 count)
Reads a sequence of bytes from the stream and applies the Dmo effect to them (only if the IsEnabled property is set to true).
public Int32 Read(Byte[] buffer, Int32 offset, Int32 count)
Parameters
buffer
Byte[]An array of bytes. When this method returns, the buffer contains the read bytes.
offset
Int32The zero-based byte offset in buffer at which to begin storing the data read from the stream.
count
Int32The maximum number of bytes to be read from the stream
Returns
The actual number of read bytes.
SetValue
Sets the value for one of the effects parameter and updates the effect.
protected void SetValue<T>(String fieldname, T value)
Parameters
fieldname
StringName of the field to set the value for.
value
TValue to set.
Type Parameters
T
Type of the value.
Effect
Gets the underlying effect.
protected TDXEffect Effect { get; }
IsEnabled
Gets or sets whether the effect is enabled.
public Boolean IsEnabled { get; set; }