Skip to content

OccludedEmitter

Guribo edited this page Jul 12, 2026 · 2 revisions

OccludedEmitter

Packages/tlp.udonvoiceutils/Runtime/Core/WorldAudio/OccludedEmitter.cs

Per-emitter audio lifecycle controller for the WorldAudio system.

Overview

OccludedEmitter manages a single AudioSource in the WorldAudio system. Each emitter:

  • Registers itself with the EmitterRegistry on startup
  • Calculates its own importance (distance, volume, priority)
  • Applies reverb and lowpass filter based on distance and clarity
  • Gets culled (suspended) when beyond MaxActiveSources or privacy-gated
  • Deactivates its GameObject when culled (if configured)

One per AudioSource that should be managed by the WorldAudio system.

Requirements

Component Required
AudioSource Yes
ReverbController Yes (added automatically)
AudioSourceStateController Yes (added automatically)

Configuration

Field Default Description
DisableGameObjectWhenCulled true Deactivate GameObject when culled. Set to false for Unity videoplayer sources — disabling breaks audio in combination with private channels
PrivacyChannelId -1 Privacy channel. -1 = no privacy (always audible). Players whose override shares this channel can hear it

Lifecycle

  1. Startup — registers with EmitterRegistry
  2. Importance updatesWorldAudioController periodically recalculates this emitter's importance
  3. Per-frame updateWorldAudioController updates this emitter with cull/clarity info
  4. Culling — when culled, suspends playback and deactivates GameObject (if configured)
  5. Reactivation — when active again, reactivates GameObject and resumes playback
  6. Destruction — unregisters from EmitterRegistry

Privacy Channel Behavior

Local Override Emitter Channel Result
Any -1 (NoPrivacy) Audible (unless local override mutes outsiders)
Channel X Channel X Audible (unless DisallowListeningToChannel is set)
Channel X Channel Y Culled
None Any except -1 Culled
None -1 Audible

Important Limitation

Do not directly control the AudioSource (Play/Pause/Stop/clip changes) when it is managed by this component. All control must go through AudioSourceStateController. Direct manipulation conflicts with culling and importance sorting.

Only works with Unity-based video players. Does not work with AVPro. Use Unity's built-in video player if you need WorldAudio to manage the audio.

Related

Clone this wiki locally