@playcanvas/web-components
Version:
Web Components for the PlayCanvas Engine
109 lines (108 loc) • 3.52 kB
TypeScript
import { SoundComponent } from 'playcanvas';
import { ComponentElement } from './component';
/**
* The SoundComponentElement interface provides properties and methods for manipulating
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-sounds/ | `<pc-sounds>`} elements.
* The SoundComponentElement interface also inherits the properties and methods of the
* {@link HTMLElement} interface.
*
* @category Components
*/
declare class SoundComponentElement extends ComponentElement {
private _distanceModel;
private _maxDistance;
private _pitch;
private _positional;
private _refDistance;
private _rollOffFactor;
private _volume;
/** @ignore */
constructor();
getInitialComponentData(): {
distanceModel: "linear" | "exponential" | "inverse";
maxDistance: number;
pitch: number;
positional: boolean;
refDistance: number;
rollOffFactor: number;
volume: number;
};
/**
* Gets the underlying PlayCanvas sound component.
* @returns The sound component.
*/
get component(): SoundComponent | null;
/**
* Sets which algorithm to use to reduce the volume of the sound as it moves away from the listener.
* @param value - The distance model.
*/
set distanceModel(value: 'exponential' | 'inverse' | 'linear');
/**
* Gets which algorithm to use to reduce the volume of the sound as it moves away from the listener.
* @returns The distance model.
*/
get distanceModel(): 'exponential' | 'inverse' | 'linear';
/**
* Sets the maximum distance from the listener at which audio falloff stops.
* @param value - The max distance.
*/
set maxDistance(value: number);
/**
* Gets the maximum distance from the listener at which audio falloff stops.
* @returns The max distance.
*/
get maxDistance(): number;
/**
* Sets the pitch of the sound.
* @param value - The pitch.
*/
set pitch(value: number);
/**
* Gets the pitch of the sound.
* @returns The pitch.
*/
get pitch(): number;
/**
* Sets the positional flag of the sound.
* @param value - The positional flag.
*/
set positional(value: boolean);
/**
* Gets the positional flag of the sound.
* @returns The positional flag.
*/
get positional(): boolean;
/**
* Sets the reference distance for reducing volume as the sound source moves further from the listener. Defaults to 1.
* @param value - The ref distance.
*/
set refDistance(value: number);
/**
* Gets the reference distance for reducing volume as the sound source moves further from the listener.
* @returns The ref distance.
*/
get refDistance(): number;
/**
* Sets the factor used in the falloff equation. Defaults to 1.
* @param value - The roll-off factor.
*/
set rollOffFactor(value: number);
/**
* Gets the factor used in the falloff equation.
* @returns The roll-off factor.
*/
get rollOffFactor(): number;
/**
* Sets the volume of the sound.
* @param value - The volume.
*/
set volume(value: number);
/**
* Gets the volume of the sound.
* @returns The volume.
*/
get volume(): number;
static get observedAttributes(): string[];
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
}
export { SoundComponentElement };