Difference between revisions of "StartSound"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 10: Line 10:
 
<b>Additional Info</b>
 
<b>Additional Info</b>
 
<div class="mw-collapsible-content">
 
<div class="mw-collapsible-content">
<div>Currently available properties: <br/>
+
<div>Currently available properties:
* volume (allows you to set volume level)
+
<div><pre>volume, balance, offset & loop</pre></div></div>
* balance (allows you to set left/right balance)
 
* offset (allows you to start audio file from x time; in ms)
 
* loop (allows you to loop the audio file)</div>
 
 
</div></div>
 
</div></div>
  
Line 24: Line 21:
  
  
Example 1: basic play audio file method
+
Example 1: basic play audio file method!
 
<syntaxhighlight>
 
<syntaxhighlight>
n/a
+
startSound("sounds/example.ogg")
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Example 2: ...
+
Example 2: again with properties!
 
<syntaxhighlight>
 
<syntaxhighlight>
n/a
+
-- 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 it to start the audio file at say 2 minutes & 44 seconds; so what we need to do is convert minutes/seconds into ms like so: (2.44 * 60) * 1000 = 146400ms
 +
--]]
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 19:06, 8 March 2013

Command History

Available since v3.8


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

Additional Info

Currently available properties:
volume, balance, offset & loop


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 it to start the audio file at say 2 minutes & 44 seconds; so what we need to do is convert minutes/seconds into ms like so: (2.44 * 60) * 1000 = 146400ms
--]]


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: ... links here