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

4.3.2 Mix_Volume

int Mix_Volume(int channel, int volume)

Channel to set mix volume for.
-1 will set the volume for all allocated channels.
The volume to use from 0 to MIX_MAX_VOLUME(128).
If greater than MIX_MAX_VOLUME,
then it will be set to MIX_MAX_VOLUME.
If less than 0 then the volume will not be set.

Set the volume for any allocated channel. If channel is -1 then all channels at are set at once. The volume is applied during the final mix, along with the sample volume. So setting this volume to 64 will halve the output of all samples played on the specified channel. All channels default to a volume of 128, which is the max. Newly allocated channels will have the max volume set, so setting all channels volumes does not affect subsequent channel allocations.

Returns: current volume of the channel. If channel is -1, the average volume is returned.

// set channel 1 to half volume

// print the average volume
printf("Average volume is %d\n",Mix_Volume(-1,-1));

See Also:
4.2.7 Mix_VolumeChunk, 4.5.9 Mix_VolumeMusic

This document was generated on November, 13 2009 using texi2html