Tao.Sdl SDK Documentation |
|
SdlMixer.Mix_SetDistance Method
Distance attenuation (volume)
[Visual Basic]
Public Shared Function Mix_SetDistance( _
ByVal
channel As
Integer, _
ByVal
distance As
Byte _
) As
Integer
[C#]
public static
int Mix_SetDistance(
int channel,
byte distance);
Parameters
-
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).
Return Value
Zero on errors, such as an invalid channel, or if Mix_RegisterEffect failed.
Remarks
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.
Binds to C-function in SDL_mixer.h
int Mix_SetDistance(int channel, Uint8 distance)
Example
// 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
SdlMixer Class | Tao.Sdl Namespace | Mix_SetPosition | Mix_UnregisterAllEffects