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

◆ get_remaining_frames()

std::vector< uint64_t > MayaFlux::Kakshya::SoundStreamContainer::get_remaining_frames ( ) const
overridevirtual

Get the number of remaining frames from the current position, per channel.

Returns
Number of frames until end (accounting for looping)

Enables efficient buffer management and lookahead in streaming scenarios.

Implements MayaFlux::Kakshya::StreamContainer.

Definition at line 476 of file SoundStreamContainer.cpp.

477{
478 std::vector<uint64_t> frames(m_num_channels);
479 if (m_looping_enabled || m_read_position.empty()) {
480
481 for (auto& frame : frames) {
482 frame = std::numeric_limits<uint64_t>::max();
483 }
484 return frames;
485 }
486
487 for (size_t i = 0; i < frames.size(); i++) {
488 uint64_t current_frame = m_read_position[i].load();
489 frames[i] = (current_frame < m_num_frames) ? (m_num_frames - current_frame) : 0;
490 }
491 return frames;
492}
std::vector< std::atomic< uint64_t > > m_read_position

References m_looping_enabled, m_num_channels, m_num_frames, and m_read_position.