Microsoft DirectX 9.0

AmplitudeModulation Sample

Description

The AmplitudeModulation sample shows how to apply an effect to a DirectSound secondary buffer and modify the parameters of the effect.

Path

Source: (SDK root)\Samples\C++\DirectSound\AmplitudeModulation

Executable: (SDK root)\Samples\C++\DirectSound\Bin

User's Guide

Play the default sound or load another WAV file by clicking Sound File. Change the parameters of the effect by selecting one of the Wave Form options and moving the slider to change the modulation rate.

Programming Notes

The application takes the following steps to set an effect on a buffer and change its parameters:

  1. Creates the buffer with the DSBCAPS_CTRLFX flag.
  2. Describe the effect in a DSEFFECTDESC structure, setting the guidDSFXClass member to the GUID of the effect desired.
  3. Passes the buffer description to IDirectSoundBuffer8::SetFX.
  4. Calls IDirectSoundBuffer8::GetObjectInPath to get an interface pointer to the effect, in this case IDirectSoundFXGargle8.
  5. In the OnEffectChanged function, uses IDirectSoundFXGargle8::SetAllParameters to change the parameters of the gargle effect.

See Also