Microsoft DirectX 8.1 (Visual Basic) |
The SetFX method sets effects for sounds in the buffer. The buffer must not be playing.
Syntax
object.SetFX( _
EffectsCount As Long, _
Buffers() As DSEFFECTDESC, _
lResultIDs() As Long)
Parts
object
Resolves to a DirectSoundSecondaryBuffer8 object.
EffectsCount
Number of elements in Buffers and lResultIDs. Set to 0 to remove all effects from the buffer.
Buffers
Array of DSEFFECTDESC types that specify the effects to set.
lResultIDs
Array of Long variables, one for each effect in the Buffers array, that receive information about the result of the attempt to create the corresponding effect. Each element receives one of the following values from the CONST_DSOUNDFX enumeration.
Value | Description |
DSFXR_LOCHARDWARE | Effect is instantiated in hardware. |
DSFXR_LOCSOFTWARE | Effect is instantiated in software. |
DSFXR_UNALLOCATED | Effect has not yet been assigned to hardware nor software. |
DSFXR_FAILED | No effect was created because resources weren't available. |
DSFXR_PRESENT | The effect is available but was not created because the method failed for some other reason. |
DSFXR_UNKNOWN | No effect was created because the effect isn't registered on the system. |
Error Codes
If the method fails, an error is raised and Err.Number may be set to one of the following error values.
DSERR_CONTROLUNAVAIL |
DSERR_GENERIC |
DSERR_INVALIDPARAM |
DSERR_INVALIDCALL |
DSERR_NOINTERFACE |
DSERR_PRIOLEVELNEEDED |
Remarks
For the method to succeed, the buffer must have been created with the DSBCAPS_CTRLFX flag and must not be playing.
If the method fails, the value for each effect in lEffectsResults is either DSFXF_PRESENT or DSFXR_UNKNOWN. Check these values to determine which effects caused the failure.
If the method returns DSERR_NOINTERFACE or another COM error, check the result code array for DSFXR_PRESENT or DSFXR_UNKNOWN to ascertain which effect caused the error. If the method returns DSERR_INVALIDPARAM, check the result codes for DSFXR_FAILED to see which effects failed to acquire resources.
If the buffer is part of an audiopath, the audiopath must be inactive. See DirectMusicAudioPath8.Activate.
An effect must be set on a buffer before the effect object can be obtained. To obtain the effect object, use DirectSoundSecondaryBuffer8.GetObjectInPath.