Skip to content

PlayerAudioView

Guribo edited this page Jul 3, 2026 · 2 revisions

PlayerAudioView

Packages/tlp.udonvoiceutils/Runtime/Core/PlayerAudioView.cs

The UI view that connects sliders and toggles to the audio configuration.

Overview

PlayerAudioView is a UdonSharp component implementing the View role in the MVC pattern (extends TLP.UdonUtils.Runtime.DesignPatterns.MVC.View).

It:

  • Displays current audio settings (voice range, gain, occlusion, directionality, avatar audio) via Unity UI sliders and toggles
  • Writes user changes back to the PlayerAudioConfigurationModel (local or master, depending on ownership)
  • Updates automatically when the model changes (e.g. master syncs new values)
  • Supports a "master control" mode where non-owner players can let the instance master control their settings
  • Provides a reset-to-defaults button

Dependencies

Field Type Purpose
LocalConfig PlayerAudioConfigurationModel Local player's audio settings (written on slider change)
MasterConfig PlayerAudioConfigurationModel Instance master's audio settings (written when master-controlled)
DefaultValues PlayerAudioConfigurationModel Reset-to-defaults source

UI Elements

The component exposes serialized references to Unity UI elements:

Voice Settings: SliderVoiceDistanceNear, SliderVoiceDistanceFar, SliderVoiceGain, SliderVoiceVolumetricRadius, ToggleVoiceLowpass

Avatar Settings: SliderAvatarDistanceNear, SliderAvatarDistanceFar, SliderAvatarGain, SliderAvatarVolumetricRadius, ToggleAvatarSpatialize, ToggleAvatarCustomCurve

Occlusion/Directionality: SliderOcclusionFactor, SliderPlayerOcclusionFactor, SliderListenerDirectionality, SliderPlayerDirectionality

Master Control: ToggleAllowMasterControl — lets the instance master override local settings

Behavior

  • When the local player changes a slider/toggle, the view writes to LocalConfig
  • If the local player is the instance master, changes also write to MasterConfig (synced to all players)
  • When AllowMasterControlLocalValues is enabled and the local player is not the master, the view displays the master's config instead
  • Reset restores all values from DefaultValues

Related

Clone this wiki locally