Microsoft DirectX 8.0 (C++) |
Enables effects on a buffer. The buffer must not be playing or locked.
For this method to succeed, CoInitialize must have been called. This is done automatically in applications that create DirectSound by using IDirectMusicPerformance8::InitAudio. However, applications that create DirectSound by using DirectSoundCreate8 must also call CoInitialize.
HRESULT SetFX( DWORD dwEffectsCount, LPDSEFFECTDESC pDSFXDesc, LPDWORD pdwResultCodes );
This parameter can be NULL is no result values are wanted, and must be NULL if dwEffectsCount is 0
If the method succeeds, the return value is DS_OK or DS_INCOMPLETE.
If the method fails, the return value may be one of the following error values:
CO_E_NOTINITIALIZED |
DSERR_CONTROLUNAVAIL |
DSERR_GENERIC |
DSERR_INVALIDPARAM |
DSERR_INVALIDCALL |
DSERR_NOINTERFACE |
DSERR_PRIOLEVELNEEDED |
In addition, the method can return an error value from DMO methods, including IMediaObject::SetInputType and IMediaObject::SetOutputType. See the DirectShow documentation for possible error values.
If the method fails, the value for each effect in pdwResultCodes is either DSFXF_PRESENT or DSFXR_UNKNOWN. Check these values to determine which effects caused the failure.
For the method to succeed, the buffer must have been created with the DSBCAPS_CTRLFX flag and must not be playing or locked.
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 IDirectMusicAudioPath8::Activate.
An effect must be set on a buffer before the effect interface can be obtained. To obtain the effect interface, use IDirectSoundBuffer8::GetObjectInPath.
Header: Declared in dsound.h.