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.

40 lines 1.52 kB
import { FlowGraphExecutionBlockWithOutSignal } from "../../../flowGraphExecutionBlockWithOutSignal.js"; import { RichTypeAny, RichTypeNumber } from "../../../flowGraphRichTypes.js"; import { RegisterClass } from "../../../../Misc/typeStore.js"; /** * @experimental * A block that sets the volume of an Audio V2 sound. */ export class FlowGraphSetSoundVolumeBlock extends FlowGraphExecutionBlockWithOutSignal { /** * Constructs a new FlowGraphSetSoundVolumeBlock. * @param config - optional configuration for the block */ constructor(config) { super(config); this.sound = this.registerDataInput("sound", RichTypeAny); this.volume = this.registerDataInput("volume", RichTypeNumber, 1); } /** * @internal */ _execute(context, _callingSignal) { const soundValue = this.sound.getValue(context); if (!soundValue) { this._reportError(context, "No sound provided"); this.out._activateSignal(context); return; } const vol = this.volume.getValue(context); soundValue.volume = vol; this.out._activateSignal(context); } /** * @returns class name of the block. */ getClassName() { return "FlowGraphSetSoundVolumeBlock" /* FlowGraphBlockNames.AudioSetVolume */; } } RegisterClass("FlowGraphSetSoundVolumeBlock" /* FlowGraphBlockNames.AudioSetVolume */, FlowGraphSetSoundVolumeBlock); //# sourceMappingURL=flowGraphSetSoundVolumeBlock.js.map