Tao.Sdl SDK Documentation

SdlMixer.Mix_VolumeMusic Method 

Set music volume

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

Parameters

volume
Music volume, from 0 to MIX_MAX_VOLUME(128). Values greater than MIX_MAX_VOLUME will use MIX_MAX_VOLUME. -1 does not set the volume, but does return the current volume setting.

Return Value

The previous volume setting.

Remarks

Set the volume to volume, if it is 0 or greater, and return the previous volume setting. Setting the volume during a fade will not work, the faders use this function to perform their effect! Setting volume while using an external music player set by Mix_SetMusicCMD will have no effect, and Mix_GetError will show the reason why not.

Binds to C-function in SDL_mixer.h

int Mix_VolumeMusic(int volume)
            

Example

            // set the music volume to 1/2 maximum, and then check it
                    printf("volume was    : %d\n", Mix_VolumeMusic(MIX_MAX_VOLUME/2));
                    printf("volume is now : %d\n", Mix_VolumeMusic(-1));
            

See Also

SdlMixer Class | Tao.Sdl Namespace | Mix_FadeInMusic | Mix_FadeOutMusic | Mix_SetMusicCMD