Owning multi-channel audio buffer with contiguous storage. More...
#include <buffer.hpp>
Public Member Functions | |
| Buffer ()=default | |
| Buffer (std::size_t num_channels, std::size_t num_samples) | |
| Allocate a buffer with the given dimensions, zero-filled. | |
| Buffer (const Buffer &other) | |
| Buffer & | operator= (const Buffer &other) |
| Buffer (Buffer &&other) | |
| Buffer & | operator= (Buffer &&other) |
| void | resize (std::size_t num_channels, std::size_t num_samples) |
| Resize the buffer, reallocating if necessary. New samples are zero-filled. | |
| BufferView< SampleType > | view () |
| Create a non-owning BufferView over this buffer's data. | |
| BufferView< const SampleType > | view () const |
| Create a non-owning BufferView over this buffer's data. | |
| std::span< SampleType > | channel (std::size_t index) |
| Get a span over all samples in one channel. | |
| std::span< const SampleType > | channel (std::size_t index) const |
| Get a span over all samples in one channel. | |
| std::size_t | num_channels () const |
| std::size_t | num_samples () const |
| std::size_t | allocated_sample_capacity () const noexcept |
| Number of sample elements retained by the backing allocation. | |
| void | release () noexcept |
| Release all owned sample and channel-pointer storage. | |
| void | clear () |
| Zero-fill all channels. | |
Owning multi-channel audio buffer with contiguous storage.
Allocates and manages its own sample memory. Use for offline rendering, test harnesses, and HeadlessHost — not in real-time audio callbacks where allocation is forbidden. Call view() to get a non-owning BufferView.
| SampleType | Sample format, typically float. |
|
default |
|
inline |
Allocate a buffer with the given dimensions, zero-filled.
| num_channels | Number of audio channels. |
| num_samples | Number of samples per channel. |
|
inline |
|
inline |
|
inlinenoexcept |
Number of sample elements retained by the backing allocation.
This can exceed num_channels() * num_samples() after a resize-down.
|
inline |
Get a span over all samples in one channel.
| index | Zero-based channel index. |
|
inline |
Get a span over all samples in one channel.
| index | Zero-based channel index. |
|
inline |
Zero-fill all channels.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
Release all owned sample and channel-pointer storage.
|
inline |
Resize the buffer, reallocating if necessary. New samples are zero-filled.
|
inline |
Create a non-owning BufferView over this buffer's data.
The view is invalidated if the Buffer is resized or destroyed.
|
inline |
Create a non-owning BufferView over this buffer's data.
The view is invalidated if the Buffer is resized or destroyed. Const overload: yields a read-only view. SampleType** converts to const SampleType* const* implicitly (qualification conversion), so no extra pointer array is needed.