Difference between revisions of "Global Command: getVolume"

From The Official Visionaire Studio: Adventure Game Engine Wiki
 
(No difference)

Latest revision as of 21:28, 4 May 2023

Retrieve the general volume levels for music, sound, speech, videos, and master.

Related functions setVolume


Syntax

getVolume(type)


Parameters

Parameter Type Supported values Description
type integer eMusicVolume (0) The type of volume to return.


The available types are members of the sound volume enumeration. The parameter can be passed as name (e. g. eMusicVolume), or number (e. g. 0), see the examples.

eSoundVolume (1)
eSpeechVolume (2)
eMovieVolume (3)
eGlobalVolume (4)


Return values

Type Description
integer The queried volume level in the range of 0 to 100.


Examples

Example 1: Enable the text output, if the speech volume level is below 30.

if getVolume(eSpeechVolume) < 30 then
  game.TextOutput = eTextAndSpeechOutput
end

-- You can also pass the volume type as an integer. The following code will do the same.
if getVolume(2) < 30 then
  game.TextOutput = eTextAndSpeechOutput
end