ent_playsound ( ENTITY*, SOUND*, var volume): handle
ent_playsound2 (
ENTITY*, SOUND*, var
volume, var range): handle
Plays a 3D sound at the current position of the given entity.
ent_playloop (
ENTITY*, SOUND*, var volume): handle
ent_playloop2 ( ENTITY*, SOUND*, var volume, var range): handle
Plays
a 3D sound in an endless loop until it is stopped explicitly.
The sound source moves together with the entity.
Parameter:
ENTITY* |
Entity pointer. |
SOUND* |
SOUND object pointer. |
volume |
sound volume in percent (0..1000), and range in 10 quant units (0..10000). |
range |
range in quants (0..100000). |
Returns:
Sound handle.Remarks:
- Up to 32
DirectPlay sounds and an arbitrary number of OpenAL sounds
can be played simultaneously.
-
If no range is given, the sound range is set to 10 times its volume. The volume may then be set at above 100
to give a huge range; the sound itself, of course, is not played louder than with volume 100.
If the camera is out of the sound range, the sound won't be played unless it's a loop sound.
-
The entity must already be initialized at the time the sound is played.
Thus the sound can be played 1 frame cycle after entity creation the earliest.
-
The sound will use the sound card's stereo and 3D capabilities, and plays with Doppler effect depending on the entities' position and
it's speed (adjustable with doppler_factor).
- The sound volume and frequency can the tuned with snd_tune().
The sound status can be checked with snd_playing().
-
The pdsbs pointer (defined in avars.h) is set to to the DirectPlay sound buffer of the last ent_playsound / ent_playloop call, and can be used for manipulating the sound with DirectPlay functions.
Example:
SOUND* whosh = "whosh.wav";
var whosh_handle;
...
whosh_handle = ent_playloop(my,whosh,100);
See also:
snd_play, snd_create,
snd_tune, snd_playing,
doppler_factor,
reverb effects
► latest
version online