@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
64 lines (60 loc) • 2.25 kB
JavaScript
import { c as FlowGraphExecutionBlockWithOutSignal } from './KHR_interactivity-CEwUaqxQ.esm.js';
import { R as RichTypeAny, d as RichTypeNumber } from './declarationMapper-CqO08-WM.esm.js';
import { u as RegisterClass } from './index-MZPybX0H.esm.js';
import './objectModelMapping-De5EKNEZ.esm.js';
import './spotLight.pure-CRdZC6Ci.esm.js';
/** This file must only contain pure code and pure imports */
/**
* @experimental
* A block that sets the volume of an Audio V2 sound.
*/
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 */;
}
}
let _Registered = false;
/**
* Register side effects for flowGraphSetSoundVolumeBlock.
* Safe to call multiple times; only the first call has an effect.
*/
function RegisterFlowGraphSetSoundVolumeBlock() {
if (_Registered) {
return;
}
_Registered = true;
RegisterClass("FlowGraphSetSoundVolumeBlock" /* FlowGraphBlockNames.AudioSetVolume */, FlowGraphSetSoundVolumeBlock);
}
/**
* Re-exports pure implementation and applies runtime side effects.
* Import flowGraphSetSoundVolumeBlock.pure for tree-shakeable, side-effect-free usage.
*/
RegisterFlowGraphSetSoundVolumeBlock();
export { FlowGraphSetSoundVolumeBlock, RegisterFlowGraphSetSoundVolumeBlock };
//# sourceMappingURL=flowGraphSetSoundVolumeBlock-D025vNej.esm.js.map