Remarks
Applies a DirectX Media Object (DMO) effect to the given portion of sound under editing.
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.
A successful call to this method will fire the SoundEditStarted event followed by a number of SoundEditPerc events and finally by the SoundEditDone event.
For further details about methods related to the use of special effects refer to the Effects COM object.
Syntax
[Visual Basic]
control.Effects.DirectXApply (
nStartPosition as Long,
nEndPosition as Long,
nEffect as enumDirectXEffects,
pParamData as long
) as enumErrorCodes
|
|
[C++]
short control.Effects.DirectXApply (
long nStartPosition,
long nEndPosition,
short nEffect,
void *pParamData
);
|
|
Parameter
|
Description
|
|
|
nStartPosition
|
Start position, expressed in milliseconds, of the affected sound range.
|
nEndPosition
|
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.
|
nEffect
|
Numeric value that determines the effect parameters to apply.
Supported values are the following:
Mnemonic constant
|
Value
|
Meaning
|
DX_CHORUS
|
0
|
Chorus
|
DX_COMPRESSOR
|
1
|
Compressor
|
DX_DISTORTION
|
2
|
Distortion
|
DX_ECHO
|
3
|
Echo
|
DX_FLANGER
|
4
|
Flanger
|
DX_GARGLE
|
5
|
Gargle
|
DX_I3DL2REVERB
|
6
|
I3DL2 environmental reverb
|
DX_PARAMEQ
|
7
|
Parametric equalizer
|
DX_REVERB
|
8
|
Reverb
|
|
pParamData
|
Address of a structure that contains the effect parameters to apply: the passed structure must be directly related to the chosen effect as in the table below.
NOTE: DirectX related data structures are usually defined inside the Platform SDK dsound.h header file. For Visual Basic users convenience, we have provided a DirectSound.bas module containing the definitions of these structures and some of the Mnemonic constant definitions that can be used inside your code: this module can be found inside the product Include directory (default \Program files\MultiMedia Soft\Active Sound Editor\include).
Effect
|
Related DirectX structure
|
DX_CHORUS
|
The DSFXChorus structure contains parameters for a chorus effect.
typedef struct _DSFXChorus {
FLOAT fWetDryMix;
FLOAT fDepth;
FLOAT fFeedback;
FLOAT fFrequency;
LONG lWaveform;
FLOAT fDelay;
LONG lPhase;
} DSFXChorus, *LPDSFXChorus;
fWetDryMix
Ratio of wet (processed) signal to dry (unprocessed) signal. Must be in the range from DSFXCHORUS_WETDRYMIX_MIN through DSFXCHORUS_WETDRYMIX_MAX (all wet). The default value is 50.
fDepth
Percentage by which the delay time is modulated by the low-frequency oscillator, in hundredths of a percentage point. Must be in the range from DSFXCHORUS_DEPTH_MIN through DSFXCHORUS_DEPTH_MAX. The default value is 10.
fFeedback
Percentage of output signal to feed back into the effect's input, in the range from DSFXCHORUS_FEEDBACK_MIN to DSFXCHORUS_FEEDBACK_MAX. The default value is 25.
fFrequency
Frequency of the LFO, in the range from DSFXCHORUS_FREQUENCY_MIN to DSFXCHORUS_FREQUENCY_MAX. The default value is 1.1.
lWaveform
Waveform of the LFO. Defined values are DSFXCHORUS_WAVE_TRIANGLE and DSFXCHORUS_WAVE_SIN. By default, the waveform is a sine.
fDelay
Number of milliseconds the input is delayed before it is played back, in the range from DSFXCHORUS_DELAY_MIN to DSFXCHORUS_DELAY_MAX. The default value is 16 ms.
lPhase
Phase differential between left and right LFOs, in the range from DSFXCHORUS_PHASE_MIN through DSFXCHORUS_PHASE_MAX. Possible values are defined as follows.
Value
DSFXCHORUS_PHASE_NEG_180
DSFXCHORUS_PHASE_NEG_90
DSFXCHORUS_PHASE_ZERO
DSFXCHORUS_PHASE_90
DSFXCHORUS_PHASE_180
|
DX_COMPRESSOR
|
The DSFXCompressor structure contains parameters for a compression effect.
typedef struct _DSFXCompressor {
FLOAT fGain;
FLOAT fAttack;
FLOAT fRelease;
FLOAT fThreshold;
FLOAT fRatio;
FLOAT fPredelay;
} DSFXCompressor, *LPDSFXCompressor;
fGain
Output gain of signal after compression, in the range from DSFXCOMPRESSOR_GAIN_MIN to DSFXCOMPRESSOR_GAIN_MAX. The default value is 0 dB.
fAttack
Time before compression reaches its full value, in the range from DSFXCOMPRESSOR_ATTACK_MIN to DSFXCOMPRESSOR_ATTACK_MAX. The default value is 10 ms.
fRelease
Speed at which compression is stopped after input drops below fThreshold, in the range from DSFXCOMPRESSOR_RELEASE_MIN to DSFXCOMPRESSOR_RELEASE_MAX. The default value is 200 ms.
fThreshold
Point at which compression begins, in decibels, in the range from DSFXCOMPRESSOR_THRESHOLD_MIN to DSFXCOMPRESSOR_THRESHOLD_MAX. The default value is -20 dB.
fRatio
Compression ratio, in the range from DSFXCOMPRESSOR_RATIO_MIN to DSFXCOMPRESSOR_RATIO_MAX. The default value is 3, which means 3:1 compression.
fPredelay
Time after lThreshold is reached before attack phase is started, in milliseconds, in the range from DSFXCOMPRESSOR_PREDELAY_MIN to DSFXCOMPRESSOR_PREDELAY_MAX. The default value is 4 ms.
|
DX_DISTORTION
|
The DSFXDistortion structure contains parameters for a distortion effect.
typedef struct _DSFXDistortion {
FLOAT fGain;
FLOAT fEdge;
FLOAT fPostEQCenterFrequency;
FLOAT fPostEQBandwidth;
FLOAT fPreLowpassCutoff;
} DSFXDistortion, *LPDSFXDistortion;
fGain
Amount of signal change after distortion, in the range from DSFXDISTORTION_GAIN_MIN through DSFXDISTORTION_GAIN_MAX. The default value is -18 dB.
fEdge
Percentage of distortion intensity, in the range in the range from DSFXDISTORTION_EDGE_MIN through DSFXDISTORTION_EDGE_MAX. The default value is 15 percent.
fPostEQCenterFrequency
Center frequency of harmonic content addition, in the range from DSFXDISTORTION_POSTEQCENTERFREQUENCY_MIN through DSFXDISTORTION_POSTEQCENTERFREQUENCY_MAX. The default value is 2400 Hz.
fPostEQBandwidth
Width of frequency band that determines range of harmonic content addition, in the range from DSFXDISTORTION_POSTEQBANDWIDTH_MIN through DSFXDISTORTION_POSTEQBANDWIDTH_MAX. The default value is 2400 Hz.
fPreLowpassCutoff
Filter cutoff for high-frequency harmonics attenuation, in the range from DSFXDISTORTION_PRELOWPASSCUTOFF_MIN through DSFXDISTORTION_PRELOWPASSCUTOFF_MAX. The default value is 8000 Hz.
|
DX_ECHO
|
The DSFXEcho structure contains parameters for an echo effect.
typedef struct _DSFXEcho {
FLOAT fWetDryMix;
FLOAT fFeedback;
FLOAT fLeftDelay;
FLOAT fRightDelay;
LONG lPanDelay;
} DSFXEcho, *LPDSFXEcho;
fWetDryMix
Ratio of wet (processed) signal to dry (unprocessed) signal. Must be in the range from DSFXECHO_WETDRYMIX_MIN through DSFXECHO_WETDRYMIX_MAX (all wet). The default value is 50.
fFeedback
Percentage of output fed back into input, in the range from DSFXECHO_FEEDBACK_MIN through DSFXECHO_FEEDBACK_MAX. The default value is 50.
fLeftDelay
Delay for left channel, in milliseconds, in the range from DSFXECHO_LEFTDELAY_MIN through DSFXECHO_LEFTDELAY_MAX. The default value is 500 ms.
fRightDelay
Delay for right channel, in milliseconds, in the range from DSFXECHO_RIGHTDELAY_MIN through DSFXECHO_RIGHTDELAY_MAX. The default value is 500 ms.
lPanDelay
Value that specifies whether to swap left and right delays with each successive echo. The default value is zero, meaning no swap. Possible values are defined as DSFXECHO_PANDELAY_MIN (equivalent to FALSE) and DSFXECHO_PANDELAY_MAX (equivalent to TRUE).
|
DX_FLANGER
|
The DSFXFlanger structure contains parameters for a flange effect.
typedef struct _DSFXFlanger {
FLOAT fWetDryMix;
FLOAT fDepth;
FLOAT fFeedback;
FLOAT fFrequency;
LONG lWaveform;
FLOAT fDelay;
LONG lPhase;
} DSFXFlanger, *LPDSFXFlanger;
fWetDryMix
Ratio of wet (processed) signal to dry (unprocessed) signal. Must be in the range from DSFXFLANGER_WETDRYMIX_MIN through DSFXFLANGER_WETDRYMIX_MAX (all wet). The default value is 50.
fDepth
Percentage by which the delay time is modulated by the low-frequency oscillator (LFO), in hundredths of a percentage point. Must be in the range from DSFXFLANGER_DEPTH_MIN through DSFXFLANGER_DEPTH_MAX. The default value is 100.
fFeedback
Percentage of output signal to feed back into the effect's input, in the range from DSFXFLANGER_FEEDBACK_MIN to DSFXFLANGER_FEEDBACK_MAX. The default value is -50.
fFrequency
Frequency of the LFO, in the range from DSFXFLANGER_FREQUENCY_MIN to DSFXFLANGER_FREQUENCY_MAX. The default value is 0.25.
lWaveform
Waveform of the LFO. By default, the waveform is a sine. Possible values are the following.
- DSFXFLANGER_WAVE_TRIANGLE
- DSFXFLANGER_WAVE_SIN
fDelay
Number of milliseconds the input is delayed before it is played back, in the range from DSFXFLANGER_DELAY_MIN to DSFXFLANGER_DELAY_MAX. The default value is 2 ms.
lPhase
Phase differential between left and right LFOs, in the range from DSFXFLANGER_PHASE_MIN through DSFXFLANGER_PHASE_MAX. Possible values are the following:
- DSFXFLANGER_PHASE_NEG_180
- DSFXFLANGER_PHASE_NEG_90
- DSFXFLANGER_PHASE_ZERO
- DSFXFLANGER_PHASE_90
- DSFXFLANGER_PHASE_180
The default value is DSFXFLANGER_PHASE_ZERO.
|
DX_GARGLE
|
The DSFXGargle structure contains parameters for an amplitude modulation effect.
typedef struct _DSFXGargle {
DWORD dwRateHz;
DWORD dwWaveShape;
} DSFXGargle, *LPDSFXGargle;
dwRateHz
Rate of modulation, in Hertz. Must be in the range from DSFXGARGLE_RATEHZ_MIN through DSFXGARGLE_RATEHZ_MAX. The default value is 20.
dwWaveShape
Shape of the modulation wave. The following values are defined:
DSFXGARGLE_WAVE_TRIANGLE
DSFXGARGLE_WAVE_SQUARE
The default value is DSFXGARGLE_WAVE_TRIANGLE.
|
DX_I3DL2REVERB
|
The DSFXI3DL2Reverb structure contains parameters for an I3DL2 (Interactive 3D Audio Level 2) reverberation effect.
typedef struct _DSFXI3DL2Reverb {
LONG lRoom;
LONG lRoomHF;
FLOAT flRoomRolloffFactor;
FLOAT flDecayTime;
FLOAT flDecayHFRatio;
LONG lReflections;
FLOAT flReflectionsDelay;
LONG lReverb;
FLOAT flReverbDelay;
FLOAT flDiffusion;
FLOAT flDensity;
FLOAT flHFReference;
} DSFXI3DL2Reverb, *LPDSFXI3DL2Reverb;
lRoom
Attenuation of the room effect, in millibels (mB), in the range from DSFX_I3DL2REVERB_ROOM_MIN to DSFX_I3DL2REVERB_ROOM_MAX. The default value is DSFX_I3DL2REVERB_ROOM_DEFAULT, or -1000 mB.
lRoomHF
Attenuation of the room high-frequency effect, in mB, in the range from DSFX_I3DL2REVERB_ROOMHF_MIN to DSFX_I3DL2REVERB_ROOMHF_MAX. The default value is DSFX_I3DL2REVERB_ROOMHF_DEFAULT, or -100 mB.
flRoomRolloffFactor
Rolloff factor for the reflected signals, in the range from DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MIN to DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MAX. The default value is DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT, or 0.0. The rolloff factor for the direct path is controlled by the DirectSound listener.
flDecayTime
Decay time, in seconds, in the range from DSFX_I3DL2REVERB_DECAYTIME_MIN to DSFX_I3DL2REVERB_DECAYTIME_MAX. The default value is DSFX_I3DL2REVERB_DECAYTIME_DEFAULT, or 1.49 second.
flDecayHFRatio
Ratio of the decay time at high frequencies to the decay time at low frequencies, in the range from DSFX_I3DL2REVERB_DECAYHFRATIO_MIN to DSFX_I3DL2REVERB_DECAYHFRATIO_MAX. The default value is DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT, or 0.83.
lReflections
Attenuation of early reflections relative to lRoom, in mB, in the range from DSFX_I3DL2REVERB_REFLECTIONS_MIN to DSFX_I3DL2REVERB_REFLECTIONS_MAX. The default value is DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT, or -2602 mB.
flReflectionsDelay
Delay time of the first reflection relative to the direct path, in seconds, in the range from DSFX_I3DL2REVERB_REFLECTIONSDELAY_MIN to DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT. The default value is 0.007 seconds.
lReverb
Attenuation of late reverberation relative to lRoom, in mB, in the range -from DSFX_I3DL2REVERB_REVERB_MIN to DSFX_I3DL2REVERB_REVERB_MAX. The default value is DSFX_I3DL2REVERB_REVERB_DEFAULT, or 200 mB.
flReverbDelay
Time limit between the early reflections and the late reverberation relative to the time of the first reflection, in seconds, in the range from DSFX_I3DL2REVERB_REVERBDELAY_MIN to DSFX_I3DL2REVERB_REVERBDELAY_MAX. The default value is DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT, or 0.011 seconds.
flDiffusion
Echo density in the late reverberation decay, in percent, in the range from DSFX_I3DL2REVERB_DIFFUSION_MIN to DSFX_I3DL2REVERB_DIFFUSION_MAX. The default value is DSFX_I3DL2REVERB_DIFFUSION_DEFAULT, or 100.0 percent.
flDensity
Modal density in the late reverberation decay, in percent, in the range from DSFX_I3DL2REVERB_DENSITY_MIN to DSFX_I3DL2REVERB_DENSITY_MAX. The default value is DSFX_I3DL2REVERB_DENSITY_DEFAULT, or 100.0 percent.
flHFReference
Reference high frequency, in hertz, in the range from DSFX_I3DL2REVERB_HFREFERENCE_MIN to DSFX_I3DL2REVERB_HFREFERENCE_MAX. The default value is DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT, or 5000.0 Hz.
|
DX_PARAMEQ
|
The DSFXParamEq structure contains parameters for a parametric equalizer effect.
typedef struct _DSFXParamEq {
FLOAT fCenter;
FLOAT fBandwidth;
FLOAT fGain;
} DSFXParamEq, *LPDSFXParamEq;
fCenter
Center frequency, in hertz, in the range from DSFXPARAMEQ_CENTER_MIN to DSFXPARAMEQ_CENTER_MAX. This value cannot exceed one-third of the frequency of the buffer. The default value is 8000.
fBandwidth
Bandwidth, in semitones, in the range from DSFXPARAMEQ_BANDWIDTH_MIN to DSFXPARAMEQ_BANDWIDTH_MAX. The default value is 12.
fGain
Gain, in the range from DSFXPARAMEQ_GAIN_MIN to DSFXPARAMEQ_GAIN_MAX. The default value is 0.
|
DX_REVERB
|
The DSFXWavesReverb structure contains parameters for a Waves reverberation effect.
typedef struct _DSFXWavesReverb {
FLOAT fInGain;
FLOAT fReverbMix;
FLOAT fReverbTime;
FLOAT fHighFreqRTRatio;
} DSFXWavesReverb, *LPDSFXWavesReverb;
fInGain
Input gain of signal, in decibels (dB), in the range from DSFX_WAVESREVERB_INGAIN_MIN through DSFX_WAVESREVERB_INGAIN_MAX. The default value is DSFX_WAVESREVERB_INGAIN_DEFAULT, or 0 dB.
fReverbMix
Reverb mix, in dB, in the range from DSFX_WAVESREVERB_REVERBMIX_MIN through DSFX_WAVESREVERB_REVERBMIX_MAX. The default value is DSFX_WAVESREVERB_REVERBMIX_DEFAULT, or 0 dB.
fReverbTime
Reverb time, in milliseconds, in the range from DSFX_WAVESREVERB_REVERBTIME_MIN through DSFX_WAVESREVERB_REVERBTIME_MAX. The default value is DSFX_WAVESREVERB_REVERBTIME_DEFAULT, or 1000.
fHighFreqRTRatio
In the range from DSFX_WAVESREVERB_HIGHFREQRTRATIO_MIN through DSFX_WAVESREVERB_HIGHFREQRTRATIO_MAX. The default value is DSFX_WAVESREVERB_HIGHFREQRTRATIO_DEFAULT, or 0.001.
|
|
Return value
Value
|
Meaning
|
|
|
Negative value
|
An error occurred (see the LastError property for further error details)
|
enumErrorCodes.ERR_NOERROR (0)
|
The method call was successful.
|
|