Step 5: Playing an Infinite Effect
Microsoft DirectX 9.0 SDK Update (October 2004)

Step 5: Playing an Infinite Effect


The effect created in the previous step starts in response to the press of a button. To create an effect that is to be played in response to an explicit call, return to Step 4: Creating an Effect and modify the dwTriggerButton member of the DIEFFECT structure as follows:

diEffect.dwTriggerButton = DIEB_NOTRIGGER;

To make a chain saw that starts and keeps going, change the dwDuration member as follows:

diEffect.dwDuration = INFINITE;

Next, start the effect.

g_lpdiEffect->Start(1, 0);

The effect keeps running until you stop it.

g_lpdiEffect->Stop();

Note that it is not necessary to change the envelope you created in the previous step. The attack is played as the effect starts, but the fade value is ignored.

Once your application can play an infinite effect, go to Step 6: Changing an Effect.



© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.