24 lines
1.2 KiB
Markdown
24 lines
1.2 KiB
Markdown
# iOS broadcast-audio ring format
|
|||
|
|
|
||
|
|
The ReplayKit extension and host app exchange audio through `broadcast_audio.ring` in the
|
||
|
|
`group.me.iamtalon.voicecat` App Group. Version 1 is a 64-byte little-endian header followed by
|
||
|
|
96,000 signed 16-bit PCM samples (one second of stereo at 48 kHz).
|
||
|
|
|
||
|
|
| Offset | Type | Meaning |
|
||
|
|
|---:|---|---|
|
||
|
|
| 0 | `uint32` | Magic `0x56434252` (`VCBR`) |
|
||
|
|
| 4 | `uint32` | Version, currently `1` |
|
||
|
|
| 8 | `uint32` | Channel count; active writers use `2` |
|
||
|
|
| 12 | `uint32` | Sample rate; active writers use `48000` |
|
||
|
|
| 16 | `uint32` | Active flag (`0` or `1`) |
|
||
|
|
| 20 | 4 bytes | Reserved, zero |
|
||
|
|
| 24 | `uint64` | Monotonic producer/write sample index |
|
||
|
|
| 32 | `uint64` | Monotonic consumer/read sample index |
|
||
|
|
| 40 | 24 bytes | Reserved, zero |
|
||
|
|
|
||
|
|
The payload starts at byte 64 and contains interleaved little-endian `int16` PCM. The aligned
|
||
|
|
indices are single-producer/single-consumer counters; producer and consumer publish their owned
|
||
|
|
index with a release barrier and read the other index with an acquire barrier. A writer drops a
|
||
|
|
whole input chunk when it cannot fit. Changing this layout requires a new version and compatible
|
||
|
|
readers; offsets in version 1 must never be repurposed.
|