GetSoundProperty: Difference between revisions

From The Official Visionaire Studio: Adventure Game Engine Wiki
No edit summary
No edit summary
Line 11: Line 11:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
<div>Properties currently available:
<div>Properties currently available:
<pre>volume, balance, offset, duration & loop</pre></div>
<pre>volume, balance, offset, duration, paused & loop</pre></div>
</div></div>
</div></div>


Line 17: Line 17:
Syntax:
Syntax:
<syntaxhighlight>
<syntaxhighlight>
getSoundProperty(id, {flags=1, property})
getSoundProperty(id, "property")
</syntaxhighlight>
</syntaxhighlight>


Line 27: Line 27:


-- let's store the current volume for the linked sound into a variable!
-- let's store the current volume for the linked sound into a variable!
local soundVol = getSoundProperty(soundID, {flags=1, volume})
local soundVol = getSoundProperty(soundID, "volume")


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


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


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


--let's store the current loop value of the linked sound into a variable!
--let's check if the linked sound is paused & store the result into a variable!
local soundLoop = getSoundProperty(soundID, {flags=1, loop})
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")
</syntaxhighlight>
</syntaxhighlight>


Line 49: Line 52:
The id for the currently playing audio file! ("sound.id")  
The id for the currently playing audio file! ("sound.id")  


 
<b>property:</b> "string"
<b><u>Flags</u></b>
 
<b>property</b>
* 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
* offset:  returns current playing time of the linked sound.id as an integer value (ms)
* 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)
* 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
* loop: returns a boolean value of true or false depending on if linked sound.id is set to loop or not


<b><u>Flags</u></b>
none


<b><u>Return</u></b>
<b><u>Return</u></b>


see flags (above)
see arguments (above)
{{i18n|GetSoundProperty}} <br/>
{{i18n|GetSoundProperty}} <br/>
{| style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"
{| style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"

Revision as of 18:57, 14 March 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

see arguments (above)


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