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, float startTime = 0.0f);
Parameters
Name |
Type |
Description |
|---|---|---|
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. |
startTime |
float |
The start time of the sound. |
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 startTime is superior to the length of the sound, if looping is false, the sound will stop directly, else, if looping is true, the sound will start at startTime modulo the length of the sound.
If no listener Entity has been set, the sound will be played globally.