world.StopSound
Stop playing a sound started by PlaySound
Prototype
long StopSound(short Buffer);
Description
Stops one, or all, sound buffers from playing.
It is not necessary to call this for non-looping sounds, which stop of their own accord anyway, however doing so would free up the memory used by the sound.
The buffer argument specifies which buffer to stop (1 to 10) or 0 to stop all sound buffers playing.
VBscript example
StopSound 0 ' Stop playing all sounds
StopSound 1 ' Stop playing sound buffer #1
Lua example
StopSound (0) -- Stop playing all sounds
StopSound (1) -- Stop playing sound buffer #1
Lua notes
The buffer number is optional and defaults to zero, which will stop all sounds from playing.
Return value
eBadParameter: Buffer number outside range 0 to 10
eOK: Requested buffer(s) have been stopped.
Related topic
See also
| Function | Description |
|---|---|
| GetSoundStatus | Gets the status of a sound started by PlaySound |
| PlaySound | Plays a sound using DirectSound |
| Sound | Plays a sound |