ResonanceAudio Class Reference

ResonanceAudio

This is the main Resonance Audio class that communicates with the native code implementation of the audio system.

Summary

Native functions of the system can only be called through this class to preserve the internal system functionality. Public function calls are not thread-safe.

Properties

ListenerTransform
static Transform
Audio listener transform.

Public static attributes

listenerDirectivityColor = 0.65f * Color.magenta
readonly Color
Listener directivity GUI color.
sourceDirectivityColor = 0.65f * Color.blue
readonly Color
Source directivity GUI color.

Public attributes

distanceEpsilon = 0.01f
const float
Minimum distance threshold between |minDistance| and |maxDistance|.
maxDistanceLimit = 1000000.0f
const float
Max distance limit that can be set for volume rolloff.
maxGainDb = 24.0f
const float
Maximum allowed gain value in decibels.
maxNumOcclusionHits = 12
const int
Maximum allowed number of raycast hits for occlusion computation per source.
maxReflectivity = 2.0f
const float
Maximum allowed reflectivity multiplier of a room surface material.
maxReverbBrightness = 1.0f
const float
Maximum allowed reverb brightness modifier value.
maxReverbTime = 3.0f
const float
Maximum allowed reverb time modifier value.
minDistanceLimit = 990099.0f
const float
Min distance limit that can be set for volume rolloff.
minGainDb = -24.0f
const float
Minimum allowed gain value in decibels.
minReverbBrightness = -1.0f
const float
Minimum allowed reverb brightness modifier value.
occlusionDetectionInterval = 0.2f
const float
Source occlusion detection rate in seconds.

Public static functions

ComputeOcclusion(Transform sourceTransform)
float
Computes the occlusion intensity of a given |source| using point source detection.
ComputeRt60sAndProxyRoom(int totalNumPaths, int numPathsPerBatch, int maxDepth, float energyThreshold, Vector3 probePosition, float listenerSphereRadius, ref float[] outputRt60s, ref RoomProperties outputProxyRoomProperties)
bool
Computes the RT60s and proxy room properties.
ConvertAmplitudeFromDb(float db)
float
Converts given |db| value to its amplitude equivalent where 'dB = 20 * log10(amplitude)'.
DisableRoomEffects()
void
Disables the room effects.
Generate2dPolarPattern(float alpha, float order, int resolution)
Vector2[]
Generates a set of points to draw a 2D polar pattern.
InitializeReverbComputer(float[] vertices, int[] triangles, int[] materialIndices, float scatteringCoefficient)
void
Initializes the reverb computer.
StartRecording()
bool
Starts soundfield recording.
StopRecordingAndSaveToFile(string filePath, bool seamless)
bool
Stops soundfield recording and saves it into target file path.
UpdateAudioListener(ResonanceAudioListener listener)
void
Updates the audio listener.
UpdateAudioRoom(ResonanceAudioRoom currentRoom)
void
Updates the room effects of the environment with given |room| properties.
UpdateReverbProbe(ResonanceAudioReverbProbe currentReverbProbe)
void
Updates the room effects of the environment with given |reverbProbe|.

Structs

ResonanceAudio.RoomProperties

Properties

ListenerTransform

static Transform ListenerTransform

Audio listener transform.

Public static attributes

listenerDirectivityColor

readonly Color listenerDirectivityColor = 0.65f * Color.magenta

Listener directivity GUI color.

sourceDirectivityColor

readonly Color sourceDirectivityColor = 0.65f * Color.blue

Source directivity GUI color.

Public attributes

distanceEpsilon

const float distanceEpsilon = 0.01f

Minimum distance threshold between |minDistance| and |maxDistance|.

maxDistanceLimit

const float maxDistanceLimit = 1000000.0f

Max distance limit that can be set for volume rolloff.

maxGainDb

const float maxGainDb = 24.0f

Maximum allowed gain value in decibels.

maxNumOcclusionHits

const int maxNumOcclusionHits = 12

Maximum allowed number of raycast hits for occlusion computation per source.

maxReflectivity

const float maxReflectivity = 2.0f

Maximum allowed reflectivity multiplier of a room surface material.

maxReverbBrightness

const float maxReverbBrightness = 1.0f

Maximum allowed reverb brightness modifier value.

maxReverbTime

const float maxReverbTime = 3.0f

Maximum allowed reverb time modifier value.

minDistanceLimit

const float minDistanceLimit = 990099.0f

Min distance limit that can be set for volume rolloff.

minGainDb

const float minGainDb = -24.0f

Minimum allowed gain value in decibels.

minReverbBrightness

const float minReverbBrightness = -1.0f

Minimum allowed reverb brightness modifier value.

occlusionDetectionInterval

const float occlusionDetectionInterval = 0.2f

Source occlusion detection rate in seconds.

Public static functions

ComputeOcclusion

float ComputeOcclusion(
  Transform sourceTransform
)

Computes the occlusion intensity of a given |source| using point source detection.

ComputeRt60sAndProxyRoom

bool ComputeRt60sAndProxyRoom(
  int totalNumPaths,
  int numPathsPerBatch,
  int maxDepth,
  float energyThreshold,
  Vector3 probePosition,
  float listenerSphereRadius,
  ref float[] outputRt60s,
  ref RoomProperties outputProxyRoomProperties
)

Computes the RT60s and proxy room properties.

Note:This should only be called from the main Unity thread.

ConvertAmplitudeFromDb

float ConvertAmplitudeFromDb(
  float db
)

Converts given |db| value to its amplitude equivalent where 'dB = 20 * log10(amplitude)'.

DisableRoomEffects

void DisableRoomEffects()

Disables the room effects.

Note:This should only be called from the main Unity thread.

Generate2dPolarPattern

Vector2[] Generate2dPolarPattern(
  float alpha,
  float order,
  int resolution
)

Generates a set of points to draw a 2D polar pattern.

InitializeReverbComputer

void InitializeReverbComputer(
  float[] vertices,
  int[] triangles,
  int[] materialIndices,
  float scatteringCoefficient
)

Initializes the reverb computer.

Note:This should only be called from the main Unity thread.

StartRecording

bool StartRecording()

Starts soundfield recording.

Note:This should only be called from the main Unity thread.

StopRecordingAndSaveToFile

bool StopRecordingAndSaveToFile(
  string filePath,
  bool seamless
)

Stops soundfield recording and saves it into target file path.

Note:This should only be called from the main Unity thread.

UpdateAudioListener

void UpdateAudioListener(
  ResonanceAudioListener listener
)

Updates the audio listener.

Note:This should only be called from the main Unity thread.

UpdateAudioRoom

void UpdateAudioRoom(
  ResonanceAudioRoom currentRoom
)

Updates the room effects of the environment with given |room| properties.

Note:This should only be called from the main Unity thread.

UpdateReverbProbe

void UpdateReverbProbe(
  ResonanceAudioReverbProbe currentReverbProbe
)

Updates the room effects of the environment with given |reverbProbe|.

Note:This should only be called from the main Unity thread.