Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / AudioSystem

Class: AudioSystem

Defined in: systems/AudioSystem.ts:46

Reconciles AudioComponent state with the underlying THREE.js audio objects each frame.

Playback — drives play(), pause(), and stop() on the THREE.js audio node based on the isPlaying / isPaused flags set by AudioComponent.play(), .pause(), and .stop().

Option sync — detects changes to loop, pitch, volume, refDistance, distanceModel, and rolloffFactor and applies them live. Changes take effect on the next frame, so scripts and inspector edits during runtime are reflected without reloading the scene.

Only active in preview mode (isEditor: true makes every update a no-op so the editor is unaffected).

Implements

Constructors

Constructor

ts
new AudioSystem(__namedParameters?): AudioSystem;

Defined in: systems/AudioSystem.ts:53

Parameters

ParameterType
__namedParameters{ isEditor?: boolean; }
__namedParameters.isEditor?boolean

Returns

AudioSystem

Methods

update()

ts
update(world, _deltaTime): void;

Defined in: systems/AudioSystem.ts:57

Parameters

ParameterType
worldWorld
_deltaTimenumber

Returns

void

Implementation of

EcsSystem.update


dispose()

ts
dispose(_world): void;

Defined in: systems/AudioSystem.ts:157

Parameters

ParameterType
_worldWorld

Returns

void

Implementation of

EcsSystem.dispose