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

◆ linearized_view()

template<typename T , typename StoragePolicy , typename ConcurrencyPolicy = SingleThreadedPolicy, typename AccessPattern = QueueAccess>
std::span< T > MayaFlux::Memory::RingBuffer< T, StoragePolicy, ConcurrencyPolicy, AccessPattern >::linearized_view ( ) const
inline

Get linearized view of buffer contents.

Returns
Span ordered by AccessPattern

Only available for SingleThreadedPolicy. Returns contiguous view of buffer data in logical order:

Not Real-time Safe: Copies data to linear buffer. Use sparingly in audio processing paths.

Definition at line 838 of file RingBuffer.hpp.

840 {
841 const size_t cap = m_storage.capacity();
842 const size_t count = size();
843
844 if constexpr (AccessPattern::push_front) {
845 for (size_t i = 0; i < count; ++i) {
846 size_t idx = (m_state.write_index + cap - i) % cap;
847 m_linearized[i] = m_storage.buffer[idx];
848 }
849 } else {
850 for (size_t i = 0; i < count; ++i) {
851 size_t idx = (m_state.read_index + i) % cap;
852 m_linearized[i] = m_storage.buffer[idx];
853 }
854 }
855
856 return { m_linearized.data(), count };
857 }
Eigen::Index count
size_t size() const noexcept
Get approximate element count.

References count, MayaFlux::Memory::RingBuffer< T, StoragePolicy, ConcurrencyPolicy, AccessPattern >::m_linearized, MayaFlux::Memory::RingBuffer< T, StoragePolicy, ConcurrencyPolicy, AccessPattern >::m_state, MayaFlux::Memory::RingBuffer< T, StoragePolicy, ConcurrencyPolicy, AccessPattern >::m_storage, and MayaFlux::Memory::RingBuffer< T, StoragePolicy, ConcurrencyPolicy, AccessPattern >::size().

Referenced by MayaFlux::Memory::RingBuffer< T, StoragePolicy, ConcurrencyPolicy, AccessPattern >::snapshot().

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