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

◆ set_value_impl()

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

Type-erased single-element write.

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

Implements MayaFlux::Kakshya::NDDataContainer.

Definition at line 862 of file SoundStreamContainer.cpp.

866{
867 if (type != typeid(double) || coords.size() != 2)
868 return;
869
870 const uint64_t frame = coords[0];
871 const uint64_t channel = coords[1];
872
873 if (frame >= m_num_frames || channel >= m_num_channels)
874 return;
875
876 const auto& spans = get_span_cache();
877
879 if (spans.empty())
880 return;
881 const uint64_t idx = frame * m_num_channels + channel;
882 if (idx >= spans[0].size())
883 return;
884 const_cast<std::span<double>&>(spans[0])[idx] = *static_cast<const double*>(in);
885 } else {
886 if (channel >= spans.size() || frame >= spans[channel].size())
887 return;
888 const_cast<std::span<double>&>(spans[channel])[frame] = *static_cast<const double*>(in);
889 }
890
892 m_double_extraction_dirty.store(true, std::memory_order_release);
893}
const std::vector< std::span< double > > & get_span_cache() const
Get the cached spans for each channel, recomputing if dirty.
void invalidate_span_cache()
Invalidate the span cache when data or layout changes.
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)

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

+ Here is the call graph for this function: