import { b as FlowGraphExecutionBlockWithOutSignal } from './KHR_interactivity-VqtS29i9.esm.js';
import { R as RichTypeAny, f as RichTypeNumber, h as RichTypeBoolean } from './declarationMapper-CZ6AxirO.esm.js';
import { f as RegisterClass } from './index-Cl9U4nB-.esm.js';
import './objectModelMapping-ghOGfUOh.esm.js';

/**
 * @experimental
 * A block that plays an Audio V2 sound.
 */
class FlowGraphPlaySoundBlock extends FlowGraphExecutionBlockWithOutSignal {
    /**
     * Constructs a new FlowGraphPlaySoundBlock.
     * @param config - optional configuration for the block
     */
    constructor(config) {
        super(config);
        this.sound = this.registerDataInput("sound", RichTypeAny);
        this.volume = this.registerDataInput("volume", RichTypeNumber, 1);
        this.startOffset = this.registerDataInput("startOffset", RichTypeNumber, 0);
        this.loop = this.registerDataInput("loop", RichTypeBoolean, false);
    }
    /**
     * @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);
        const offset = this.startOffset.getValue(context);
        const loopVal = this.loop.getValue(context);
        soundValue.play({ volume: vol, startOffset: offset, loop: loopVal });
        this.out._activateSignal(context);
    }
    /**
     * @returns class name of the block.
     */
    getClassName() {
        return "FlowGraphPlaySoundBlock" /* FlowGraphBlockNames.AudioPlaySound */;
    }
}
RegisterClass("FlowGraphPlaySoundBlock" /* FlowGraphBlockNames.AudioPlaySound */, FlowGraphPlaySoundBlock);

export { FlowGraphPlaySoundBlock };
//# sourceMappingURL=flowGraphPlaySoundBlock-CVl7zWar.esm.js.map
