[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.6.6 Mix_SetDistance

int Mix_SetDistance(int channel, Uint8 distance)

channel
Channel number to register this effect on.
Use MIX_CHANNEL_POST to process the postmix stream.
distance
Specify the distance from the listener, from 0(close/loud) to 255(far/quiet).

This effect simulates a simple attenuation of volume due to distance. The volume never quite reaches silence, even at max distance.
NOTE: Using a distance of 0 will cause the effect to unregister itself from channel. You cannot unregister it any other way, unless you use Mix_UnregisterAllEffects on the channel.

Returns: Zero on errors, such as an invalid channel, or if Mix_RegisterEffect failed.

 
// distance channel 1 to be farthest away
if(!Mix_SetDistance(1, 255)) {
    printf("Mix_SetDistance: %s\n", Mix_GetError());
    // no distance, is it ok?
}

See Also:
4.6.7 Mix_SetPosition, 4.6.3 Mix_UnregisterAllEffects



This document was generated on November, 13 2009 using texi2html