Difference between revisions of "GetSoundProperty"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: Line 1:
 
==getSoundProperty==
 
==getSoundProperty==
  
<div class="command-min-version-info">Available since: <span class="command-min-version">v3.8</span></div>
+
<div class="command-min-version-info">Available since: <span class="command-min-version">v4.0</span></div>
  
 
<div class="command-doc">Return the requested sound property</div>
 
<div class="command-doc">Return the requested sound property</div>
Line 22: Line 22:
 
local soundOffset = getSoundProperty(soundID, "offset")
 
local soundOffset = getSoundProperty(soundID, "offset")
 
</syntaxhighlight>
 
</syntaxhighlight>
[[Category:Player Commands]]
 

Revision as of 21:27, 30 September 2014

getSoundProperty

Available since: v4.0
Return the requested sound property

Lua Syntax:

getSoundProperty(soundID, property)

Arguments

soundID

int - ID of sound to get property from.

property

"string" - Property to retrieve.Currently supported properties: "volume" (0 mute ... 100 full volume, -1 if volume could not be retrieved), "balance" (-100 ... left, 0 ... center, +100 ... right, 0 if balance could not be retrieved), "offset" (current position from beginning of the sound in milliseconds, -1 if offset could not be retrieved), "duration" (total duration of sound in milliseconds, -1 if duration could not be retrieved), "loop" (true if sound is looped, false it is only played once, false if loop property could not be retrieved), "playing" (true if sound is currently playing, false otherwise)."paused" (true if sound is currently paused, false if sound is playing or not active at all).

Flags

Return Values

property
requested property value.

Examples

Example 1: store the current playtime of a sound

local soundID = getSoundId('vispath:sounds/example.ogg')
local soundOffset = getSoundProperty(soundID, "offset")