This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Audio Manager

Master audio controller – engine initialization, mixing bus routing, event library loading, score playback, and Audio Event Graph instance management.

The Audio Manager is the master audio controller for every GS_Play project. It extends GS_ManagerComponent and participates in the standard two-stage initialization managed by the Game Manager. On startup it initializes the MiniAudio engine, creates the named mixing bus graph, and coordinates score track playback.

Like all GS_Play managers, the Audio Manager responds to standby mode automatically — muting or pausing audio output when the game enters a blocking operation such as a stage change.

For usage guides and setup examples, see The Basics: GS_Audio.

Audio Manager component in the O3DE Inspector

 

Contents


How It Works

Engine Lifecycle

When the Audio Manager activates, it initializes a MiniAudio engine instance and builds the mixing bus graph from its configured bus list.

Mixing Bus Routing

All audio output flows through named mixing buses. Each bus is a GS_MixingBus node in the MiniAudio graph with its own volume level and optional effects chain. The Audio Manager owns the top-level routing and exposes volume control per bus through the request bus.

Audio Event Graph Pooling

The Audio Manager maintains a template cache and instance pool for Audio Event Graphs. When a graph is played:

  • First request for a path loads and caches the GraphDocumentAsset
  • A GraphInstance is created from the cached asset
  • On release, idle instances are pooled for reuse (default pool size: 8)
  • Each instance is fully independent — variables, phase, and state do not bleed between instances

Score Playback

The Audio Manager coordinates playback of ScoreArrangementTrack assets — multi-layer musical scores with configurable tempo, time signature, and layer selection.


Inspector Properties

PropertyTypeDescription
Mixing BusesAZStd::vector<BusEffectsPair>Named mixing buses with optional effects chains.
Default Master VolumefloatInitial master volume (0.0 to 1.0).

API Reference

GS_AudioManagerComponent

FieldValue
TypeId{F28721FD-B9FD-4C04-8CD1-6344BD8A3B78}
ExtendsGS_Core::GS_ManagerComponent
HeaderGS_Audio/GS_AudioManagerBus.h

Audio Event Graph

Instanced, visual-graph-based sound events with full lifecycle control, variable injection, and 3D spatialization.

Playback Control

MethodParametersReturnsDescription
PlayAudioGraphconst AZStd::string& assetPathAZ::u32 instanceIdFire-and-forget graph playback. Auto-cleaned up when finished. Returns an instance ID.
AcquireAudioGraphconst AZStd::string& assetPathAZ::u32 instanceIdAcquires a graph instance for manual control. Caller is responsible for release.
FireAudioGraphAZ::u32 instanceIdvoidStarts or restarts playback on an acquired instance.
StopAudioGraphAZ::u32 instanceIdvoidStops playback cleanly and returns the instance to the pool.
StopAllAudioGraphsvoidEmergency stops all playing graph instances.
ReleaseAudioGraphAZ::u32 instanceIdvoidReleases a manually acquired instance back to the pool.
StopAudioGraphFadeAZ::u32 instanceId, float fadeTimevoidFades out and stops over the specified duration (seconds).

Lifecycle

MethodParametersReturnsDescription
SetAudioGraphLoopingAZ::u32 instanceId, bool loopingvoidEnables or disables the Loop phase.
FinishAudioGraphAZ::u32 instanceIdvoidTransitions to the Finish phase after current sounds complete.

Variable Control

Set graph variables at runtime to drive filter parameters, routing, and source selection.

MethodParametersReturnsDescription
SetAudioGraphVariableAZ::u32 instanceId, const AZStd::string& name, float valuevoidSets a float variable on the instance.
SetAudioGraphVariableIntAZ::u32 instanceId, const AZStd::string& name, int valuevoidSets an int variable.
SetAudioGraphVariableBoolAZ::u32 instanceId, const AZStd::string& name, bool valuevoidSets a bool variable.
SetAudioGraphVariableStringAZ::u32 instanceId, const AZStd::string& name, const AZStd::string& valuevoidSets a string variable.

Setting a variable marks dependent nodes dirty and re-evaluates only the affected portion of the graph on the next tick.

3D Spatialization

MethodParametersReturnsDescription
SetAudioGraphEntityAZ::u32 instanceId, const AZ::EntityId& entityIdvoidTracks entity position for 3D audio. Updated each tick.
SetAudioGraphPositionAZ::u32 instanceId, const AZ::Vector3& positionvoidFixed world position for 3D audio.
ClearAudioGraphSpatializationAZ::u32 instanceIdvoidDisables 3D spatialization (plays as 2D).

Usage Pattern

// Fire-and-forget
AudioManagerRequestBus::Broadcast(&AudioManagerRequests::PlayAudioGraph,
    "Assets/Audio/Footstep_Stone.audiograph");

// Manual control with variable injection
AZ::u32 instanceId = 0;
AudioManagerRequestBus::BroadcastResult(instanceId,
    &AudioManagerRequests::AcquireAudioGraph,
    "Assets/Audio/Ambience_Forest.audiograph");

AudioManagerRequestBus::Broadcast(&AudioManagerRequests::SetAudioGraphLooping, instanceId, true);
AudioManagerRequestBus::Broadcast(&AudioManagerRequests::SetAudioGraphEntity, instanceId, entityId);
AudioManagerRequestBus::Broadcast(&AudioManagerRequests::FireAudioGraph, instanceId);

// Later: set a variable to mute underwater
AudioManagerRequestBus::Broadcast(&AudioManagerRequests::SetAudioGraphVariable,
    instanceId, "underwater", 0.8f);

// Stop when done
AudioManagerRequestBus::Broadcast(&AudioManagerRequests::StopAudioGraph, instanceId);
AudioManagerRequestBus::Broadcast(&AudioManagerRequests::ReleaseAudioGraph, instanceId);

Mixing

MethodParametersReturnsDescription
SetMixerVolumeconst AZStd::string& busName, float volumevoidSets the volume of a named mixing bus (0.0 – 1.0).
GetMixerVolumeconst AZStd::string& busNamefloatReturns the current volume of a named mixing bus.
SetMasterVolumefloat volumevoidSets master output volume (0.0 – 1.0).
GetMasterVolumefloatReturns current master output volume.

Score

MethodParametersReturnsDescription
PlayScoreTrackconst AZ::Data::Asset<ScoreArrangementTrack>& trackvoidBegins playback of a score arrangement track.
StopScoreTrackvoidStops the currently playing score track.

Notification Bus: AudioManagerNotificationBus

Events broadcast by the Audio Manager. Multiple handler bus — any number of components can subscribe.

EventParametersDescription
OnScoreTrackStartedFired when a score track begins.
OnScoreTrackStoppedFired when a score track stops.
OnMixerVolumeChangedconst AZStd::string& busName, float volumeFired when a mixing bus volume changes.

See Also


Get GS_Audio

GS_Audio — Explore this gem on the product page and add it to your project.