# iOS Audio Routing Input Preferences

Set the routing JSON before starting wakeword detection:

```ts
await setWakewordAudioRoutingConfig(audioRoutingConfig);
```

Every `RouteConfigEntry` has an ordered input preference chain:

1. `preferredInput`
2. `forceFallback`
3. `forceFallback1`
4. `forceFallback2`

The older `preferredInputFallback`, `preferredInputFallback1`, and
`preferredInputFallback2` names remain accepted as aliases. The exact lowercase
`forcefallback` spelling is also accepted, but TypeScript code should use
`forceFallback`.

Each field accepts:

- `bluetoothHighQualityMic`: an iOS 26 Bluetooth input that reports support for
  Apple's high-quality recording capability.
- `builtInMic`: the iPhone/iPad microphone.
- `none`: clear the app's preferred input and let iOS choose.

The library activates the configured audio-session category before inspecting
inputs. When `bluetoothHighQualityRecording` is present, the native library
also enables A2DP for the primary HD attempt if the app omitted it. If the HD
request fails, fallback entries are forced audio-session policies rather than
input-only requests:

- `builtInMic` removes HD/HFP, enables A2DP, and verifies the device microphone.
- `none` removes HD/A2DP, enables ordinary HFP, and clears the preferred input.

Unsupported, unavailable, invalid, or failed candidates continue to the next
fallback. Duplicate values are ignored. Existing entries without any
preferred-input field behave as `preferredInput: "none"` without manufacturing
an HD-failure fallback.

## Preserve High-Quality Music on Fallback

```ts
const entry: RouteConfigEntry = {
  category: 'playAndRecord',
  mode: 'default',
  options: [
    'mixWithOthers',
    'allowBluetoothA2DP',
    'bluetoothHighQualityRecording',
  ],
  preferredInput: 'bluetoothHighQualityMic',
  forceFallback: 'builtInMic',
};
```

If the connected headset does not support Apple's high-quality microphone, the
device microphone is used and A2DP music quality can remain available.

## Accept HFP/Call-Quality Fallback

```ts
const entry: RouteConfigEntry = {
  category: 'playAndRecord',
  mode: 'default',
  options: [
    'mixWithOthers',
    'bluetoothHighQualityRecording',
  ],
  preferredInput: 'bluetoothHighQualityMic',
  forceFallback: 'none',
};
```

In this fallback position, `none` forces the ordinary HFP-capable category
policy and then clears the preferred input. HFP may reduce Bluetooth output
quality.

`bluetoothHighQualityRecording` requires iOS 26 and `mode: "default"`. Apply the
same intended policy to `default` and relevant Bluetooth port entries so a
route change does not select a different policy.
