AttenuationCurve
Class describing a piecewise-linear curve for conversion between a source's distance to the listener and its attenuation.
It is defined by three points a
, b
, and c
, and the maxDistance
property. For distances beyond maxDistance
the source will be silent.
The first point a
not only defines its sampled point (x, y)
on the (distance, level)
graph, but also the level for distances smaller than a
's distance.
The graph will look something like
LVL
|
|___A
| \
| \___C
| B \
| \
| \
|-----------\---> DISTANCE
maxDist
note
Levels are expected in Decibels, so 0 would be unity gain, and values below zero will attenuate the source's audio level.
Public Interface
Properties
name? : string
The name of this attenuation curve (optional). This property will also be used in the Attenuation Curve Designer.
Methods
getParameters(): { a: Point2D; b: Point2D; c: Point2D; maxDistance: number; }
Returns the current parameters.
setParameters(ax: number, ay: number, bx: number, by: number, cx: number, cy: number, maxDistance: number): void
Sets new parameters.