A reverb you can plug in: its state, a panel that draws the tail it makes with a handle for the decay time, and an engine that plays it. Play a loop through it and drag
@audio-ui
block-reverb.tsx
"use client";
import { useState } from "react";
import { PlayToggle } from "@/components/audio-ui/play-toggle";
import { ReverbPanel } from "@/components/audio-ui/devices/reverb/panel";
import { useDeviceLoop } from "@/hooks/use-device-loop";
import { useMasterBus } from "@/hooks/use-master-bus";
import {
type ReverbState,
reverbDevice,
} from "@/components/audio-ui/devices/reverb/device";
import { createReverbEngine } from "@/components/audio-ui/devices/reverb/engine";
const MASTER_VOLUME = 0.7;
/**
* A reverb you can plug in: its state, a panel that draws the tail it makes
* and an engine that plays it, each its own file and none knowing the others.
* Play the loop and drag the handle along: the decay time.
*/
export function BlockReverb() {
const [state, setState] = useState<ReverbState>(() =>
reverbDevice.defaults()
);
const master = useMasterBus(MASTER_VOLUME);
const { playing, toggle } = useDeviceLoop({
create: createReverbEngine,
destination: master,
state,
});
return (
<div className="rounded-xl h-full w-full min-w-0">
<ReverbPanel onValueChange={setState} value={state}>
<PlayToggle
label="Play a loop through it"
onToggle={toggle}
playing={playing}
/>
</ReverbPanel>
</div>
);
}




























