UNPKG

@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 1.56 kB
import { _VolumeAudioSubNode } from "../../abstractAudio/subNodes/volumeAudioSubNode.js"; /** @internal */ export async function _CreateVolumeAudioSubNodeAsync(engine) { return new _VolumeWebAudioSubNode(engine); } /** @internal */ export class _VolumeWebAudioSubNode extends _VolumeAudioSubNode { /** @internal */ constructor(engine) { super(engine); this._volume = 1; this.node = new GainNode(engine._audioContext); } /** @internal */ get volume() { return this._volume; } /** @internal */ set volume(value) { this._volume = value; this.engine._setAudioParam(this.node.gain, value); } /** @internal */ get _inNode() { return this.node; } /** @internal */ get _outNode() { return this.node; } _connect(node) { const connected = super._connect(node); if (!connected) { return false; } // If the wrapped node is not available now, it will be connected later by the subgraph. if (node._inNode) { this.node.connect(node._inNode); } return true; } _disconnect(node) { const disconnected = super._disconnect(node); if (!disconnected) { return false; } if (node._inNode) { this.node.disconnect(node._inNode); } return true; } /** @internal */ getClassName() { return "_VolumeWebAudioSubNode"; } } //# sourceMappingURL=volumeWebAudioSubNode.js.map