Resonance Audio Unity SDK API Reference
Source
Constructor
Source
new Source(scene, options)
Source model to spatialize an audio buffer.
Parameter |
|
---|---|
scene |
Associated ResonanceAudio instance. |
options |
Options for constructing a new Source. |
Property
input
AudioNode
Mono (1-channel) input AudioNode.
Methods
setDirectivityPattern
setDirectivityPattern(alpha, sharpness)
Set source's directivity pattern (defined by alpha), where 0 is an omnidirectional pattern, 1 is a bidirectional pattern, 0.5 is a cardiod pattern. The sharpness of the pattern is increased exponentially.
Parameter |
|
---|---|
alpha |
Number Determines directivity pattern (0 to 1). |
sharpness |
Number Determines the sharpness of the directivity pattern (1 to Inf). |
setFromMatrix
setFromMatrix(matrix4)
Set source's position and orientation using a Three.js modelViewMatrix object.
Parameter |
|
---|---|
matrix4 |
Float32Array The Matrix4 representing the object position and rotation in world space. |
setGain
setGain(gain)
Set source's gain (linear).
Parameter |
|
---|---|
gain |
Number |
setMaxDistance
setMaxDistance(maxDistance)
Set source's maximum distance (in meters).
Parameter |
|
---|---|
maxDistance |
Number |
setMinDistance
setMinDistance(minDistance)
Set source's minimum distance (in meters).
Parameter |
|
---|---|
minDistance |
Number |
setOrientation
setOrientation(forwardX, forwardY, forwardZ, upX, upY, upZ)
Set the source's orientation using forward and up vectors.
Parameter |
|
---|---|
forwardX |
Number |
forwardY |
Number |
forwardZ |
Number |
upX |
Number |
upY |
Number |
upZ |
Number |
setPosition
setPosition(x, y, z)
Set source's position (in meters), where origin is the center of the room.
Parameter |
|
---|---|
x |
Number |
y |
Number |
z |
Number |
setRolloff
setRolloff(rolloff)
Set source's rolloff.
Parameter |
|
---|---|
rolloff |
string Rolloff model to use, chosen from options in
|
setSourceWidth
setSourceWidth(sourceWidth)
Set the source width (in degrees). Where 0 degrees is a point source and 360 degrees is an omnidirectional source.
Parameter |
|
---|---|
sourceWidth |
Number (in degrees). |
Abstract type
SourceOptions
Object
Options for constructing a new Source.
Properties
Parameter |
|
---|---|
position |
Float32Array The source's initial position (in meters), where origin is the center of the room. Defaults to |
forward |
Float32Array The source's initial forward vector. Defaults to
|
up |
Float32Array The source's initial up vector. Defaults to
|
minDistance |
Number Min. distance (in meters). Defaults to
|
maxDistance |
Number Max. distance (in meters). Defaults to
|
rolloff |
string Rolloff model to use, chosen from options in
|
gain |
Number Input gain (linear). Defaults to
|
alpha |
Number Directivity alpha. Defaults to
|
sharpness |
Number Directivity sharpness. Defaults to
|
sourceWidth |
Number Source width (in degrees). Where 0 degrees is a point source and 360 degrees is an omnidirectional source. Defaults to
|