al_rumble_haptic(1) Allegro 5 API


#include <allegro5/allegro.h>
bool al_rumble_haptic(ALLEGRO_HAPTIC *hap,
   double intensity, double duration, ALLEGRO_HAPTIC_EFFECT_ID *id)


Uploads a simple rumble effect to the haptic device and starts playback immediately. The parameter intensity is a relative magnitude between 0.0 and 1.0 that determines the intensity of the rumble effect. The duration determines the duration of the effect in seconds.

You must also pass in a pointer to a user allocated ALLEGRO_HAPTIC_EFFECT_ID(3alleg5). It it is stored a reference to be used to control playback of the effect. Returns true if the rumble effect was successfully uploaded and started, false if not.

In case false is returned, the rumble effect will be automatically released as if al_release_haptic_effect(3alleg5) had been called, so there is no need to call it again manually in this case. However, if true is returned, it is necessary to call al_release_haptic_effect(3alleg5) when the effect isn't needed anymore, to prevent the amount of available effects on the haptic device from running out.



[Unstable API]: Perhaps could be simplified due to limited support for all the exposed features across all of the platforms. Awaiting feedback from users.