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.

35 lines 1.34 kB
import { RichTypeAny, RichTypeBoolean } from "../../../flowGraphRichTypes.js"; import { RegisterClass } from "../../../../Misc/typeStore.js"; import { FlowGraphCachedOperationBlock } from "../flowGraphCachedOperationBlock.js"; /** * @experimental * A data block that checks whether an Audio V2 sound is currently playing. */ export class FlowGraphIsSoundPlayingBlock extends FlowGraphCachedOperationBlock { /** * Constructs a new FlowGraphIsSoundPlayingBlock. * @param config - optional configuration for the block */ constructor(config) { super(RichTypeBoolean, config); this.sound = this.registerDataInput("sound", RichTypeAny); } /** * @internal */ _doOperation(context) { const soundValue = this.sound.getValue(context); if (!soundValue) { return undefined; } return soundValue.state === 3 /* SoundState.Started */ || soundValue.state === 2 /* SoundState.Starting */; } /** * @returns class name of the block. */ getClassName() { return "FlowGraphIsSoundPlayingBlock" /* FlowGraphBlockNames.AudioIsSoundPlaying */; } } RegisterClass("FlowGraphIsSoundPlayingBlock" /* FlowGraphBlockNames.AudioIsSoundPlaying */, FlowGraphIsSoundPlayingBlock); //# sourceMappingURL=flowGraphIsSoundPlayingBlock.js.map