Lab

useDemoSource

The sound a device plays: the one chosen in its session, such as from a preview's bar, else the one that shows best what the device does. It tells the session its default, so a bar can offer the choice only where there is one. Outside a session it is always the default.

pnpm dlx shadcn@latest add @audio-ui/use-demo-source
import { useDemoSource } from "@/hooks/use-demo-source";
Fileshooks/use-demo-source.ts
Depends ondemo-sound, use-audio-session
npmNothing
Used byblock-device-chain, use-device-loop
ExportKindWhat it is
useDemoSourcefunctionThe sound a device plays: the one chosen in its session, such as from a preview's bar, else fallback, the one that shows best what the device does.

Usage

The sound a device plays: the one chosen in its session, such as from a preview's bar, else fallback, the one that shows best what the device does. It tells the session its fallback, so a bar offers the choice only where there is one.

import { useDemoSource } from "@/hooks/use-demo-source";

const name = useDemoSource("groove"); // one of DEMO_SOURCES

The sounds are demo-sound's, made in code. Outside a session it is always fallback.

Built by Ouest Labs, the source code is available on GitHub.
RSS