Audio Output is a component that is used to output sound from any kind of IAudioSource. This includes but is not limited to: Audio streams, audio clip players, and voices.
Fields
Name | Type | Description |
---|---|---|
persistent
|
Bool | Determines whether or not this item will be saved to the server. |
UpdateOrder
|
Int | Controls the order in which this component is updated. |
Enabled
|
Bool | Controls whether or not this component is enabled. |
Volume
|
Float | The volume to play the clip at, from 0 to 1. |
Source
|
IAudioSource | The source of audio. Can be an AudioClipPlayer, LerpingMultiClipPlayer, or MultiAudioClipPlayer. |
SpatialBlend
|
Float | Blends the the audio between 3D & 2D. |
Spatialize
|
Bool | Enables or disables rather it's 3D or 2D. |
DopplerLevel
|
Float | Simulates audio distortion when you or the object is moving. |
RolloffMode
|
AudioRolloffMode | Switches between logarithmic and Linear audio falloff. |
MinDistance
|
Float | Minimum distance you need to be from the source to hear the audio. |
MaxDistance
|
Float | Maximum distance from the source until you no longer hear the audio. |
Priority
|
Int | see Unity audio source priority |
AudioTypeGroup
|
AudioTypeGroup | Changes what track of Audio the source should be. SoundEffects, Multimedia, Voice, User Interface. |
DistanceSpace
|
AudioDistanceSpace | Chooses rather the audio should use it's local scale or it's global scale. |
MinScale
|
Float | See Min and Max Scale |
MaxScale
|
Float | See Min and Max Scale |
IgnoreReverbZones
|
Bool | If the Audio Source should ignore Reverb Zones. |
excludedUsers
|
list of User | User references placed in here will be excluded from hearing the audio. |
Sync Delegates
Name | Arguments | Description |
---|---|---|
ExludeUser()
|
Action`1<User: user> | Excludes the User provided to it, so that user cannot hear this audio output. |
ExludeLocalUser()
|
Action | Excludes the local user running this sync method, so they cannot hear this audio output. |
RemoveLocalExcludedUser()
|
Action | if currently excluded, makes it to where the local user running this sync method is no longer excluded from hearing this audio output. |
RemoveExludedUser()
|
Action`1<User: user> | If provided user is currently excluded, makes it so that the provided user is no longer excluded from hearing this audio output. |
ClearExludedUsers()
|
Action | Clears all excluded users from the list |
IsUserExluded()
|
Func`2<User: user> | When provided a user, this function returns whether or not that user is excluded from hearing this audio clip. |
Min and Max scale
If AudioDistanceSpace
is set to Local, then first the scale's XYZ values are averaged. then that number is clamped between MinScale
and MaxScale
. Finally MinDistance
and MaxDistance
are multipled by the number, and set to the results. Basically scaling min and max distances up/down.
Usage
Audio Output is used to Output audio from a large variety of audio sources. From Audio Clips, Audio Streams, Opus Streams, etc. Be careful with how many Audio Outputs you have in a world at once or the Audio Buffer can be overfilled and you wont hear anymore Audio Sources until it's cleared. You can negate this by disabling the Active State of the Audio Output component when it's not in use.
Examples
In this example. I'm using a AudioClipPlayer that's going into the Audio Output Source. I set it's volume to .5 so it plays at half volume, disabled DopplerLevel by setting it to 0, changed it's RolloffMode to Linear drop off and made it so you'll only only hear the audio from 5 meters away. I also made it so a specific user can not hear the audio.