# device-library

> Every device of the registry with its engine, by shelf: what a host needs to build a track's chain from the ids a project stores, and what a device browser lists

```bash
npx shadcn@latest add @audio-ui/device-library
```

```ts
import { DEVICE_LIBRARY, libraryDevice, DEVICE_SHELVES } from "@/lib/device-library";
```

- Files: `lib/device-library.ts`
- Depends on: `auto-pan-device`, `auto-pan-engine`, `channel-eq-device`, `channel-eq-engine`, `chorus-device`, `chorus-engine`, `compressor-device`, `compressor-engine`, `deesser-device`, `deesser-engine`, `delay-device`, `delay-engine`, `distortion-device`, `distortion-engine`, `equalizer-device`, `equalizer-engine`, `filter-device`, `filter-engine`, `gate-device`, `gate-engine`, `limiter-device`, `limiter-engine`, `mid-side-device`, `mid-side-engine`, `multiband-device`, `multiband-engine`, `overdrive-device`, `overdrive-engine`, `phaser-device`, `phaser-engine`, `vibe-device`, `vibe-engine`, `pocket-synth-device`, `pocket-synth-engine`, `poly-synth-device`, `poly-synth-engine`, `fm-synth-device`, `fm-synth-engine`, `mono-synth-device`, `mono-synth-engine`, `organ-device`, `organ-engine`, `string-machine-device`, `string-machine-engine`, `tape-keys-device`, `tape-keys-engine`, `guitar-device`, `guitar-engine`, `drum-synth-device`, `drum-synth-engine`, `sampler-device`, `sampler-engine`, `electric-piano-device`, `electric-piano-engine`, `redux-device`, `redux-engine`, `lofi-device`, `lofi-engine`, `unlimiter-device`, `unlimiter-engine`, `compander-device`, `compander-engine`, `ducker-device`, `ducker-engine`, `expander-device`, `expander-engine`, `binaural-panner-device`, `binaural-panner-engine`, `stutter-device`, `stutter-engine`, `rotary-device`, `rotary-engine`, `bass-enhancer-device`, `bass-enhancer-engine`, `exciter-device`, `exciter-engine`, `frequency-shifter-device`, `frequency-shifter-engine`, `wah-device`, `wah-engine`, `graphic-eq-device`, `graphic-eq-engine`, `tilt-eq-device`, `tilt-eq-engine`, `reverb-device`, `reverb-engine`, `saturator-device`, `saturator-engine`, `transient-device`, `transient-engine`, `utility-device`, `utility-engine`, `wave-shaper-device`, `wave-shaper-engine`; npm: `@audio-ui/engine`
- Used by: `arrangement-engine`, `block-audio-editor`, `block-device-browser`, `block-device-chain`, `block-mixer`, `device-view`, `instrument-rack`, `rack`, `voice-pool`

| Export | Kind | What it is |
| --- | --- | --- |
| `AnyDeviceState` | type | A device's state as a host keeps it: a value for each parameter id. |
| `LibraryEngine` | type | Any engine of the library, an effect's or an instrument's, as a host holds them side by side on a track: what both contracts share, an effect's input and key where it has them, an instrument's notes where it has them, its note as the parameters its `note` descriptors name. |
| `LibraryDevice` | interface | A device of the library: its description, how to make its engine, and the shelf it sits on. |
| `DEVICE_LIBRARY` | const | Every device of the registry, with its engine, by shelf: what a host needs to build a track's chain from the ids a project stores, and what a browser shows. |
| `libraryDevice` | function | The library's device with the stable id `id`, such as `audioui.compressor`. |
| `DEVICE_SHELVES` | const | The library by shelf, in order: what a device browser lists. |

## Usage

`device-library` is every device of the registry with its engine, by shelf: `libraryDevice("audioui.compressor")` gives the description and `create(context, state)` its engine, which is how a host turns the ids a project stores into sound, and `DEVICE_SHELVES` is what a device browser lists.
