Commit Graph

25 Commits

Author SHA1 Message Date
Nick Payne 65c2d58c82 remove unused append(_ data: Data) overload from AudioBuffer
Only one append path exists now: append(from:count:), which is what the
IO proc callback uses. The Data-based overload had no callers in source
and added a dead code path to maintain.

Also resolves CoreAudio.AudioBuffer name collision in tests via typealias.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 21:38:14 +00:00
Nick Payne 85975d6cc3 optimise hot-path audio pipeline: zero-copy ring buffer, pre-allocated converter buffers
- Replace Swift Array<UInt8> ring buffer with UnsafeMutableRawPointer to
  eliminate COW ref-count checks on every write/read
- Add append(from:count:) to copy directly from Core Audio buffer pointer
  into the ring buffer, removing the per-callback Data heap allocation
- Pre-allocate AVAudioPCMBuffer pair in AudioFormatConverter and reuse
  across transform() calls (lazy init, capacity-checked)
- Fix float-to-int truncation in output frame count calculation (ceil)
- Add comprehensive AudioBuffer test suite (12 tests) including proper
  wrap-around coverage for both append and read paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 21:32:42 +00:00
Nick Payne 08f0bc8f6c library improvements 2026-02-25 20:26:39 +00:00
Nick Payne c4cf27553a Merge branch 'main' into lib-split-cli 2026-02-25 16:14:04 +00:00
phritz 0b1ba5c8cd Add --flush option to reduce stdout buffering latency 2026-01-24 10:36:58 -06:00
Nick Payne b7455d26d1 potential split between CLI and core library 2025-08-19 08:51:14 +01:00
Nick Payne a311cc583f simplify recorder 2025-08-12 13:37:39 +01:00
na-2n c9d11316ff add stereo recording option 2025-08-10 19:17:08 +02:00
Nick Payne 71b0c45a5c minor tidyup 2025-07-29 10:14:49 +01:00
Nick Payne d260c7824d swift format 2025-07-29 07:04:57 +01:00
Nick Payne ac0ae46cfa update readme 2025-07-27 10:06:01 +01:00
Nick Payne 8c3ee0f4e7 fix build error 2025-07-27 09:55:33 +01:00
Nick Payne abaa019bd2 only write PCM to stdout 2025-07-27 09:53:26 +01:00
Nick Payne ee8968e2d6 no need for buffer overflow error 2025-07-12 13:45:25 +01:00
Nick Payne 4bc36019c2 get rid of O(n) ops on hot audio packet path 2025-07-10 20:43:17 +01:00
Nick Payne 1b537eb395 use ring buffer to avoid memory leak 2025-07-10 14:08:52 +01:00
Nick Payne c696fa0197 Merge branch 'main' into readiness-test 2025-07-04 08:53:17 +01:00
Nick Payne a0902f6eec remove swift-argument-parser - it was adding well over 1Mb of bloat to release builds 2025-07-02 20:58:28 +01:00
Nick Payne b7ce5e61d8 Merge branch 'main' into readiness-test 2025-07-02 16:48:35 +01:00
Nick Payne d10f16a119 if a sample rate conversion is requested, always honour it 2025-07-02 16:48:28 +01:00
Nick Payne a7be157d06 attempt to wait for device readiness 2025-07-02 16:13:38 +01:00
Nick Payne fcbf9b0097 rename --convert-to to --sample-rate 2025-06-17 16:53:55 +01:00
Nick Payne 0f550157ae more logical CLI options 2025-06-17 16:48:45 +01:00
Nick Payne 169fe595a6 rename AudioPacketMetadata to BinaryPacketHeader 2025-06-17 10:52:09 +01:00
Nick Payne 4a8bc657e3 AudioTee Swift CLI repo 2025-06-16 20:30:15 +01:00