MayaFlux 1.0.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 513 of file SoundStreamContainer.cpp.

514{
515 std::vector<uint64_t> frames(m_num_channels);
516 if (m_looping_enabled || m_read_position.empty()) {
517
518 for (auto& frame : frames) {
519 frame = std::numeric_limits<uint64_t>::max();
520 }
521 return frames;
522 }
523
524 for (size_t i = 0; i < frames.size(); i++) {
525 uint64_t current_frame = m_read_position[i].load();
526 frames[i] = (current_frame < m_num_frames) ? (m_num_frames - current_frame) : 0;
527 }
528 return frames;
529}
std::vector< std::atomic< uint64_t > > m_read_position

References m_looping_enabled, m_num_channels, m_num_frames, and m_read_position.