Difference between revisions of "SetSoundProperty"

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 set various property values for the linked sound.id!
 
Allows you to set 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>Additional Info</span>
 
<div class="mw-collapsible-content">
 
<div class="mw-collapsible-content">
 
<div>Properties currently available:
 
<div>Properties currently available:
Line 27: Line 27:
 
local soundID = getSoundId("sounds/example.ogg")
 
local soundID = getSoundId("sounds/example.ogg")
  
-- set the linked sound property values to:  volume=80%, audio=centered, duration at 3 seconds, keep current offset with loop mode on!
+
-- set the linked sound property values to:  volume=80%, audio=centered, keep current offset with loop mode on!
setSoundProperty(soundID, {flags=1, volume=100, balance=0, duration=3000, offset=0, loop=true})
+
setSoundProperty(soundID, {flags=1, volume=100, balance=0, offset=0, loop=true})
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
  
<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><u>Flags</u></b>
+
<span class="bold underline">Flags</span>
  
<b>properties</b>
+
<span class="bold">properties</span>
 
* volume: allows you to set volume level via an integer value
 
* volume: allows you to set volume level via an integer value
 
* balance: allows you to set the left/right audio balance via an integer value (-1000/0/1000)
 
* balance: allows you to set the left/right audio balance via an integer value (-1000/0/1000)
* duration: allows you to set a custom duration time for the linked sound
 
 
* offset: allows you to start audio file from x time via an integer value (in ms)
 
* offset: allows you to start audio file from x time via an integer value (in ms)
 
* loop: allows you to declare if audio file should loop via a boolean value (true/false)
 
* loop: allows you to declare if audio file should loop via a boolean value (true/false)
  
  
<b><u>Return</u></b>
+
<span class="bold underline">Return</span>
  
 
none
 
none
 
{{i18n|GetSoundProperty}} <br/>
 
{{i18n|GetSoundProperty}} <br/>
{| style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"
+
{| class="tbl-ds"
 
|-
 
|-
|<b>Relevant Pages</b>: [[GetSoundId|getSoundId]] - [[GetSoundProperty|GetSoundProperty]] - [[StartSound|startSound]] - [[StopSound|stopSound]] - [[ToggleSoundPause|toggleSoundPause]]
+
|<span class="bold">Relevant Pages</span>: [[GetSoundId|getSoundId]] - [[GetSoundProperty|GetSoundProperty]] - [[StartSound|startSound]] - [[StopSound|stopSound]] - [[ToggleSoundPause|toggleSoundPause]]
 
|}
 
|}

Revision as of 17:24, 3 April 2013

Command History

Available since v3.8


Allows you to set various property values for the linked sound.id!

Additional Info

Properties currently available:
volume, balance, offset, duration & loop
Please note that only mono sounds can be panned using the balance property; all stereo channel sounds will remain centered!


Syntax:

setSoundProperty(id, {flags=1, properties})


Example:

-- let's store the sound.id into a variable!
local soundID = getSoundId("sounds/example.ogg")

-- set the linked sound property values to:  volume=80%, audio=centered, keep current offset with loop mode on!
setSoundProperty(soundID, {flags=1, volume=100, balance=0, offset=0, loop=true})


Arguments

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


Flags

properties

  • volume: allows you to set volume level via an integer value
  • balance: allows you to set the left/right audio balance via an integer value (-1000/0/1000)
  • offset: allows you to start audio file from x time via an integer value (in ms)
  • loop: allows you to declare if audio file should loop via a boolean value (true/false)


Return

none


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