AudioSourceComponent Class
Definition¶
Namespace: Brine2D.Systems.Audio
Abstract base for audio source components. Use SoundEffectSourceComponent for one-shot/looping sound effects or MusicSourceComponent for streaming music.
public abstract class AudioSourceComponent : Brine2D.ECS.Component
Inheritance System.Object → Component → AudioSourceComponent
Derived
↳ MusicSourceComponent
↳ SoundEffectSourceComponent
| Properties | |
|---|---|
| Bus | Audio bus name for group operations (per-bus volume, pause, resume, stop). Defaults to "sfx" for sound effects and "music" for music. |
| IsPaused | Whether this is currently paused (managed by AudioSystem). |
| IsPlaying | Whether this is currently playing (managed by AudioSystem). |
| LoopCount | Number of times to loop (-1 = infinite, 0 = play once). Values below -1 are clamped to -1. |
| Pitch | Playback speed multiplier (0.25 to 4.0, default 1.0). Values outside the range are clamped. |
| PlaybackEnded | Set to true by the audio system when playback ends naturally (track completed or evicted), not by TriggerStop or disabling. Reset to false when new playback starts via TriggerPlay. |
| PlayOnEnable | Whether to automatically play when the component becomes enabled. |
| Priority | Track priority for eviction when all tracks are in use. Higher values are less likely to be evicted. |
| TriggerPause | Set to true to pause the sound/music on the next frame. Consumed and reset to false by AudioSystem each update. If both TriggerPause and TriggerResume are set, both are cleared and no action is taken. |
| TriggerPlay | Set to true to play the attached sound/music on the next frame. Consumed and reset to false by AudioSystem each update. If both TriggerPlay and TriggerStop are set, both are cleared and no action is taken. |
| TriggerResume | Set to true to resume a paused sound/music on the next frame. Consumed and reset to false by AudioSystem each update. If both TriggerPause and TriggerResume are set, both are cleared and no action is taken. |
| TriggerStop | Set to true to stop the attached sound/music on the next frame. Consumed and reset to false by AudioSystem each update. If both TriggerPlay and TriggerStop are set, both are cleared and no action is taken. |
| Volume | Base volume (0.0 to 1.0). Values outside the range are clamped. |