Skip to content

class Sound3d (client-side)

Available since version: 0.1.2

This class represents 3d sound.

Constructor

Sound3d(string fileName)

Parameters:

  • string fileName: the name of the WAV audio file or SFX script instance.

Properties

float volume

Available since version: 0.1.10

Represents the sound 3d volume scale in range 0.0 to 1.0. Setting it to -1 will set the volume to the default value (which is either volume value from sfx script instance or 0.5 approx).


bool looping

Available since version: 0.1.10

Represents the sound 3d looping feature.


string file

Available since version: 0.2

Represents the file name of played sound or the name of SFX script instance.


float playingTime (read-only)

Available since version: 0.1.10

Represents the sound 3d playing time in miliseconds.


float obstruction

Represents the sound 3d obstruction.


float radius

Represents the sound 3d radius.
Settting it to -1 will set the radius to the default value (3500).


float coneAngle

Represents the sound 3d cone angle in range 0.0 to 360.0.


float reverbLevel

Represents the sound 3d reverb level.


bool ambient

Represents the sound 3d ambient mode feature.


float pitchOffset

Represents the sound 3d pitch offset.


Methods

play

This method will play the 3d sound.

void play()

stop

Available since version: 0.1.10

This method will stop the 3d sound.

void stop()

isPlaying

Available since version: 0.1.10

This method is used to check whether the 3d sound is currently playing.

bool isPlaying()

Returns bool:

true if the 3d sound is currently playing, otherwise false.


setTargetVob

This method will set the target vob, from which position the 3d sound will be played.

void setTargetVob(Vob vob)

Parameters:

  • Vob vob: the vob object reference.

setTargetPlayer

This method will set the target player/npc, from which position the 3d sound will be played.

void setTargetPlayer(int playerid)

Parameters:

  • int playerid: the id of the target player.