@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
57 lines (56 loc) • 2.38 kB
TypeScript
import { type Nullable } from "../../types.js";
import { AudioNodeType } from "./abstractAudioNode.js";
import { type IAbstractAudioOutNodeOptions, AbstractAudioOutNode } from "./abstractAudioOutNode.js";
import { type PrimaryAudioBus } from "./audioBus.js";
import { type AudioEngineV2 } from "./audioEngineV2.js";
import { type AbstractSpatialAudio, type ISpatialAudioOptions } from "./subProperties/abstractSpatialAudio.js";
import { type AbstractStereoAudio, type IStereoAudioOptions } from "./subProperties/abstractStereoAudio.js";
/**
* Options for creating a sound source.
*/
export interface ISoundSourceOptions extends IAbstractAudioOutNodeOptions, ISpatialAudioOptions, IStereoAudioOptions {
/**
* The output bus for the sound source. Defaults to `null`.
* - If not set or `null`, and `outBusAutoDefault` is `true`, then the sound source is automatically connected to the audio engine's default main bus.
* @see {@link AudioEngineV2.defaultMainBus}
*/
outBus: Nullable<PrimaryAudioBus>;
/**
* Whether the sound's `outBus` should default to the audio engine's main bus. Defaults to `true` for all sound sources except microphones.
*/
outBusAutoDefault: boolean;
}
/**
* Abstract class representing a sound in the audio engine.
*/
export declare abstract class AbstractSoundSource extends AbstractAudioOutNode {
private readonly _spatialAutoUpdate;
private readonly _spatialMinUpdateTime;
private _outBus;
private _spatial;
protected constructor(name: string, engine: AudioEngineV2, options: Partial<ISoundSourceOptions>, nodeType?: AudioNodeType);
/**
* The output bus for the sound.
* @see {@link AudioEngineV2.defaultMainBus}
*/
get outBus(): Nullable<PrimaryAudioBus>;
set outBus(outBus: Nullable<PrimaryAudioBus>);
/**
* The spatial audio features.
*/
get spatial(): AbstractSpatialAudio;
/**
* The stereo features of the sound.
*/
abstract stereo: AbstractStereoAudio;
/**
* Releases associated resources.
*/
dispose(): void;
protected abstract _createSpatialProperty(autoUpdate: boolean, minUpdateTime: number): AbstractSpatialAudio;
protected _initSpatialProperty(): AbstractSpatialAudio;
private _onOutBusDisposed;
/** @internal */
get _isSpatial(): boolean;
set _isSpatial(value: boolean);
}