Audio Output
This component is required when the audio output mode is set to Unity. It handles retrieving the audio data from the plugin via OnAudioFilterRead()
and playing it in Unity through an AudioSource
component. The number of audio channels that are processed will depend on the Audio settings in Unity and the number of channels in the media. For best performance and latency the sample rate of your audio should match that of Unity.
Properties
Property | Function |
---|---|
MediaPlayer | The MediaPlayer component to retrieve audio from |
AudioOutputMode | Selects the mode for how audio channels are rendered. OneToAllChannels: will take a single audio channel and copy it to all the output audio channels. This can be useful when used with the AudioChannelMixer to pan audio across speakers. MultipleChannels: Allows selection of which channels to play back (default is all). |
Support Positional Audio | When the AudioSource has the Spatial Blend set then the position of the audio Transform relative to the AudioListener transform is used to attenuate the audio based on distance. This can also apply the doppler effect as the audio moves relative to the listener. |
Tip
You can retrieve the AudioSource
component that is being used by the MediaPlayer by using the AudioSource
property in the MediaPlayer.
From the AudioSource you can use methods such as GetSpectrumData()
to create audio visualisations.
Warning
If you use the option to support positional audio then reading back the audio via methods such as GetSpectrumData()
will not work