@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.
61 lines (60 loc) • 2.38 kB
TypeScript
import type { Nullable } from "../../types.js";
import { AbstractNamedAudioNode, AudioNodeType } from "./abstractAudioNode.js";
import type { PrimaryAudioBus } from "./audioBus.js";
import type { AudioEngineV2 } from "./audioEngineV2.js";
import type { _AbstractAudioSubGraph } from "./subNodes/abstractAudioSubGraph.js";
import type { AbstractAudioAnalyzer, IAudioAnalyzerOptions } from "./subProperties/abstractAudioAnalyzer.js";
import type { AbstractSpatialAudio, ISpatialAudioOptions } from "./subProperties/abstractSpatialAudio.js";
import type { AbstractStereoAudio, IStereoAudioOptions } from "./subProperties/abstractStereoAudio.js";
/**
* Options for creating a sound source.
*/
export interface ISoundSourceOptions extends IAudioAnalyzerOptions, 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 AbstractNamedAudioNode {
private _analyzer;
private _outBus;
protected abstract _subGraph: _AbstractAudioSubGraph;
protected constructor(name: string, engine: AudioEngineV2, nodeType?: AudioNodeType);
/**
* The analyzer features of the sound.
*/
get analyzer(): AbstractAudioAnalyzer;
/**
* The output bus for the sound.
* @see {@link AudioEngineV2.defaultMainBus}
*/
get outBus(): Nullable<PrimaryAudioBus>;
set outBus(outBus: Nullable<PrimaryAudioBus>);
/**
* The spatial features of the sound.
*/
abstract spatial: AbstractSpatialAudio;
/**
* The stereo features of the sound.
*/
abstract stereo: AbstractStereoAudio;
/**
* The output volume of the sound.
*/
get volume(): number;
set volume(value: number);
/**
* Releases associated resources.
*/
dispose(): void;
private _onOutBusDisposed;
}