snd_play (
SOUND*, var Volume, var Balance);
snd_loop
(
SOUND*, var Volume, var Balance);
snd_play
plays a previously defined SOUND object with
the volume given (0..100).
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.
Up to 32 sounds may be played simultaneously.
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:
-
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 DirectPlay sound buffer of the last snd_play / snd_loop call, and can be used for manipulating the sound with DirectPlay functions.
-
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