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

◆ get_frame()

std::span< const double > MayaFlux::Kakshya::SoundStreamContainer::get_frame ( uint64_t  frame_index) const
overridevirtual

Get a single frame of data efficiently.

Parameters
frame_indexIndex of the frame (in the temporal dimension)
Returns
Span of data representing one complete frame

Implements MayaFlux::Kakshya::NDDataContainer.

Definition at line 188 of file SoundStreamContainer.cpp.

189{
190 if (frame_index >= m_num_frames) {
191 return {};
192 }
193
194 const auto& spans = get_span_cache();
195
197 if (spans.empty())
198 return {};
199
200 auto frame_span = extract_frame<double>(spans[0], frame_index, m_num_channels);
201 return { frame_span.data(), frame_span.size() };
202 }
203
204 static thread_local std::vector<double> frame_buffer;
205 auto frame_span = extract_frame<double>(spans, frame_index, frame_buffer);
206 return { frame_span.data(), frame_span.size() };
207}
const std::vector< std::span< double > > & get_span_cache() const
Get the cached spans for each channel, recomputing if dirty.
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)

References get_span_cache(), MayaFlux::Kakshya::INTERLEAVED, m_num_channels, m_num_frames, m_structure, and MayaFlux::Kakshya::ContainerDataStructure::organization.

+ Here is the call graph for this function: