Struct thl::dsp::sampler::SampleView#

struct SampleView#

Collaboration diagram for thl::dsp::sampler::SampleView:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="std::array< const float *, k_max_channels >" tooltip="std::array< const float *, k_max_channels >"] "1" [label="thl::dsp::sampler::SampleView" tooltip="thl::dsp::sampler::SampleView" fillcolor="#BFBFBF"] "1" -> "2" [dir=forward tooltip="usage"] }

A non-owning, planar, read-only view of one sample.

The sampler components never own audio: the host keeps the buffer alive for as long as a view of it is in use (typically: while the audio thread renders the block the view was handed to). A default-constructed view is empty and reads as silence.

Real-Time Safety

Copying and reading a view is real-time safe.

Public Functions

inline bool valid() const#

True when the view has audio to read.

Public Members

std::array<const float*, k_max_channels> m_channels = {}#
size_t m_num_frames = {0}#
size_t m_num_channels = {0}#

Public Static Functions

static inline SampleView of(const core::BufferF &buffer)#

View of a buffer (up to k_max_channels channels).

An empty buffer gives an empty view.

static inline SampleView of(const float *const *channels, size_t num_channels, size_t num_frames)#

View of planar pointers the caller owns.