Skip to content

AudioSourceStateController

Guribo edited this page Jul 11, 2026 · 3 revisions

AudioSourceStateController

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

Manages AudioSource play/pause/stop state and handles culling suspension.

Overview

AudioSourceStateController manages the lifecycle of a single AudioSource. It provides:

  • Play/Pause/Stop — standard playback control
  • Culling — suspends playback when the emitter is culled by the importance system
  • Position tracking — preserves logical playback position during culling for seamless resume

Part of the WorldAudio subsystem. One per OccludedEmitter. Automatically called during emitter updates — world creators do not interact with this component directly.

Culling Behavior

When an emitter is culled (beyond max active sources or privacy-gated):

  1. Playback is suspended and the current position is saved
  2. The actual AudioSource is stopped
  3. Logical playback position is computed from elapsed time on resume
  4. When the emitter becomes active again, playback resumes from the correct position

If the clip length changes during culling, playback restarts from the beginning.

Important Limitation

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

Related

Clone this wiki locally