SDL Wiki
(This function is part of SDL_mixer, a separate library from SDL.)

Mix_VolumeMusic

Set the volume for the music channel.

Header File

Defined in <SDL3_mixer/SDL_mixer.h>

Syntax

int Mix_VolumeMusic(int volume);

Function Parameters

int volume the new volume, between 0 and MIX_MAX_VOLUME, or -1 to query.

Return Value

(int) Returns the previous volume. If the specified volume is -1, this returns the current volume.

Remarks

The volume must be between 0 (silence) and MIX_MAX_VOLUME (full volume). Note that MIX_MAX_VOLUME is 128. Values greater than MIX_MAX_VOLUME are clamped to MIX_MAX_VOLUME.

Specifying a negative volume will not change the current volume; as such, this can be used to query the current volume without making changes, as this function returns the previous (in this case, still-current) value.

The default volume for music is MIX_MAX_VOLUME (no attenuation).

Version

This function is available since SDL_mixer 3.0.0.


CategoryAPI, CategoryAPIFunction, CategorySDLMixer


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.