MayaFlux 0.3.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 791 of file SoundStreamContainer.cpp.

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