Difference between revisions of "SetSoundProperty"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "<div class="toccolours mw-collapsible mw-collapsed" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"> <b>Command History</b> <div class="mw-collapsible-co...")
 
(Redirected page to Global Command: setSoundProperty)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%">
+
#REDIRECT [[Global Command: setSoundProperty]]
<b>Command History</b>
 
<div class="mw-collapsible-content">
 
<div style="background:#ebebeb" width="100%">Available since <span style="color:orange">v3.8</span></div>
 
</div></div>
 
 
 
 
 
Allows you to obtain various property values for the linked sound.id!
 
<div class="toccolours mw-collapsible mw-collapsed" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%">
 
<b>Additional Info</b>
 
<div class="mw-collapsible-content">
 
<div>Properties currently available:
 
<pre>volume, balance, offset, duration & loop</pre></div>
 
</div></div>
 
 
 
 
 
Syntax:
 
<syntaxhighlight>
 
getSoundProperty(id, {flags=1, property})
 
</syntaxhighlight>
 
 
 
 
 
Example:
 
<syntaxhighlight>
 
-- let's store the sound.id into a variable!
 
local soundID = getSoundId("sounds/example.ogg")
 
 
 
-- let's store the current volume for the linked sound into a variable!
 
local soundVol = getSoundProperty(soundID, {flags=1, volume})
 
 
 
-- let's store the current audio balance for the linked sound into a variable!
 
local soundBal = getSoundProperty(soundID, {flags=1, balance})
 
 
 
-- let's store the current playtime of the linked sound into a variable!
 
local soundOffset = getSoundProperty(soundID, {flags=1, offset})
 
 
 
-- let's store the duration of the linked sound into a variable!
 
local soundDur = getSoundProperty(soundID, {flags=1, duration})
 
 
 
--let's store the current loop value of the linked sound into a variable!
 
local soundLoop = getSoundProperty(soundID, {flags=1, loop})
 
</syntaxhighlight>
 
 
 
 
 
 
 
<b><u>Arguments</u></b>
 
 
 
<b>id</b>: integer (number) <br/>
 
The id for the currently playing audio file! ("sound.id")
 
 
 
 
 
<b><u>Flags</u></b>
 
 
 
<b>property</b>
 
* volume: returns the volume level of the linked sound.id as an integer value
 
* balance: returns the left/right audio balance of the linked sound.id as an integer value
 
* offset:  returns current playing time of the linked sound.id as an integer value (ms)
 
* duration: returns duration of the linked sound.id as an integer value (ms)
 
* loop: returns a boolean value of true or false depending on if linked sound.id is set to loop or not
 
 
 
 
 
<b><u>Return</u></b>
 
 
 
see flags (above)
 
{{i18n|GetSoundProperty}} <br/>
 
{| style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"
 
|-
 
|<b>Relevant Pages</b>: [[GetSoundId|getSoundId]] - [[SetSoundProperty|setSoundProperty]] - [[StartSound|startSound]] - [[StopSound|stopSound]] - [[ToggleSoundPause|toggleSoundPause]]
 
|}
 

Latest revision as of 12:31, 19 May 2023