playSoundAtPosition

Script::playSoundAtPosition

Plays a sound at a certain position and returns a unique identifier to this sound source.

Declaration

SoundSourceID playSoundAtPosition(SoundID soundID, const Math::vec3& position, float gain = 1.0f, float pitch = 1.0f, bool looping = false);

Parameters

Name

Type

Description

soundID

SoundID

The sound to play or resume.

position

Math::vec3

The position to play the sound at.

gain

float

The initial sound source gain.

pitch

float

The initial sound source pitch.

looping

bool

Whether the sound is looping or not.

Returns

A unique SoundSourceID.

Notes

Each time this function is called, a new sound source will be played and a new SoundSourceID will be returned.

If no listener Entity has been set, the sound will be played globally.