MayaFlux 0.2.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 529 of file SoundStreamContainer.cpp.

530{
531 std::vector<uint64_t> frames(m_num_channels);
532 if (m_looping_enabled || m_read_position.empty()) {
533
534 for (auto& frame : frames) {
535 frame = std::numeric_limits<uint64_t>::max();
536 }
537 return frames;
538 }
539
540 for (size_t i = 0; i < frames.size(); i++) {
541 uint64_t current_frame = m_read_position[i].load();
542 frames[i] = (current_frame < m_num_frames) ? (m_num_frames - current_frame) : 0;
543 }
544 return frames;
545}
std::vector< std::atomic< uint64_t > > m_read_position

References m_looping_enabled, m_num_channels, m_num_frames, and m_read_position.