audPlaySound3D

Plays a sound once at a specific 3D position and returns a channel handle. Takes sound (sound handle), x/y/z (3D position coordinates). Returns a channel handle.

Audio

Parameters & Returns

Parameters

sound Int
x Double
y Double
z Double

Returns

Int

Quick Summary

Plays a sound once at a specific 3D position and returns a channel handle. Takes sound (sound handle), x/y/z (3D position coordinates). Returns a channel handle.

Technical Exegesis...

Plays the specified sound once at the given 3D position (x, y, z) and returns a channel handle. Returns 0 if the sound handle is invalid or <= 0.

The sound's volume and panning are automatically calculated based on the distance and direction from the listener position. Use audSetListenerPosition to set where the listener is located. The returned channel handle can be used with standard channel control functions.

Example

Example.bam
Local pistolSound:Int = audLoadSound(\"pistol.wav\")

Local channel = audPlaySound3D(pistolSound, sourceX, sourceY, sourceZ)