zero-alloc audio pipeline: pointer-based IO from ring buffer to stdout
Replace Data/AudioPacket allocations with raw pointer callbacks through the entire audio pipeline. Ring buffer hands out direct pointers (or linearizes into a pre-allocated scratch buffer on wrap-around), converter accepts/emits pointers via its cached buffers, and output handler writes to stdout via write(2) with EINTR handling. Remove AudioPacket (dead code), --flush flag (no-op with raw write(2)). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,9 @@ import Foundation
|
||||
|
||||
/// Protocol for handling audio output in different formats
|
||||
public protocol AudioOutputHandler {
|
||||
func handleAudioPacket(_ packet: AudioPacket)
|
||||
/// Called with a pointer to raw PCM audio data. The pointer is only
|
||||
/// valid for the duration of this call.
|
||||
func handleAudioData(_ pointer: UnsafeRawPointer, count: Int)
|
||||
func handleMetadata(_ metadata: AudioStreamMetadata)
|
||||
func handleStreamStart()
|
||||
func handleStreamStop()
|
||||
|
||||
Reference in New Issue
Block a user