snd_play (
SOUND*, var Volume, var Balance): handle
snd_loop
(
SOUND*, var Volume, var Balance): handle
Plays a SOUND object.
snd_loop plays the sound endlessly until it is stopped
explicitly. The function returns a sound handle which allows further manipulation or prematurely stopping the sound. The handle
is valid as long as this sound plays.
Parameters:
SOUND* |
SOUND pointer
from a global SOUND object
(.ogg or .wav)
or from a snd_create call. |
Volume |
volume (0..100). |
Balance |
stereo balance (-100 .. +100). Negative values turns the sound to the left, positive to the right speaker.. |
Returns:
Sound handle.
Speed:
Medium
Remarks:
-
Up to 32
DirectPlay sounds and an arbitrary number of OpenAL sounds
may be played simultaneously.
- You can create an echo effect by playing the same sound twice, with a short
delay in-between.
-
The pdsbs pointer (defined in avars.h) is set to to the
DirectSound buffer of the last snd_play / snd_loop call, and can be used for manipulating DirectSound sounds.
-
The sound can only be heard when the engine window has the focus or the engine runs in fullscreen mode. For playing a background sound regardless of the window focus, use media_play.
Example:
SOUND* whamm_snd = "whamm.wav";
var whamm_handle;
...
whamm_handle = snd_play(whamm_snd, 100, 0);
See also:
SOUND, ent_playsound, snd_stop,
snd_pause, snd_start,
snd_tune,
snd_playing,
media_play
► latest
version online