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

◆ get_data_as_double()

std::span< const double > MayaFlux::Kakshya::SoundStreamContainer::get_data_as_double ( ) const

Get the audio data as a specific type.

Returns
Span of double data for direct access

Definition at line 793 of file SoundStreamContainer.cpp.

794{
795 if (!m_double_extraction_dirty.load(std::memory_order_acquire)) {
796 return { m_cached_ext_buffer };
797 }
798
800 if (m_data.empty())
801 return {};
802
803 std::shared_lock data_lock(m_data_mutex);
804 auto span = convert_variant<double>(m_data[0]);
805 return { span.data(), span.size() };
806 }
807
808 const auto& spans = get_span_cache();
809
810 auto channels = spans
811 | std::views::transform([](const auto& span) {
812 return std::vector<double>(span.begin(), span.end());
813 })
814 | std::ranges::to<std::vector>();
815
817 m_double_extraction_dirty.store(false, std::memory_order_release);
818
819 return { m_cached_ext_buffer };
820}
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)
std::vector< T > interleave_channels(const std::vector< std::vector< T > > &channels)
Interleave multiple channels of data into a single vector.

References get_span_cache(), MayaFlux::Kakshya::interleave_channels(), MayaFlux::Kakshya::INTERLEAVED, m_cached_ext_buffer, m_data, m_data_mutex, m_double_extraction_dirty, m_structure, and MayaFlux::Kakshya::ContainerDataStructure::organization.

Referenced by get_frames(), get_raw_data(), and peek_sequential().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: