Prowl’s audio system is a thin, engine-agnostic wrapper built on top of OpenAL (viaDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl/llms.txt
Use this file to discover all available pages before exploring further.
OpenALEngine), with an automatic fallback to a silent NullAudioEngine when no audio hardware is available. The static AudioSystem class manages three pools: an AudioBuffer cache keyed by AudioClip (so the same clip’s PCM data is only uploaded to the GPU once), a source pool of reusable ActiveAudio objects, and an active-source list from which finished sources are automatically recycled. Sound playback returns an ActiveAudio handle, giving callers control over gain, pitch, position, and loop state after the sound starts. A single AudioListener component represents the listener in world space; its transform drives spatial audio attenuation and panning.
Initialization
Initialize
ActiveAudio sources. Attempts to construct an OpenALEngine first. If OpenAL initialisation throws (no audio device, missing drivers), a NullAudioEngine is used instead and a Debug.LogError is emitted.
The active audio engine instance. Will be either an
OpenALEngine or NullAudioEngine.The currently registered
AudioListener component. There should be exactly one active listener per scene.AudioEngine (abstract)
The backend interface that bothOpenALEngine and NullAudioEngine implement:
You generally do not interact with
AudioEngine directly. Use the AudioSystem.PlaySound overloads and the returned ActiveAudio handle instead.Playing Sounds
PlaySound overloads
AllPlaySound variants return an ActiveAudio handle. The source is taken from the internal pool; if the pool is empty, a new source is created.
From AudioClip (simple)
The audio clip to play.
Gain multiplier.
1.0 = full volume.Pitch multiplier.
1.0 = original pitch.From AudioClip with 3D position
World-space position of the sound source for 3D attenuation.
AbsoluteWorld — position is in world space; distance attenuation and panning applied.ListenerRelative — position is relative to the listener; use for 2D / UI sounds.From AudioBuffer (simple)
Pre-fetched audio buffer (from
GetAudioBuffer).From AudioBuffer (full control)
Pre-fetched audio buffer (from
GetAudioBuffer).Maximum distance in world units at which the sound is audible.
AudioBuffer Cache
GetAudioBuffer
AudioBuffer for clip, uploading the PCM data to the audio engine if it has not been uploaded before. The internal cache (Dictionary<AudioClip, AudioBuffer>) ensures each clip is only uploaded once.
The clip whose buffer to retrieve.
The GPU-side audio buffer ready for playback.
ActiveAudio Handle
ActiveAudio is an abstract class returned by PlaySound. It represents an active or pooled audio source and lets you modify playback after the sound has started.
Properties
Volume multiplier. Get or set at any time during playback.
Pitch multiplier. Changing this mid-playback re-pitches the sound in real time.
Distance in world units at which the source is fully attenuated.
When
true, the source loops automatically when it reaches the end.World-space or listener-relative position of the source.
Directional cone axis for directional audio sources.
AbsoluteWorld or ListenerRelative — controls how Position is interpreted.true when the source is actively playing.Normalised playback position in
[0, 1]. Setting this seeks the source. When PlaybackPosition >= 1 and Looping is false, the source is considered finished and returned to the pool.Methods
Play
buffer from the start. The source must be acquired from the pool before calling this.
Stop
UpdatePool recycles it.
Dispose
AudioSystem are disposed automatically; only call this if you created a source manually.
Listener Registration
RegisterListener / UnregisterListener
AudioListener component lifecycle methods. Only one listener is supported per scene. Registering a second listener emits a Debug.LogWarning.
ListenerTransformChanged
AudioListener whenever its transform changes. Updates the audio engine’s listener position, velocity (t.position - lastPost), and orientation (t.forward, t.up).
Pool Management
UpdatePool
Dispose
AudioBuffer objects, and disposes the AudioEngine (if it is IDisposable). Called automatically on engine shutdown.