import { store, useApp } from '../state/store.ts'; import { getInstrument, listInstruments } from '../instruments/registry.ts'; import type { KnobSpec } from '../instruments/types.ts'; import { trackColor } from './colors.ts'; function fmtKnob(v: number): string { const a = Math.abs(v); if (a >= 1e5 || (a > 0 && a < 0.01)) return v.toExponential(1); return String(Number(v.toPrecision(3))); } function KnobSlider({ knob, value, onChange }: { knob: KnobSpec; value: number | undefined; onChange: (v: number) => void }) { const cur = value ?? knob.default; const log = knob.scale === 'log'; const pos = log ? (1000 * Math.log(cur / knob.min)) / Math.log(knob.max / knob.min) : cur; return ( ); } export function TrackList() { const app = useApp(); const song = app.rec?.song ?? null; if (!song) return
; const instruments = listInstruments(); return (