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

◆ get_span_cache()

const std::vector< std::span< double > > & MayaFlux::Kakshya::SoundStreamContainer::get_span_cache ( ) const
protected

Get the cached spans for each channel, recomputing if dirty.

Definition at line 841 of file SoundStreamContainer.cpp.

842{
843 if (!m_span_cache_dirty.load(std::memory_order_acquire) && m_span_cache.has_value()) {
844 return *m_span_cache;
845 }
846
847 std::unique_lock data_lock(m_data_mutex);
848
849 if (!m_span_cache_dirty.load(std::memory_order_acquire) && m_span_cache.has_value()) {
850 return *m_span_cache;
851 }
852
853 auto spans = m_data
854 | std::views::transform([](auto& variant) {
855 return convert_variant<double>(const_cast<DataVariant&>(variant));
856 })
857 | std::ranges::to<std::vector>();
858
859 m_span_cache = std::move(spans);
860 m_span_cache_dirty.store(false, std::memory_order_release);
861
862 return *m_span_cache;
863}
std::optional< std::vector< std::span< double > > > m_span_cache
std::variant< std::vector< double >, std::vector< float >, std::vector< uint8_t >, std::vector< uint16_t >, std::vector< uint32_t >, std::vector< std::complex< float > >, std::vector< std::complex< double > >, std::vector< glm::vec2 >, std::vector< glm::vec3 >, std::vector< glm::vec4 >, std::vector< glm::mat4 > > DataVariant
Multi-type data storage for different precision needs.
Definition NDData.hpp:73

References m_data, m_data_mutex, m_span_cache, and m_span_cache_dirty.

Referenced by get_data_as_double(), get_frame(), get_region_data(), get_region_group_data(), get_segments_data(), get_value_at(), and set_value_at().

+ Here is the caller graph for this function: