# `Kuroneko.Gadget.UAC2`
[🔗](https://github.com/cocoa-xu/kuroneko_gadget/blob/v0.5.0/lib/kuroneko/gadget/uac2.ex#L1)

The kernel's USB Audio Class 2 function: a sound card with a microphone
the target records from, a speaker it plays to, or both. Linux shows it
on the device as the ALSA card `UAC2Gadget`.

The `:microphone` and `:speaker` of `Kuroneko.Gadget` are the two
directions of an instance named `"audio"`. The target's volume and mute
controls act on the samples.

## Options

  * `:microphone`, `:speaker` - each direction's format, without which the
    direction is left out:
    * `:channels` - 1 (mono) to 8, 2 (stereo) by default
    * `:rates` - the sample rates the target chooses from, up to 10,
      `[48_000]` by default. The target starts with the first.
    * `:sample_bits` - 16, 24 or 32, 16 by default
  * `:max_packet` - the largest packets the device controller takes for
    each direction, in bytes: `%{microphone: 1024, speaker: 1024}` by
    default, the most high speed carries. A format whose packets do not
    fit is refused.
  * `:names` - what the target calls the card and its directions,
    `[function: ..., microphone: ..., speaker: ...]`; the kernel's names
    by default

# `format`

```elixir
@type format() :: %{
  channels: 1..8,
  rates: [pos_integer(), ...],
  sample_bits: 16 | 24 | 32,
  interval: 1..4
}
```

A direction's format.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
