API reference

MetaXRAudioSource Class

Extends MonoBehaviour
Component to extend the built-in AudioSource with Meta-specific features.
Adding this component to any game object that also has an AudioSource component allows specification of Meta-specific parameters to control how that audio source is rendered.
The public member variables of this class directly control the spatializer plug-in assigned to the accompaning audio source. The spatializer plug-ins values are updated to the member variable values every call to MetaXRAudioSource::Update().

Properties

EnableAcoustics : bool
[Get][Set]
Enable/disable room acoustics simulation for this AudioSource. Default = true.
If enabled, this audio source will have room acoustics simulated for it, including early reflections and reverberation in addition to rendering it's direct sound. If disabled, only the direct sound will be rendered.
Signature
bool MetaXRAudioSource.EnableAcoustics
EnableSpatialization : bool
[Get][Set]
Enable/disable HRTF Spatialization. Default = true.
If false, audio will not be spatialized (i.e. it won't pass through HRTF convolution or be sent to the reverb bus or have early reflections). This effectively is an override for the "Spatialize" parameter of Unity's built-in AudioSource component.
Signature
bool MetaXRAudioSource.EnableSpatialization
GainBoostDb : float
[Get][Set]
Gain the AudioSource's signal by an optional amount. [0dB, 20dB], Default = 0dB.
The gain will be applied to the direct sound of only this audio source, and (if enabled and again, only for this audio source) its sends to the early reflections and late reverberation busses.
Signature
float MetaXRAudioSource.GainBoostDb
ReverbSendDb : float
[Get][Set]
Additional gain to apply to the signal before sending it to the reverb bus. [-60.0dB, 20.0dB] Default = 0dB.
This gain will be applie only before sending the signal to the reverb bus. The early reflections and direct sound are not affected by this gain.
Signature
float MetaXRAudioSource.ReverbSendDb

Methods

UpdateParameters ()
Sync all the member variables of this class with the spatializer plug-in instance associated with this sound source.
This function should be called during every call to Update and there should be no need to call this explicitly unless you want to force sync the spatializer instance's parameters with this component.
Signature
void MetaXRAudioSource.UpdateParameters()
Returns
void

Inner Enum

NativeParameterIndex Enum

Enumeration of the Meta's native spatialializer plug-in for Unity.

Enumeration Constants

MemberDescription
P_GAIN
Overall gain applied to this audio source's direct sound, early reflections and late reverberation. [0, +20dB] Default = 0dB.
P_USEINVSQR
[UNUSED] Enable/disable inverse-law distance attenuation. Default: false If true (i.e 1.0), then the library will apply an inverse-square law distance attenutation to the direct sound sound. If false, the direct sound will not be attenuated in any way based on distance by the plug-in.
P_NEAR
[UNUSED) Attenuation distance minimum, in meters. [0, 10000] Default: 1m Only used when P_USEINVSQR is true.
P_FAR
[UNUSED] Attenuation distance maximum, in meters. [0, 10000] Default: 400 Only used when P_USEINVSQR is true.
P_RADIUS
Controls the volumetric radius of the sound source. [0, +Inf) Default: 0.
P_DISABLE_RFL
Enable/disable acoustics for this audio source only. Default: false.
P_AMBISTAT
[READONLY] Ambisonic stream status. Caches the status of the ambisonic stream. Mostly for internal/debugging use. Unitialized = -1, not enabled = 0, success = 1, stream error = 2, process error =3.
P_READONLY_GLOBAL_RFL_ENABLED
[READONLY] Parameter to query whether the global reflections are enabled. This parameter is controlled with the "Early Reflections Enabled" parameter of the "Meta XR Audio Reflection" audio effect plugin.
P_READONLY_NUM_VOICES
[READONLY] Parameter to query for the total number of voices that are active in the engine. Using this parameter, you can see how many voices are currently active in the engine.
P_HRTF_INTENSITY
HRTF intensity. [0, 1] Default: 1.0.
P_REFLECTIONS_SEND
Gain applied to the early reflections send. [-60.0dB, 20.0dB] Default: 0dB.
P_REVERB_SEND
Gain applied to the late reverberation send. [-60.0dB, 20.0dB] Default: 0dB.
P_DIRECTIVITY_ENABLED
Enables/disabled directivty for this audio source only. Default: false.
P_DIRECTIVITY_INTENSITY
Directivity intensity [0.0, 1.0] Default: 1.0.
P_AMBI_DIRECT_ENABLED
[Internal] Force the direct sound of an object to be rendered via an ambisonic HRTF. Default: false When true, the source will be rendered using the same ambisonic HRTFs that are used for the early reflections and late reverberation which is more computationally efficient but spatialized less accurately. If false, the direct sound will be rendered by convolving with HRTF filters directly, which is more computationaly expensive but results in more accurate spatialization.
P_REVERB_REACH
Control the "reverb reach" of a sound source. [0.0, 1.0f] Default: 0.5. When set to 0.0, the late reverberation will decrease with distance using the same distance-based attenuation applied to the direct sound. When 1.0, the late reverberation will decay at a rate slower than the direct sound. A settings of 0.5 is the most natural.
P_DIRECT_ENABLED
Enable/disable the direct sound and early reflections. Default: true.
P_OCCLUSION_INTENSITY
Adjust how much occlusion to apply with 1 being complete occlusion and 0 being no occlusion [0, 1], Default = 1.0f. When 0, the source will sound as if there is no occlusion even if there is an obstruction. When 1, no direct sound will propagate from the source if there is obstruction between the source and listener. 1 is the most realistic setting and the default.
P_NUM
Utility to easily query how many parameters the plugin has.