Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    Class AudioEngine

    The sound layer's engine: one per LuxarApp, nodes attached per scene. See the module docs for the graph it builds and the ports it takes.

    Index
    listener: AudioListener | null = null
    busNodes: Record<"ambient" | "voice" | "effects", GainNode> | null = null
    duck: GainNode | null = null
    nodes: Map<string, SoundNode> = ...
    gestureRetryArmed: boolean = false

    True while a one-shot gesture listener is waiting to retry the resume.

    disarmGestureRetry: (() => void) | null = null
    unsubscribeDims: Unsubscribe | null = null
    unsubscribeCamera: Unsubscribe | null = null
    masterGain: number = DEFAULT_MASTER_GAIN
    muted: boolean = false
    sceneEnabled: boolean = true
    panningModel: PanningModel = 'equalpower'
    busGains: Record<AudioBusName, number> = ...
    duckDb: number = DEFAULT_DUCK_DB
    activeVoiceClips: number = 0
    disposed: boolean = false
    foaDecoders: Set<FoaDecoder> = ...

    Ambisonic decoders to rotate against the camera (see ensureGraph).

    listenerQuaternion: Quaternion = ...
    captureDestinations: Map<MediaStream, MediaStreamAudioDestinationNode> = ...
    • Find every sound node under root (their placeholders carry userData.sound), build the graph if needed, evaluate the slab once, and start decoding clips. Idempotent per scene: call detachScene first when a new dataset loads.

      Parameters

      • root: Object3D

      Returns void

    • Stop and drop every node; keep the context and buses for the next scene.

      Returns void

    • Where an attach_to source sits: the target's live bounding-box centre when its geometry is loaded, else the centre of the position_bounds its scene-graph node carries (a story-bound cluster has no geometry until the slice reaches its story, but its authored bounds are on disk from the start). The fallback reads the displayed dimensions and assumes an identity target transform; the live box takes over once the node loads.

      Parameters

      • name: string

      Returns Vector3 | null

    • Re-place every attach_to source (its target may have loaded since).

      Returns void

    • Point every ambisonic field at the camera the listener sits on.

      Parameters

      • listener: AudioListener

      Returns void

    • Retry the resume on the next pointer or key event anywhere on the page.

      The overlay arms its own dismissal, but it is not the only way a listener interacts first — they may click the canvas, press a navigation key, or tap the rail. Without this the context stays suspended for the whole session and the only route to sound is a mute toggle, because that is the one other call site that re-enters checkGate.

      Returns void

    • Parameters

      • name: string
      • bus: "ambient" | "voice" | "effects"

      Returns void

    • Parameters

      • name: string
      • bus: "ambient" | "voice" | "effects"

      Returns void

    • Parameters

      • buses: Partial<Record<"ambient" | "voice" | "effects", number>> | undefined

      Returns void

    • Mute everything (with each node's fade-out) or unmute. Unmuting also re-enables a scene that authored enabled: false for this session, since the listener asked for sound explicitly. A muted scene never shows the gate.

      Parameters

      • muted: boolean

      Returns void

    • Parameters

      • bus: "ambient" | "voice" | "effects"
      • value: number

      Returns void

    • A MediaStream carrying the mix the listener hears (post master gain, so a muted viewer records silence), for the Recording panel to add to its canvas capture (SOUND_SPEC.md §6, Phase 3). Null before the graph exists — a scene without sound nodes records a silent video as before. Release with releaseCaptureStream when the recording ends.

      Returns MediaStream | null

    • Detach a capture stream from the master gain and stop its tracks.

      Parameters

      • stream: MediaStream

      Returns void

    • Mute one node (path names it) or every node under a group (path is an ancestor). The node's own eye and an ancestor's eye are tracked separately, as a hidden group hides its children whatever their own flag says.

      Parameters

      • path: string
      • muted: boolean

      Returns void

    • Live per-node linear gain ([0, 2]); ramps a playing node.

      Parameters

      • path: string
      • gain: number

      Returns void

    • The live per-node gain, or undefined for an unknown path.

      Parameters

      • path: string

      Returns number | undefined

    • Start name (basename or full path) regardless of the slab.

      Parameters

      • name: string

      Returns boolean

    • Sound is wanted but the browser has not let the context start.

      Distinct from isMuted: nothing is audible in either case, but this one is not the listener's choice and is cleared by a gesture rather than by unmuting. The rail renders it as its own state so the control does not read "on" over silence.

      Returns boolean

    • Resume the context from a user gesture and open the gate. Safe to call when already running. Returns whether sound is live afterwards.

      Returns Promise<boolean>