snd_cone (var handle, ANGLE* angle, var* cone)      C  A8.22

Sets the cone width and direction for an OpenAL 3D sound.


handle Handle of an OpenAL 3D sound, returned by ent_playsound.
angle Pan and tilt direction of the sound cone.
cone[0] Inner cone angle in degrees (0..360, default = 360). Sounds inside the inner angle are audible at full volume.
cone[1] Outer cone angle in degrees (0..360, default = 360). The sound volume is linearly reduced between the inner and outer cone.
cone[2] Outer cone volume in percent (0..100, default = 100). Sounds outside the outer angle are audible at the reduced volume given here.




#include <default.c>
#include <ackoal.h>
function main() { level_load(""); ENTITY *actor = ent_create(CUBE_MDL,NULL,NULL); SOUND *sound = snd_createoal("tock.wav"); var h = ent_playloop(actor,sound,200); vec_set(camera.x,vector(-420,30,70)); vec_set(camera.pan,vector(20,-10,0)); while(1) { actor.pan += 3*time_step; vec_set(actor.x,vector(300,0,20)); vec_rotate(actor.x,vector(actor.pan-90,0,0)); snd_cone(h,actor.pan,vector(60,90,10)); wait(1); } }

See also:

snd_createOAL, ent_playsound, snd_stop, snd_playing, reverb effects

► latest version online