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

191{
192 if (frame_index >= m_num_frames) {
193 return {};
194 }
195
196 const auto& spans = get_span_cache();
197
199 if (spans.empty())
200 return {};
201
202 auto frame_span = extract_frame<double>(spans[0], frame_index, m_num_channels);
203 return { frame_span.data(), frame_span.size() };
204 }
205
206 static thread_local std::vector<double> frame_buffer;
207 auto frame_span = extract_frame<double>(spans, frame_index, frame_buffer);
208 return { frame_span.data(), frame_span.size() };
209}
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: