NarraLeaf

AudioBusState

type AudioBusState = {
    id: string;
    parentId: string | null;
    /**
     * The player's control, 0..1, default 1. This is the one to persist.
     */
    volume: number;
    /**
     * The author's mix position, from AudioBusDeclaration.volume.
     */
    declaredVolume: number;
    /**
     * `declaredVolume * volume` - what is actually on the gain node.
     */
    effectiveVolume: number;
};

A bus and both of its numbers, as returned by game.audioBuses.list().

The two values are separate: declared × player = what is on the node, and neither overwrites the other.

volume

The player's control, and the half to persist. Restoring it lets an author re-mix a shipped game without a returning player's saved settings pinning the old mix. game.audioBuses.getVolumes() returns these values keyed by id.

declaredVolume

The author's mix position, from AudioBusDeclaration. It comes from the game, not from storage; persisting it would be persisting the game's own content.

effectiveVolume

The product of the two, which is what is on the gain node.

Added in 0.23.0.

On this page