Interface: AudioSpatial
Defined in: audio.ts:62
How a positional voice gets quieter with distance.
Every field is something all three hosts already expose per source - three's
PositionalAudio has setRefDistance, setRolloffFactor, setMaxDistance
and setDistanceModel; IWSDK's AudioSource has the same four, one of them
as a DistanceModel enum; XR Blocks' spatial audio has its own equivalents.
Leaving them out of the contract does not make the stack portable, it makes
every adapter apply one constant to every sound, which is the opposite of
the job: a footstep and a waterfall do not fall off at the same rate.
Omitted fields are the host's own defaults, which is why there is no "resolved" form of this. The core has no opinion about how far a sound carries.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
cone? | readonly | AudioCone | Which way the sound points, and how narrowly. Distance says how quiet a sound gets as you walk away; this says how quiet it gets as you walk AROUND it. A television, a PA horn and a person talking are all quieter behind than in front, and without this every one of them plays as a glowing orb of sound. The cone is a property of the CUE, because it describes what kind of thing is making the noise. Which way that particular one is turned is a property of the play - see PlayOptions.facing. | audio.ts:83 |
maxDistance? | readonly | number | Metres past which it gets no quieter. | audio.ts:68 |
model? | readonly | "linear" | "exponential" | "inverse" | The attenuation curve. Web Audio's three, which every host maps to. | audio.ts:70 |
refDistance? | readonly | number | Metres at which the sound is at full volume. | audio.ts:64 |
rolloffFactor? | readonly | number | How quickly it falls off past that. Higher is faster. | audio.ts:66 |