m ProbablePrime moved page AudioOutput (Component) to Component:AudioOutput: Creating component Namespace |
Add Sync method descriptions |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<!--T:1--> | <!--T:1--> | ||
{{Infobox Component | {{Infobox Component | ||
|Image=AudioOutputComponent.png | |Image=AudioOutputComponent.png | ||
|Name=Audio Output | |Name=Audio Output | ||
}} | }} | ||
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 == <!--T:2--> | == Fields == <!--T:2--> | ||
Line 16: | Line 16: | ||
|MinDistance|Float| Minimum distance you need to be from the source to hear the audio. | |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. | |MaxDistance|Float| Maximum distance from the source until you no longer hear the audio. | ||
|Priority|Int| | |Priority|Int| see [https://docs.unity3d.com/ScriptReference/AudioSource-priority.html Unity audio source priority] | ||
|AudioTypeGroup|AudioTypeGroup| Changes what track of Audio the source should be. SoundEffects, Multimedia, Voice, User Interface. | |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. | |DistanceSpace|AudioDistanceSpace| Chooses rather the audio should use it's local scale or it's global scale. | ||
|MinScale|Float| | |MinScale|Float| See [[#Min and Max Scale|Min and Max Scale]] | ||
|MaxScale|Float| | |MaxScale|Float| See [[#Min and Max Scale|Min and Max Scale]] | ||
|IgnoreReverbZones|Bool| If the Audio Source should ignore Reverb Zones. | |IgnoreReverbZones|Bool| If the Audio Source should ignore Reverb Zones. | ||
|excludedUsers|SyncRefList`1| | |excludedUsers|{{RootFieldType|SyncRefList`1|[[Type:User|User]]}}|TypeAdv14=true| User references placed in here will be excluded from hearing the audio. | ||
}} | }} | ||
== Sync Delegates == | |||
{{Table ComponentTriggers | |||
|ExludeUser()|[[Type:Action`1|Action`1]]<[[Type:User|User]]: user>| Excludes the User provided to it, so that user cannot hear this audio output. | |||
|ExludeLocalUser()|[[Type:Action|Action]]| Excludes the local user running this sync method, so they cannot hear this audio output. | |||
|RemoveLocalExcludedUser()|[[Type:Action|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()|[[Type:Action`1|Action`1]]<[[Type:User|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()|[[Type:Action|Action]]|Clears all excluded users from the list | |||
|IsUserExluded()|[[Type:Func`2|Func`2]]<[[Type:User|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 <code>AudioDistanceSpace</code> is set to Local, then first the scale's XYZ values are averaged. then that number is clamped between <code>MinScale</code> and <code>MaxScale</code>. Finally <code>MinDistance</code> and <code>MaxDistance</code> are multipled by the number, and set to the results. Basically scaling min and max distances up/down. | |||
== Usage == <!--T:3--> | == Usage == <!--T:3--> | ||
Line 33: | Line 46: | ||
== Related Components == <!--T:5--> | == Related Components == <!--T:5--> | ||
[[Category:Components|Audio Output]] | [[Category:Components:Audio{{#translation:}}|Audio Output]] | ||
[[Category:Components: | [[Category:Components{{#translation:}}|Audio Output]] | ||
Latest revision as of 16:44, 7 November 2024
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.