@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.
42 lines • 1.3 kB
JavaScript
import { _MainAudioOut } from "../abstractAudio/mainAudioOut.js";
import { _WebAudioParameterComponent } from "./components/webAudioParameterComponent.js";
/** @internal */
export class _WebAudioMainOut extends _MainAudioOut {
/** @internal */
constructor(engine) {
super(engine);
const audioContext = engine._audioContext;
this._gainNode = new GainNode(audioContext);
this._destinationNode = audioContext.destination;
this._gainNode.connect(this._destinationNode);
this._volume = new _WebAudioParameterComponent(this.engine, this._gainNode.gain);
}
/** @internal */
dispose() {
super.dispose();
this._volume.dispose();
this._gainNode.disconnect();
this._destinationNode.disconnect();
}
/** @internal */
get _inNode() {
return this._gainNode;
}
/** @internal */
get volume() {
return this._volume.targetValue;
}
/** @internal */
set volume(value) {
this._volume.targetValue = value;
}
/** @internal */
getClassName() {
return "_WebAudioMainOut";
}
/** @internal */
setVolume(value, options = null) {
this._volume.setTargetValue(value, options);
}
}
//# sourceMappingURL=webAudioMainOut.js.map