diff options
Diffstat (limited to 'src/audio/ring_buffer.h')
| -rw-r--r-- | src/audio/ring_buffer.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/audio/ring_buffer.h b/src/audio/ring_buffer.h index 80b375f..524cb29 100644 --- a/src/audio/ring_buffer.h +++ b/src/audio/ring_buffer.h @@ -50,6 +50,16 @@ class AudioRingBuffer { // Clear buffer (for seeking) void clear(); + // Two-phase write API (for zero-copy direct writes) + // Get direct pointer to writable region in ring buffer + // Returns pointer to linear region and sets out_available_samples + // NOTE: May return less than total available space if wrap-around occurs + float* get_write_region(int* out_available_samples); + + // Commit written samples (advances write_pos atomically) + // FATAL ERROR if num_samples exceeds region from get_write_region() + void commit_write(int num_samples); + private: float buffer_[RING_BUFFER_CAPACITY_SAMPLES]; int capacity_; // Total capacity in samples |
