Copyright © 2011-2018 MultiMedia Soft

Effects.DirectXApply method (Compressor)

Return to chapter overview



Applies a Compressor effect to the given portion of sound under editing. This method is not available for COM interoperability: in alternative you can use the Effects.DirectXApplyCompressor method.


DirectX effects requires the availability of DirectX version 8 or higher on the target system and can be applied only if a call to the GetDirectSoundVersion method returns a value higher than 7.


For further details about methods related to the use of special effects refer to the EffectsMan class.





[Visual Basic]

Public Function DirectXApply (

nStartPosition as Int32,

nEndPosition as Int32,

fx as Microsoft.DirectX.DirectSound.EffectsCompressor

) as enumErrorCodes



public enumErrorCodes DirectXApply (

Int32 nStartPosition,

Int32 nEndPosition,

Microsoft.DirectX.DirectSound.EffectsCompressor fx




public: enumErrorCodes DirectXApply (

Int32 nStartPosition,

Int32 nEndPosition,

Microsoft::DirectX::DirectSound::EffectsCompressor fx









Start position, expressed in milliseconds, of the affected sound range.


End position, expressed in milliseconds, of the affected sound range.. If set to -1 the end position will be set to the end of the sound.


Effect structure containing parameters to apply.






Retrieves and sets the time before compression reaches its full value.

Can range from CompressorEffect.AttackMin to CompressorEffect.AttackMax.

The default value is 10 ms.


Retrieves and sets the output gain of signal after compression.

Can range from CompressorEffect.GainMin to CompressorEffect.GainMax.

The default value is 0 dB.


Retrieves and sets the time after Threshold is reached before attack phase is started, in milliseconds.

Can range from CompressorEffect.PredelayMin to CompressorEffect.PredelayMax.

The default value is 4 ms.


Retrieves and sets the compression ratio.

Can range from CompressorEffect.RatioMin to CompressorEffect.RatioMax.

The default value is 3, which means 3:1 compression.


Retrieves and sets the speed at which compression is stopped after input drops below Threshold.

Can range from CompressorEffect.ReleaseMin to CompressorEffect.ReleaseMax.

The default value is 200 ms.


Retrieves and sets the point at which compression begins.

Can range from CompressorEffect.ThresholdMin to CompressorEffect.ThresholdMax.

The default value is -20 dB.



Return value






Negative value

An error occurred (see the LastError property for further error details)

enumErrorCodes.ERR_NOERROR (0)

The method call was successful.