![]() |
vkmEngine 1.0.0
A C++ game engine · vkmengine.com
|
Turns AudioSource and AudioListener components into what the mixer hears. More...
#include <audio_system.h>
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. | |
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.
|
overridevirtual |
Called once after all systems are registered, before the first update.
| ctx | The first frame's context; its products are all null. |
Reimplemented from Vkm::Engine::System.
|
overridevirtual |
Execute this system for the current frame.
| ctx | This frame's services and the products published so far. |
Reimplemented from Vkm::Engine::System.
|
inline |
The device, for a tool (auditioning, a transport pause), not a game.
|
inline |
Run without opening a device, for a host that plays to nobody; set before init().
| silent | True to leave the device closed. |
| 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.
| entity | Entity whose source to look up; generation-checked. |
| 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.