atmoky Engage Server SDK is now available! Check out the documentation to learn more.
API Reference
Classes
DistanceModel

DistanceModel

Summary
A DistanceModel converts a distance (e.g. to the virtual listener) to a gain value.
Remarks
It is implemented as a piece-wise linear curve defined by three points A, B, and C, and the maxDistance property. For distances beyond maxDistance the gain will be -inf (silent).
The first point A not only defines its sampled point on the (distance, gain) graph, but also the level for distances smaller than A's distance. In other words, distances below A will have the same gain as A.
The graph will look something like
GAIN in decibels
^
|
|___A
|   \
|    \___C
|    B   \
|         \
|          \
|-----------\---> DISTANCE
         maxDist
⚠️
Do not construct a DistanceModel instance yourself, it will be provided by the spatial audio engine.

Properties

name

Optional name of the DistanceModel.
Remarks
This can be used to identify the DistanceModel.
Type
string

Methods

getDataPoints

Returns the parameters of the attenuation curve.
Signature
getDataPoints()
Returns
DistanceModelDataPoints object holding the parameters

setDataPoints

Updates the parameters of this DistanceModel.
Signature
setDataPoints(A: DistanceModelDataPoint, B: DistanceModelDataPoint, C: DistanceModelDataPoint, maxDistance: number)
NameTypeDescription
ADistanceModelDataPointdata point
BDistanceModelDataPointdata point
CDistanceModelDataPointdata point
maxDistancenumbermax distance
Returns
void
⚠️
Make sure the following holds: maxDistance >= A.distance >= B.distance >= C.distance

atmoky Logo

© 2024 atmoky, GmbH.
All rights reserved.

We use cookies to measure and improve your browsing experience, and serve personalized ads or content.