MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ enable_circular_buffer()

void MayaFlux::Kakshya::DynamicSoundStream::enable_circular_buffer ( uint64_t  capacity)

Enable circular buffer mode with fixed capacity.

Writes wrap around at capacity boundary, potentially overwriting older data.

Parameters
capacityFixed number of frames the circular buffer can hold

Definition at line 365 of file DynamicSoundStream.cpp.

366{
367 ensure_capacity(capacity);
368
369 Region circular_region {
370 { 0, 0 },
371 { capacity - 1, get_num_channels() - 1 }
372 };
373
374 set_loop_region(circular_region);
375 set_looping(true);
376
377 m_circular_capacity = capacity;
378 m_is_circular = true;
379
380 for (uint64_t& head : m_write_heads) {
381 head %= capacity;
382 }
383}
std::vector< uint64_t > m_write_heads
Next append_frames index per channel.
bool m_is_circular
True when operating in circular buffer mode.
void ensure_capacity(uint64_t required_frames)
Pre-allocate capacity for the specified number of frames.
uint64_t m_circular_capacity
Fixed capacity for circular mode.
void set_looping(bool enable) override
Enable or disable looping behavior for the stream.
void set_loop_region(const Region &region) override
Set the loop region using a Region.

References ensure_capacity(), MayaFlux::Kakshya::SoundStreamContainer::get_num_channels(), m_circular_capacity, m_is_circular, m_write_heads, MayaFlux::Kakshya::SoundStreamContainer::set_loop_region(), and MayaFlux::Kakshya::SoundStreamContainer::set_looping().

+ Here is the call graph for this function: