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 parameterssetDataPoints
Updates the parameters of this DistanceModel.
Signature
setDataPoints(A: DistanceModelDataPoint, B: DistanceModelDataPoint, C: DistanceModelDataPoint, maxDistance: number)
Name | Type | Description |
---|---|---|
A | DistanceModelDataPoint | data point |
B | DistanceModelDataPoint | data point |
C | DistanceModelDataPoint | data point |
maxDistance | number | max distance |
Returns
void
⚠️
Make sure the following holds:
maxDistance >= A.distance >= B.distance >= C.distance