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

◆ load()

void MayaFlux::Buffers::StreamSliceProcessor::load ( size_t  index,
Kakshya::StreamSlice  slice 
)

Assign a StreamSlice to a slot.

Must be called after the processor is attached to a buffer, as the buffer's frame count is required to configure the CursorAccessProcessor. Calling load() before attachment is a no-op with an error log.

Constructs a CursorAccessProcessor owned by this slot, attaches it to the slice's stream, and configures the loop region from the slice's Region. Any previously loaded slot processor is detached first. The slot is left inactive; call bind() to start playback. Grows the slot pool if index exceeds the current size.

Parameters
indexThe slot is left inactive; call bind() to start playback.
sliceStreamSlice describing the stream and region.

Definition at line 40 of file StreamSliceProcessor.cpp.

41{
42 if (m_frames_per_block == 0) {
44 "StreamSliceProcessor::load called before attachment to a buffer -- attach first");
45 return;
46 }
47
48 if (!slice.stream)
49 return;
50
51 if (index > m_slots.size()) {
53 "StreamSliceProcessor::load index {} exceeds slot count {}; use {} for next available",
54 index, m_slots.size(), m_slots.size());
55 }
56
57 if (index >= m_slots.size())
58 m_slots.resize(index + 1);
59
60 detach_slot(index);
61
62 slice.active = false;
63 slice.index = static_cast<uint8_t>(index);
64
65 auto proc = std::make_shared<Kakshya::CursorAccessProcessor>(m_frames_per_block);
66 proc->set_loop_region(slice.start_frame(), slice.end_frame());
67 proc->set_looping(slice.looping);
68 proc->set_loop_count(slice.loop_count);
69
70 if (slice.speed != 1.0)
71 proc->set_speed(slice.speed);
72
73 proc->set_on_end([this, index] {
74 m_slots[index].slice.active = false;
75 if (m_on_end)
76 m_on_end(index);
77 });
78
79 proc->on_attach(slice.stream);
80
81 m_slots[index].slice = std::move(slice);
82 m_slots[index].proc = std::move(proc);
83}
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
Kakshya::StreamSlice & slice(size_t index)
@ Configuration
Configuration and parameter updates.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
std::shared_ptr< DynamicSoundStream > stream

References MayaFlux::Kakshya::StreamSlice::active, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Journal::Configuration, detach_slot(), MayaFlux::Kakshya::StreamSlice::end_frame(), MayaFlux::Kakshya::StreamSlice::index, MayaFlux::Kakshya::StreamSlice::loop_count, MayaFlux::Kakshya::StreamSlice::looping, m_frames_per_block, m_on_end, m_slots, MF_ERROR, MF_WARN, slice(), MayaFlux::Kakshya::StreamSlice::speed, MayaFlux::Kakshya::StreamSlice::start_frame(), and MayaFlux::Kakshya::StreamSlice::stream.

+ Here is the call graph for this function: