/** Local tuple type for audio spatial positions — avoids coupling to @holoscript/core object-style Vec3. */ type Vec3 = [number, number, number]; /** * AudioEngine.ts * * Core spatial audio engine for HoloScript+. * Manages 3D listener position, audio sources with distance attenuation, * and provides a unified API for positional sound in VR. * * Note: This is a *simulation* layer that models spatial audio behavior. * In production, it delegates to Web Audio API (AudioContext/PannerNode). * For testing and headless environments, all state is tracked internally. */ export type DistanceModel = 'linear' | 'inverse' | 'exponential'; export interface AudioSourceConfig { id: string; position: Vec3; volume: number; pitch: number; loop: boolean; maxDistance: number; refDistance: number; rolloffFactor: number; distanceModel: DistanceModel; channel: string; spatialize: boolean; } export interface AudioSource { config: AudioSourceConfig; isPlaying: boolean; currentTime: number; computedVolume: number; computedPan: number; soundId: string; } export interface ListenerState { position: Vec3; forward: Vec3; up: Vec3; } export declare class AudioEngine { private sources; private listener; private masterVolume; private muted; /** * Update the listener position (typically from VR headset). */ setListenerPosition(pos: Vec3): void; setListenerOrientation(forward: Vec3, up: Vec3): void; getListener(): ListenerState; /** * Create and play a new audio source. */ play(soundId: string, config?: Partial): string; /** * Stop a playing source. */ stop(sourceId: string): void; /** * Update a source's position. */ setSourcePosition(sourceId: string, pos: Vec3): void; /** * Update all sources. Call every frame. */ update(delta: number): void; /** * Get a source by ID. */ getSource(sourceId: string): AudioSource | undefined; /** * Get all active sources. */ getActiveSources(): AudioSource[]; /** * Set master volume. */ setMasterVolume(vol: number): void; getMasterVolume(): number; /** * Mute/unmute all audio. */ setMuted(muted: boolean): void; isMuted(): boolean; /** * Get active source count. */ getActiveCount(): number; /** * Stop all sources. */ stopAll(): void; } export {}; //# sourceMappingURL=AudioEngine.d.ts.map