MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kakshya::CursorAccessProcessor Class Reference

Independent cursor reader for DynamicSoundStream, writing exclusively to a dynamic slot allocated at attach time. More...

#include <CursorAccessProcessor.hpp>

+ Inheritance diagram for MayaFlux::Kakshya::CursorAccessProcessor:
+ Collaboration diagram for MayaFlux::Kakshya::CursorAccessProcessor:

Public Member Functions

uint64_t cursor () const
 
 CursorAccessProcessor (uint64_t frames_per_block)
 Construct with a fixed output block size.
 
uint32_t get_slot_index () const
 
bool is_active () const
 
bool is_processing () const override
 Checks if the processor is currently performing processing.
 
uint64_t loop_end () const
 
uint64_t loop_start () const
 
void on_attach (const std::shared_ptr< SignalSourceContainer > &container) override
 Called when this processor is attached to a container.
 
void on_detach (const std::shared_ptr< SignalSourceContainer > &container) override
 Called when this processor is detached from a container.
 
void process (const std::shared_ptr< SignalSourceContainer > &container) override
 Extract one block of frames into container processed_data[0].
 
void reset ()
 Reset cursor to loop start and activate the processor.
 
void set_frames_per_block (uint64_t frames_per_block)
 Set the output block size in frames.
 
void set_loop_count (size_t n)
 Set the number of loops to play before stopping.
 
void set_loop_region (uint64_t start_frame, uint64_t end_frame)
 Set the loop region in frames.
 
void set_looping (bool enable)
 Enable or disable looping within the loop region.
 
void set_on_end (std::function< void()> cb)
 Register a callback fired when one-shot playback reaches the end.
 
void set_speed (double speed)
 Set the playback speed relative to nominal rate.
 
void stop ()
 Deactivate without resetting the cursor position.
 
 ~CursorAccessProcessor () override=default
 
- Public Member Functions inherited from MayaFlux::Kakshya::DataProcessor
virtual ~DataProcessor ()=default
 Virtual destructor for proper cleanup.
 

Private Attributes

bool m_active {}
 
std::vector< uint64_t > m_cursor {}
 
uint64_t m_frames_per_block
 
std::atomic< bool > m_is_processing { false }
 
size_t m_loop_count {}
 
uint64_t m_loop_end {}
 
uint64_t m_loop_start {}
 
bool m_looping {}
 
size_t m_loops_remaining {}
 
std::function< void()> m_on_end
 
uint32_t m_slot_index { std::numeric_limits<uint32_t>::max() }
 
double m_speed { 1.0 }
 
double m_speed_remainder {}
 
ContainerDataStructure m_structure
 

Detailed Description

Independent cursor reader for DynamicSoundStream, writing exclusively to a dynamic slot allocated at attach time.

Intended for use cases where multiple independent cursors must read the same DynamicSoundStream simultaneously – for example StreamSliceProcessor holding N slots over the same loaded buffer. Each instance allocates one dynamic slot via DynamicSoundStream::allocate_dynamic_slot() and writes only into that slot via get_dynamic_data(m_slot_index). The stream's processed_data, processing state, and ready/consumed machinery are never touched. Callers read output directly from get_dynamic_data(get_slot_index()).

on_attach does three things only: cache the container structure, allocate the dynamic slot, and initialise the cursor. It does not set the stream as ready for processing or register any state callbacks. on_detach releases the slot. All other container lifecycle is the caller's responsibility.

For default single-cursor sequential reads driven by the container's own processing state, use ContiguousAccessProcessor instead.

The stream is treated as immutable memory after load. Block size is fixed at construction or via set_frames_per_block(). When inactive, process() writes silence without advancing the cursor. Activation and cursor reset are explicit via reset(), keeping trigger logic decoupled from the processor.

Definition at line 34 of file CursorAccessProcessor.hpp.


The documentation for this class was generated from the following files: