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

◆ get_value_impl()

void MayaFlux::Kakshya::SoundStreamContainer::get_value_impl ( const std::vector< uint64_t > &  coords,
void *  out,
const std::type_info &  type 
) const
overrideprotectedvirtual

Type-erased single-element read.

Implementations copy the native element at coords into out if type matches their native type, otherwise no-op. out points to a caller-owned buffer of exactly sizeof(native type) bytes.

Implements MayaFlux::Kakshya::NDDataContainer.

Definition at line 832 of file SoundStreamContainer.cpp.

836{
837 if (type != typeid(double) || coords.size() != 2 || !has_data())
838 return;
839
840 const uint64_t frame = coords[0];
841 const uint64_t channel = coords[1];
842
843 if (frame >= m_num_frames || channel >= m_num_channels)
844 return;
845
846 const auto& spans = get_span_cache();
847
849 if (spans.empty())
850 return;
851 const uint64_t idx = frame * m_num_channels + channel;
852 if (idx >= spans[0].size())
853 return;
854 *static_cast<double*>(out) = spans[0][idx];
855 } else {
856 if (channel >= spans.size() || frame >= spans[channel].size())
857 return;
858 *static_cast<double*>(out) = spans[channel][frame];
859 }
860}
const std::vector< std::span< double > > & get_span_cache() const
Get the cached spans for each channel, recomputing if dirty.
bool has_data() const override
Check if the container currently holds any data.
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)

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

+ Here is the call graph for this function: