A redux you can plug in: its state, a panel that draws the stairs the bits make and an engine that plays it. Play a loop through it and take the bits down
@audio-ui
block-redux.tsx
"use client";
import { useState } from "react";
import { PlayToggle } from "@/components/audio-ui/play-toggle";
import { ReduxPanel } from "@/components/audio-ui/devices/redux/panel";
import { useDeviceLoop } from "@/hooks/use-device-loop";
import { useMasterBus } from "@/hooks/use-master-bus";
import {
type ReduxState,
reduxDevice,
} from "@/components/audio-ui/devices/redux/device";
import { createReduxEngine } from "@/components/audio-ui/devices/redux/engine";
const MASTER_VOLUME = 0.7;
/**
* A redux you can plug in: its state, a panel that draws the stairs the bits
* make and an engine that plays it, each its own file and none knowing the
* others. Play the loop and take the bits down: the stairs grow as the sound
* roughens.
*/
export function BlockRedux() {
const [state, setState] = useState<ReduxState>(() => reduxDevice.defaults());
const master = useMasterBus(MASTER_VOLUME);
const { playing, toggle } = useDeviceLoop({
create: createReduxEngine,
destination: master,
state,
});
return (
<div className="rounded-xl h-full w-full min-w-0">
<ReduxPanel onValueChange={setState} value={state}>
<PlayToggle
label="Play a loop through it"
onToggle={toggle}
playing={playing}
/>
</ReduxPanel>
</div>
);
}
































