# SiriPlus Remote Mic Driver

This is SiriPlus' clean-room virtual microphone component. It is an Audio Server Driver Plug-In that exposes one input device named `SiriPlus Remote Mic`.

The driver reads 16 kHz mono PCM from `/tmp/siriplus_remote_mic_pcm` and exposes it as a 16 kHz stereo float input by duplicating the mono samples. When that file is missing or invalid, the driver returns silence instead of failing. That lets macOS keep the input device alive while the SiriPlus capture helper is stopped, updating, or waiting for the remote. The reader starts with a short jitter buffer, then recovers quickly after mid-stream underruns so brief Bluetooth gaps do not suppress the next audible speech chunk.

## Build

```sh
sh Drivers/SiriPlusRemoteMicDriver/build.sh
```

The script normally writes the bundle to `Drivers/SiriPlusRemoteMicDriver/build/SiriPlusRemoteMic.driver`.
If that default bundle is not writable, for example after a privileged local install left a root-owned build artifact behind, the script falls back to a fresh temp directory and prints the actual driver path.

## Install For Local Testing

```sh
sudo sh Drivers/SiriPlusRemoteMicDriver/install.sh
```

The release app should install and verify this bundle through the normal SiriPlus setup flow. The script exists only for debug builds and local validation.
The installer restarts CoreAudio with `launchctl` and falls back to `killall`; if CoreAudio does not restart, the install exits non-zero instead of reporting a false success.
`install.sh` also accepts a prebuilt `SiriPlusRemoteMic.driver` path; the app uses that form so administrator approval is needed only for copying into `/Library` and restarting CoreAudio.

## Shared Memory ABI

The PCM file starts with:

- magic: `SPRM`
- version: `1`
- sample rate: `16000`
- channels: `1`
- bytes per frame: `2`
- capacity frames: ring buffer frame count
- write frame: monotonically increasing frame cursor

The header is followed by signed 16-bit little-endian mono PCM samples.
