Difference between revisions of "GetSoundProperty"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%">
+
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
<b>Command History</b>
+
<span class="bold">Command History</span>
 
<div class="mw-collapsible-content">
 
<div class="mw-collapsible-content">
<div style="background:#ebebeb" width="100%">Available since <span style="color:orange">v3.8</span></div>
+
<div class="alt-bg">Available since v3.8</div>
 
</div></div>
 
</div></div>
  
  
Allows you to obtain various property values for the linked sound.id!
+
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%">
+
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
<b>Additional Info</b>
+
<span class="bold">Additional Info</span>
 
<div class="mw-collapsible-content">
 
<div class="mw-collapsible-content">
 
<div>Properties currently available:
 
<div>Properties currently available:
Line 47: Line 47:
  
  
<b><u>Arguments</u></b>
+
<span class="bold underline">Arguments</span>
  
<b>id</b>: integer (number) <br/>
+
<span class="bold">id</span>: integer (number) <br/>
 
The id for the currently playing audio file! ("sound.id")  
 
The id for the currently playing audio file! ("sound.id")  
  
<b>property:</b> "string"
+
<span class="bold">property:</span> "string"
 
* volume: returns the volume level of the linked sound.id as an integer value
 
* 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
 
* balance: returns the left/right audio balance of the linked sound.id as an integer value
Line 61: Line 61:
  
  
<b><u>Flags</u></b>
+
<span class="bold underline">Flags</span>
  
 
none
 
none
  
  
<b><u>Return</u></b>
+
<span class="bold underline">Return</span>
  
<b>property</b> <br/>
+
<span class="bold">property</span> <br/>
 
The requested property value  
 
The requested property value  
 
{{i18n|GetSoundProperty}} <br/>
 
{{i18n|GetSoundProperty}} <br/>
{| style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"
+
{| class="tbl-ds"
 
|-
 
|-
|<b>Relevant Pages</b>: [[GetSoundId|getSoundId]] - [[SetSoundProperty|setSoundProperty]] - [[StartSound|startSound]] - [[StopSound|stopSound]] - [[ToggleSoundPause|toggleSoundPause]]
+
|<span class="bold">Relevant Pages</span>: [[GetSoundId|getSoundId]] - [[SetSoundProperty|setSoundProperty]] - [[StartSound|startSound]] - [[StopSound|stopSound]] - [[ToggleSoundPause|toggleSoundPause]]
 
|}
 
|}

Revision as of 19:11, 2 April 2013

Command History

Available since v3.8


Allows you to obtain various property values for the linked sound ID.

Additional Info

Properties currently available:
volume, balance, offset, duration, paused & loop


Syntax:

getSoundProperty(id, "property")


Example:

-- 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, "volume")

-- let's store the current audio balance for the linked sound into a variable!
local soundBal = getSoundProperty(soundID, "balance")

-- let's store the current playtime of the linked sound into a variable!
local soundOffset = getSoundProperty(soundID, "offset")

-- let's store the duration of the linked sound into a variable!
local soundDur = getSoundProperty(soundID, "duration")

--let's check if the linked sound is paused & store the result into a variable!
local soundPaused = getSoundProperty(soundID, "paused")

--let's check if the linked sound is looping & store the result into a variable!
local soundLoop = getSoundProperty(soundID, "loop")


Arguments

id: integer (number)
The id for the currently playing audio file! ("sound.id")

property: "string"

  • 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)
  • paused: returns a boolean value of true or false depending on if linked sound is paused or playing
  • loop: returns a boolean value of true or false depending on if linked sound.id is set to loop or not


Flags

none


Return

property
The requested property value


Relevant Pages: getSoundId - setSoundProperty - startSound - stopSound - toggleSoundPause