v1.6.0 release: soundfile format expansion (WAV int depths + RF64 >4GB, AIFF/CAF, AAC/ALAC compressed, 4GB guard, unified AudioFileFormat)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 17:45:34 -07:00
parent 62b2f5dbec
commit 8eb64f883f
33 changed files with 2650 additions and 352 deletions
+11 -3
View File
@@ -2052,13 +2052,21 @@ let writer = try DiskOut.Audio(
channelCount: 2,
url: url,
sampleRate: engine.sampleRate,
format: .wavFloat32, // .aiff / .wavFloat32 / .wavInt16 / .wavInt24 / .aiffFloat32
format: .wavFloat32, // .wavFloat32 / .wavInt16 / .wavInt24 / .aiffFloat32 / .cafFloat32 / .rf64Float32 / .rf64Int24
bufferFrames: 8192
)
```
- Format encoded by `DiskOutFormat` enum (file extension + sample format).
- Writes from a background thread; RT pushes to a lock-free SPSC queue.
- Format encoded by the `AudioFileFormat` enum (`DiskOutFormat` is an alias) — file extension + sample format.
- **PCM / RF64 only**: the compressed codecs (`.aacHigh` / `.aacMedium` / `.alac`) throw `DiskOutError.compressedFormatNotSupported` — real-time streaming of a compressed encoder is out of scope. Render AAC/ALAC offline via `LyrebirdBuffer.write` or `NRTDriver`.
- Writes from a background thread; the RT thread publishes into a lock-free ring buffer via atomic frame counters (not an `SPSCQueue`).
- **4 GB cap on WAV/AIFF**: a long streaming recording to a WAV or AIFF-C target stops
growing once the file reaches the 4 GB container limit (`lyrebirdMaxRIFFBytes`) — a
recording already in flight can't retroactively throw, so frames past the cap are
**silently dropped** and the audio already written stays valid. Poll `writer.fileTooLarge`
after `close()` to detect it. For long sessions record to a 64-bit container:
`.cafFloat32`, or `.rf64Float32` / `.rf64Int24` (RF64/BW64 — keeps the `.wav` extension,
streamed via `RF64Writer` with the `ds64` sizes patched on `close()`).
---