Component:AudioOutput: Difference between revisions

From Resonite Wiki
fix formatting error
Automated: update Categories, SyncDelegates
Line 23: Line 23:
|IgnoreReverbZones|Bool| If the Audio Source should ignore Reverb Zones.
|IgnoreReverbZones|Bool| If the Audio Source should ignore Reverb Zones.
|excludedUsers|{{RootFieldType|SyncRefList`1|[[Type:User|User]]}}|TypeAdv14=true| User references placed in here will be excluded from hearing the audio.
|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>|
|ExludeLocalUser()|[[Type:Action|Action]]|
|RemoveLocalExcludedUser()|[[Type:Action|Action]]|
|RemoveExludedUser()|[[Type:Action`1|Action`1]]<[[Type:User|User]]: user>|
|ClearExludedUsers()|[[Type:Action|Action]]|
|IsUserExluded()|[[Type:Func`2|Func`2]]<[[Type:User|User]]: user>|
}}
}}


Line 37: Line 47:
== Related Components == <!--T:5-->
== Related Components == <!--T:5-->
[[Category:Components:Audio{{#translation:}}|Audio Output]]
[[Category:Components:Audio{{#translation:}}|Audio Output]]
[[Category:ComponentStub]]
[[Category:Components{{#translation:}}|Audio Output]]
[[Category:Components{{#translation:}}|Audio Output]]

Revision as of 13:11, 6 November 2024

Component image 
Audio Output component as seen in the Scene Inspector

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

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

Triggers
Name Arguments Description
ExludeUser() Action`1<User: user>
ExludeLocalUser() Action
RemoveLocalExcludedUser() Action
RemoveExludedUser() Action`1<User: user>
ClearExludedUsers() Action
IsUserExluded() Func`2<User: user>

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.

Related Components