import * as THREE from 'three'; import { ContextManager, Observable } from '@zcomponent/core'; import { Object3D } from './Object3D'; interface PositionalAudioConstructorProps { /** @zprop * @zvalues files *.+(mp3) */ source: string; /** @zprop * @zdefault false */ autoplay: boolean; } /** * * * Manages a positional audio component in a 3D environment, enabling spatial audio effects. This component handles * audio source loading, playback controls, and spatial properties like distance model, reference distance, * rolloff factor, and maximum distance. * * Root element: [THREE.PositionalAudio](https://threejs.org/docs/index.html#api/en/audio/PositionalAudio) * @zcomponent * @zicon volume_up * @zgroup Media * @ztag three/Object3D/PositionalAudio * @zparents three/Object3D/Group/** */ export declare class PositionalAudio extends Object3D { protected constructorProps: PositionalAudioConstructorProps; element: THREE.PositionalAudio; private _listener; private _playState; /** * * Observable property to specify the algorithm used to reduce the volume of the audio as it moves away from the listener. * * @zprop * @zdefault inverse */ distanceModel: Observable; /** * Observable property to define the reference distance for reducing volume as the audio source moves away from the listener. * @zprop * @zdefault 1 */ refDistance: Observable; /** * Observable property to set the rate at which the volume drops off as distance from the audio source increases. * @zprop * @zdefault 1 */ rolloffFactor: Observable; /** * Observable property to set the maximum distance between the audio source and the listener, beyond which the audio will not be heard. * @zprop * @zdefault 10000 */ maxDistance: Observable; /** * Observable property to specify whether the audio should loop when it reaches the end of the audio source. * * @zprop * @zdefault false */ loop: Observable; /** * Initializes a new instance of the PositionalAudio class with specified audio source properties and sets up * the audio listener and playback state based on autoplay configuration. * * @param {ContextManager} ctx - The context manager. * @param {PositionalAudioConstructorProps} constructorProps - Properties for constructing the positional audio, including source URL and autoplay option. */ constructor(ctx: ContextManager, constructorProps: PositionalAudioConstructorProps); private _onLoopUpdate; private _updatePlayState; private _load; private _updateCamera; play(): void; pause(): void; stop(): void; dispose(): never; } /** * Enum defining the available models for calculating the distance attenuation of the audio. */ export declare enum DistanceModel { /** * Linear distance attenuation model. */ 'linear' = "linear", /** * Inverse distance attenuation model. */ 'inverse' = "inverse", /** * Exponential distance attenuation model. */ 'exponential' = "exponential" } export {};