@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
50 lines (47 loc) • 1.43 kB
JavaScript
import { A as AbstractAudioOutNode } from './webAudioBaseSubGraph-Cl2P5hh_.esm.js';
/**
* Abstract class representing a sound in the audio engine.
*/
class AbstractSoundSource extends AbstractAudioOutNode {
constructor(name, engine, nodeType = 2 /* AudioNodeType.HAS_OUTPUTS */) {
super(name, engine, nodeType);
this._outBus = null;
this._onOutBusDisposed = () => {
this._outBus = null;
};
}
/**
* The output bus for the sound.
* @see {@link AudioEngineV2.defaultMainBus}
*/
get outBus() {
return this._outBus;
}
set outBus(outBus) {
if (this._outBus === outBus) {
return;
}
if (this._outBus) {
this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed);
if (!this._disconnect(this._outBus)) {
throw new Error("Disconnect failed");
}
}
this._outBus = outBus;
if (this._outBus) {
this._outBus.onDisposeObservable.add(this._onOutBusDisposed);
if (!this._connect(this._outBus)) {
throw new Error("Connect failed");
}
}
}
/**
* Releases associated resources.
*/
dispose() {
super.dispose();
this._outBus = null;
}
}
export { AbstractSoundSource as A };
//# sourceMappingURL=abstractSoundSource-B4_5qVoY.esm.js.map