Difference between revisions of "StartSound"

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 play sound files; with optional property values!
 
Allows you to play sound files; with optional property values!
<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 44: Line 44:
  
  
<b><u>Arguments</u></b>
+
<span class="bold underline">Arguments</span>
  
<b>filename</b>: path <br/>
+
<span class="bold">filename</span>: path <br/>
 
The path to the audio file to be played! ("path/filename.type")
 
The path to the audio file to be played! ("path/filename.type")
  
  
<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)
Line 59: Line 59:
  
  
<b><u>Return</u></b>
+
<span class="bold underline">Return</span>
  
 
none
 
none
 
{{i18n|StartSound}} <br/>
 
{{i18n|StartSound}} <br/>
{| style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"
+
{| class="tbl-ds"
 
|-
 
|-
|<b>Relevant Pages</b>: [[GetSoundId|getSoundId]] - [[GetSoundProperty|getSoundProperty]] - [[SetSoundProperty|setSoundProperty]] - [[StopSound|stopSound]] - [[ToggleSoundPause|toggleSoundPause]]
+
|<span class="bold">Relevant Pages</span>: [[GetSoundId|getSoundId]] - [[GetSoundProperty|getSoundProperty]] - [[SetSoundProperty|setSoundProperty]] - [[StopSound|stopSound]] - [[ToggleSoundPause|toggleSoundPause]]
 
|}
 
|}

Revision as of 13:12, 4 April 2013

Command History

Available since v3.8


Allows you to play sound files; with optional property values!

Additional Info

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


Syntax:

startSound("filename", {flags=1, properties})


Example 1: basic play audio file method!

startSound("sounds/example.ogg")

Example 2: again with properties!

-- play example.ogg at 100% volume level, audio centered, from 1 second mark with loop mode on!
startSound("sounds/example.ogg", {flags=1, volume=100, balance=0, offset=1000, loop=true})

--[[
let's say you have an audio file with a duration of 00:03:24 & you want to start the audio file at: 2 minutes & 44 seconds;
so what we need to do is convert minutes/seconds into ms like so: (2*60)*1000 + (44*1000) = 164000ms

math explanation:
2m*60s = 120 seconds * 1000ms = 120,000ms | 44s*1000ms = 44,000ms
120,000 + 44,000 = 164,000ms
--]]


Arguments

filename: path
The path to the audio file to be played! ("path/filename.type")


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 - setSoundProperty - stopSound - toggleSoundPause