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

4.6.5 Mix_SetPanning

int Mix_SetPanning(int channel, Uint8 left, Uint8 right)

channel
Channel number to register this effect on.
Use MIX_CHANNEL_POST to process the postmix stream.
left
Volume for the left channel, range is 0(silence) to 255(loud)
right
Volume for the left channel, range is 0(silence) to 255(loud)

This effect will only work on stereo audio. Meaning you called Mix_OpenAudio with 2 channels (MIX_DEFAULT_CHANNELS). The easiest way to do true panning is to call Mix_SetPanning(channel, left, 254 - left); so that the total volume is correct, if you consider the maximum volume to be 127 per channel for center, or 254 max for left, this works, but about halves the effective volume.
This Function registers the effect for you, so don't try to Mix_RegisterEffect it yourself.
NOTE: Setting both left and right to 255 will unregister the effect from channel. You cannot unregister it any other way, unless you use Mix_UnregisterAllEffects on the channel.
NOTE: Using this function on a mono audio device will not register the effect, nor will it return an error status.

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

 
// pan channel 1 halfway to the left
if(!Mix_SetPanning(1, 255, 127)) {
    printf("Mix_SetPanning: %s\n", Mix_GetError());
    // no panning, 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