vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::AudioSystem Class Reference

Turns AudioSource and AudioListener components into what the mixer hears. More...

#include <audio_system.h>

Inheritance diagram for Vkm::Engine::AudioSystem:
Vkm::Engine::System

Public Member Functions

void init (FrameContext &ctx) override
 Called once after all systems are registered, before the first update.
void update (FrameContext &ctx) override
 Execute this system for the current frame.
void shutdown () override
 Called once on engine shutdown.
AudioDevice & device ()
 The device, for a tool (auditioning, a transport pause), not a game.
void setSilent (bool silent=true)
 Run without opening a device, for a host that plays to nobody; set before init().
VoiceId voiceOf (EntityId entity) const
 The voice entity's AudioSource is being heard through.
void stopEverything ()
 Stop every voice and forget them.
Public Member Functions inherited from Vkm::Engine::System
virtual bool isReplayed () const
 Whether this system may be re-run over a tick that already happened.
virtual void fixedUpdate (FrameContext &ctx)
 Execute this system at the fixed simulation rate.

Detailed Description

Turns AudioSource and AudioListener components into what the mixer hears.

Runs after HierarchySystem in the Transform stage, as it reads world poses. Not gated on simulation time, except playOnStart: a paused world keeps its music and UI clicks (docs/reference/audio.md, "Two pauses wearing one word"). Voices are owned here, not on the component, so copying an entity never copies a live voice.

Member Function Documentation

◆ init()

void Vkm::Engine::AudioSystem::init ( FrameContext & ctx)
overridevirtual

Called once after all systems are registered, before the first update.

Parameters
ctxThe first frame's context; its products are all null.

Reimplemented from Vkm::Engine::System.

◆ update()

void Vkm::Engine::AudioSystem::update ( FrameContext & ctx)
overridevirtual

Execute this system for the current frame.

Parameters
ctxThis frame's services and the products published so far.

Reimplemented from Vkm::Engine::System.

◆ device()

AudioDevice & Vkm::Engine::AudioSystem::device ( )
inline

The device, for a tool (auditioning, a transport pause), not a game.

Returns
The device this system mixes through.

◆ setSilent()

void Vkm::Engine::AudioSystem::setSilent ( bool silent = true)
inline

Run without opening a device, for a host that plays to nobody; set before init().

Parameters
silentTrue to leave the device closed.

◆ voiceOf()

VoiceId Vkm::Engine::AudioSystem::voiceOf ( EntityId entity) const

The voice entity's AudioSource is being heard through.

For asking the device isVoicePaused() or voiceCursor(). Read-only: a voice stopped behind this system's back reads as finished and clears playing.

Parameters
entityEntity whose source to look up; generation-checked.
Returns
The live voice, or 0 when the source is silent, has no voice yet, or does not exist.

◆ stopEverything()

void Vkm::Engine::AudioSystem::stopEverything ( )

Stop every voice and forget them.

For when the world goes before the asset graph is replaced (update() handles that case itself). Pending requests go too, since an old graph's handle can name a different clip in the new one.


The documentation for this class was generated from the following file: