A limiter you can plug in: its state, a panel that draws its transfer curve with a handle on the ceiling and an engine that plays it. Play a loop through it, push the gain and pull the ceiling down
@audio-ui
block-limiter.tsx
"use client";
import { useState } from "react";
import { PlayToggle } from "@/components/audio-ui/play-toggle";
import { LimiterPanel } from "@/components/audio-ui/devices/limiter/panel";
import { useDeviceLoop } from "@/hooks/use-device-loop";
import { useMasterBus } from "@/hooks/use-master-bus";
import {
type LimiterState,
limiterDevice,
} from "@/components/audio-ui/devices/limiter/device";
import { createLimiterEngine } from "@/components/audio-ui/devices/limiter/engine";
const MASTER_VOLUME = 0.7;
/**
* A limiter you can plug in: its state, a panel that draws its transfer curve with a handle on the ceiling and an engine that plays it, each its own file. Play the loop, push the gain and pull the ceiling down.
*/
export function BlockLimiter() {
const [state, setState] = useState<LimiterState>(() =>
limiterDevice.defaults()
);
const master = useMasterBus(MASTER_VOLUME);
const { playing, toggle } = useDeviceLoop({
create: createLimiterEngine,
destination: master,
state,
});
return (
<div className="rounded-xl h-full w-full min-w-0">
<LimiterPanel onValueChange={setState} value={state}>
<PlayToggle
label="Play a loop through it"
onToggle={toggle}
playing={playing}
/>
</LimiterPanel>
</div>
);
}



























