Difference between revisions of "StopSound"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
+
==stopSound==
<span class="bold">Command History</span>
 
<div class="mw-collapsible-content">
 
<div class="alt-bg">Available since v3.8</div>
 
</div></div>
 
  
 +
<div class="command-min-version-info">Available since: <span class="command-min-version">v3.8</span></div>
  
Allows you to stop any playing sound files!
+
<div class="command-doc">Stops the specified sound.</div>
  
 
+
Lua Syntax:
Syntax:
+
<pre class="command-syntax">stopSound(soundID)</pre>
 +
===Arguments===
 +
====soundID====
 +
:'''int''' - ID of the sound which should be stopped
 +
===Flags===
 +
===Return Values===
 +
;status
 +
:True if sound was stopped successfully, false otherwise.
 +
===Examples===
 +
Example 1:  
 
<syntaxhighlight>
 
<syntaxhighlight>
stopSound(id)
+
local soundID = getSoundId('vispath:sounds/example.ogg')
</syntaxhighlight>
 
 
 
 
 
Example 1: basic stop audio file method! (!messy)
 
<syntaxhighlight>
 
stopSound(getSoundId("sounds/example.ogg"))
 
</syntaxhighlight>
 
 
 
Example 2: again using sound.id via a variable!
 
<syntaxhighlight>
 
-- let's store the sound.id for example.ogg inside of a variable!
 
local soundID = getSoundId("sounds/example.ogg")
 
 
stopSound(soundID)
 
stopSound(soundID)
 
</syntaxhighlight>
 
</syntaxhighlight>
 
 
 
<span class="bold underline">Arguments</span>
 
 
<span class="bold">id</span>: integer (number) <br/>
 
The id for the currently playing audio file! ("sound.id")
 
 
 
<span class="bold underline">Flags</span>
 
 
none
 
 
 
<span class="bold underline">Return</span>
 
 
none
 
{{i18n|StopSound}} <br/>
 
{| class="tbl-ds"
 
|-
 
|<span class="bold">Relevant Pages</span>: [[GetSoundId|getSoundId]] - [[GetSoundProperty|getSoundProperty]] - [[SetSoundProperty|setSoundProperty]] - [[StartSound|startSound]] - [[ToggleSoundPause|toggleSoundPause]]
 
|}
 

Revision as of 18:12, 22 November 2013

stopSound

Available since: v3.8
Stops the specified sound.

Lua Syntax:

stopSound(soundID)

Arguments

soundID

int - ID of the sound which should be stopped

Flags

Return Values

status
True if sound was stopped successfully, false otherwise.

Examples

Example 1:

local soundID = getSoundId('vispath:sounds/example.ogg')
stopSound(soundID)