Difference between revisions of "Global Command: setVolume"
From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "<div class="toccolours mw-collapsible mw-collapsed tbl-ds"> <span class="bold">Function History</span> <div class="mw-collapsible-content"> <div class="alt-bg">Available since...") |
|||
Line 1: | Line 1: | ||
− | + | Set the general volume levels for music, sound, speech, videos, and master. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | {| class="ts" | |
− | + | |- | |
− | + | | style="width:15%" | Related functions | |
− | + | | [[Global Command: getVolume|getVolume]] | |
− | + | |} | |
− | |||
− | |||
− | |||
− | Syntax | + | == Syntax == |
− | <syntaxhighlight> | + | <syntaxhighlight lang="lua"> |
setVolume(type, volume) | setVolume(type, volume) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | == Parameters == | |
− | |||
− | |||
− | |||
− | - | + | {| class="ts" |
− | + | |- | |
+ | ! style="width:15%" | Parameter | ||
+ | ! style="width:10%" | Type | ||
+ | ! style="width:15%" | Supported values | ||
+ | ! Description | ||
+ | |- | ||
+ | | rowspan="5" | type | ||
+ | | rowspan="5" | integer | ||
+ | | eMusicVolume (0) | ||
+ | | rowspan="5" | The type of volume to return. | ||
− | |||
− | |||
− | -- | + | ''The available types are members of the [https://www.visionaire-studio.com/luadocs/lua.html#sound-volume-types 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) | ||
+ | |- | ||
+ | | volume | ||
+ | | integer | ||
+ | | | ||
+ | | The new value for volume in the range of 0 to 100. | ||
+ | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | == Return values == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
none | none | ||
− | + | == Examples == | |
− | + | '''Example 1:''' Set the speech volume level to 80. | |
+ | <syntaxhighlight lang="lua"> | ||
+ | setVolume(eSpeechVolume, 80) | ||
− | + | -- You can also pass the volume type as an integer. The following code will do the same. | |
− | + | setVolume(2, 80) | |
− | + | </syntaxhighlight> | |
− | + | {{toc}} | |
− | |||
− |
Revision as of 21:37, 4 May 2023
Set the general volume levels for music, sound, speech, videos, and master.
Related functions | getVolume |
Syntax
setVolume(type, volume)
Parameters
Parameter | Type | Supported values | Description |
---|---|---|---|
type | integer | eMusicVolume (0) | The type of volume to return.
|
eSoundVolume (1) | |||
eSpeechVolume (2) | |||
eMovieVolume (3) | |||
eGlobalVolume (4) | |||
volume | integer | The new value for volume in the range of 0 to 100. |
Return values
none
Examples
Example 1: Set the speech volume level to 80.
setVolume(eSpeechVolume, 80)
-- You can also pass the volume type as an integer. The following code will do the same.
setVolume(2, 80)