audio.setMaxVolume()

Type Function
Library audio.*
Return value Boolean
Revision Release 2022.3683
Keywords audio, volume, max volume, set maximum, sound
See also audio.setMinVolume()
audio.getVolume()
audio.setVolume()
audio.getMaxVolume()
audio.setMinVolume()
audio.getMinVolume()

Overview

Clamps the maximum volume to the set value. Any volumes that exceed the value will be played at the maximum volume level.

This function returns true on success or false if otherwise.

Gotchas

There is no max volume for the master volume.

Syntax

audio.setMaxVolume( volume, options )
volume (required)

Number. The new max volume level you want to apply. Valid numbers range from 0.0 to 1.0, where 1.0 is the maximum value.

options (required)

Table. Table that supports a single key, channel, which is the channel number you want to set the max volume on. Valid channels are 1 to the maximum number of channels (currently 32). Specify 0 to apply the max volume to all channels.

Example

audio.setMaxVolume( 0.75, { channel=1 } )