world.GetSoundStatus
Gets the status of a sound started by PlaySound
Prototype
long GetSoundStatus(short Buffer);
Description
Gets the status of one of the sound buffers.
If you started playing a sound with StartSound this will tell you if it is still playing, and if so, whether it is set to loop or not.
Basically if the returned number is > 0 then the sound is playing, and if it is <= 0 then it is not playing.
You might test this in a timer to see if a sound had stopped playing (eg. some music), and if so, play something else.
Buffer: Which buffer to query (1 to 10).
VBscript example
result = GetSoundStatus (1) ' find what sound buffer 1 is doing
Lua example
result = GetSoundStatus (1)
Return value
-3: Sound system is not initialized (ie. DirectX not installed or too early version)
-2: That buffer is free (never played a sound, or the sound was stopped with StopSound)
-1: Requested buffer number out of range 1 to 10
0: That buffer has reached the end and stopped playing
1: That buffer is playing a sound, but not looping
2: That buffer is playing a sound, which is a looping sound
Related topic
See also
| Function | Description |
|---|---|
| PlaySound | Plays a sound using DirectSound |
| Sound | Plays a sound |
| StopSound | Stop playing a sound started by PlaySound |