MostlyHarmless 0.0.1
 
Loading...
Searching...
No Matches
marvin_BufferView.h
Go to the documentation of this file.
1// ========================================================================================================
2// _______ _______ ______ ___ ___ _______ _______
3// | | | _ | __ \ | |_ _| | |
4// | | | < | |_| |_| |
5// |__|_|__|___|___|___|__|\_____/|_______|__|____|
6//
7// This file is part of the Marvin open source library and is licensed under the terms of the MIT License.
8//
9// ========================================================================================================
10
11#ifndef MARVIN_BUFFER_H
12#define MARVIN_BUFFER_H
14#include <span>
21 template <FloatType SampleType>
22 struct BufferView final {
30 BufferView(SampleType* const* samples, size_t nChannels, size_t nSamples);
35 [[nodiscard]] size_t getNumChannels() const noexcept;
40 [[nodiscard]] size_t getNumSamples() const noexcept;
45 const SampleType* const* getArrayOfReadPointers() const noexcept;
50 SampleType* const* getArrayOfWritePointers() noexcept;
57 [[nodiscard]] std::span<SampleType> operator[](size_t channel) noexcept;
64 [[nodiscard]] std::span<const SampleType> operator[](size_t channel) const noexcept;
65
66 private:
67 SampleType* const* m_samples;
68 size_t m_nChannels;
69 size_t m_nSamples;
70 };
71} // namespace marvin::containers
72#endif
Views, wrappers and custom containers.
Definition marvin_BufferView.h:15
BufferView(SampleType *const *samples, size_t nChannels, size_t nSamples)
const SampleType *const * getArrayOfReadPointers() const noexcept
SampleType *const * getArrayOfWritePointers() noexcept
size_t getNumChannels() const noexcept
size_t getNumSamples() const noexcept