Tao.Sdl SDK Documentation

SdlMixer.Mix_Volume Method 

Set the mix volume of a channel

[Visual Basic]
Public Shared Function Mix_Volume( _
   ByVal channel As Integer, _
   ByVal volume As Integer _
) As Integer
[C#]
public static int Mix_Volume(
   int channel,
   int volume
);

Parameters

channel
Channel to set mix volume for. -1 will set the volume for all allocated channels.
volume
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.

Return Value

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

Remarks

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.

Binds to C-function in SDL_mixer.h

int Mix_Volume(int channel, int volume)
            

Example

            // set channel 1 to half volume
                    Mix_Volume(1,MIX_MAX_VOLUME/2);
                    // print the average volume
                    printf("Average volume is %d\n",Mix_Volume(-1,-1));
            

See Also

SdlMixer Class | Tao.Sdl Namespace | Mix_VolumeChunk | Mix_VolumeMusic