Difference between revisions of "Global Command: getVolume"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 51: Line 51:
 
Example 2: using integer values instead
 
Example 2: using integer values instead
 
<syntaxhighlight>
 
<syntaxhighlight>
getVolume(eMusicVolume)
+
getVolume(0) --[[ is the same as ]]-- getVolume(eMusicVolume)
-- is the same as...
 
getVolume(0)
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 15:54, 23 March 2014

Function History

Available since v3.0
MovieVolume & GlobalVolume added to v3.8


Allows the user to check current volume levels of: music, sound, speech, video, & master.

Additional Info

These are the names or numbers used inside of the getVolume(brackets) to check specific volume types.
eMusicVolume(0), eSoundVolume(1), eSpeechVolume(2), eMovieVolume(3), or eGlobalVolume(4)


Syntax:

getVolume(type)


Example 1: recommended getVolume() method

-- is music volume over 50%?
if getVolume(eMusicVolume) > 50 then
 -- do some action!
end

-- is sound fx volume less than 25%?
if getVolume(eSoundVolume) < 25 then
 -- do some action!
end

-- is speech volume more than or equal to 80%?
if getVolume(eSpeechVolume) >= 80 then
 -- do some action!
end

-- is movie volume at 50%?
if getVolume(eMovieVolume) == 50 then
 -- do some action!
end

-- is global (master) volume not equal to 50%?
if getVolume(eGlobalVolume) ~= 50 then
 -- do some action!
end

Example 2: using integer values instead

getVolume(0) --[[ is the same as ]]-- getVolume(eMusicVolume)


Arguments

type: integer (number)
The type of volume to return: eMusicVolume(0), eSoundVolume(1), eSpeechVolume(2), eMovieVolume(3) or eGlobalVolume(4)


Flags

none


Return

volume
The queried volume



Relevant Pages: setVolume