@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.24 kB
JavaScript
import { RichTypeAny, RichTypeNumber } from "../../../flowGraphRichTypes.js";
import { RegisterClass } from "../../../../Misc/typeStore.js";
import { FlowGraphCachedOperationBlock } from "../flowGraphCachedOperationBlock.js";
/**
* @experimental
* A data block that reads the current volume of an Audio V2 sound.
*/
export class FlowGraphGetSoundVolumeBlock extends FlowGraphCachedOperationBlock {
/**
* Constructs a new FlowGraphGetSoundVolumeBlock.
* @param config - optional configuration for the block
*/
constructor(config) {
super(RichTypeNumber, config);
this.sound = this.registerDataInput("sound", RichTypeAny);
}
/**
* @internal
*/
_doOperation(context) {
const soundValue = this.sound.getValue(context);
if (!soundValue) {
return undefined;
}
return soundValue.volume;
}
/**
* @returns class name of the block.
*/
getClassName() {
return "FlowGraphGetSoundVolumeBlock" /* FlowGraphBlockNames.AudioGetVolume */;
}
}
RegisterClass("FlowGraphGetSoundVolumeBlock" /* FlowGraphBlockNames.AudioGetVolume */, FlowGraphGetSoundVolumeBlock);
//# sourceMappingURL=flowGraphGetSoundVolumeBlock.js.map