import { WarpMarkerBox } from "@opendaw/studio-boxes";
import { panic, UUID } from "@opendaw/lib-std";
export var AudioContentHelpers;
(function (AudioContentHelpers) {
    AudioContentHelpers.addDefaultWarpMarkers = (boxGraph, playMode, durationInPPQN, durationInSeconds) => {
        if (durationInPPQN <= 0 || durationInSeconds <= 0) {
            return panic(`addDefaultWarpMarkers requires positive duration: `
                + `durationInPPQN=${durationInPPQN}, durationInSeconds=${durationInSeconds}`);
        }
        WarpMarkerBox.create(boxGraph, UUID.generate(), box => {
            box.owner.refer(playMode.warpMarkers);
            box.position.setValue(0);
            box.seconds.setValue(0.0);
        });
        WarpMarkerBox.create(boxGraph, UUID.generate(), box => {
            box.owner.refer(playMode.warpMarkers);
            box.position.setValue(durationInPPQN);
            box.seconds.setValue(durationInSeconds);
        });
    };
    AudioContentHelpers.addWarpMarkers = (boxGraph, playMode, templates) => {
        templates.forEach(({ position, seconds }) => WarpMarkerBox.create(boxGraph, UUID.generate(), box => {
            box.owner.refer(playMode.warpMarkers);
            box.position.setValue(position);
            box.seconds.setValue(seconds);
        }));
    };
})(AudioContentHelpers || (AudioContentHelpers = {}));
