|
| | AudioBufferView () noexcept=default |
| | Creates an empty view (0 channels, 0 samples).
|
| |
template<typename U >
requires std::is_convertible_v<U*, T*> |
| | AudioBufferView (U *const *channelPtrs, int numChannels, int numSamples) noexcept |
| | Constructs a view from an array of channel pointers safely.
|
| |
template<typename U , int OtherChannels>
requires (std::is_convertible_v<U*, T*> && OtherChannels <= MaxViewChannels) |
| | AudioBufferView (const AudioBufferView< U, OtherChannels > &other) noexcept |
| | Converts compatible sample types and widens pointer-array capacity.
|
| |
| T * | getChannel (int ch) const noexcept |
| | Returns a pointer to the sample data for the given channel.
|
| |
| int | getNumChannels () const noexcept |
| | Returns the number of channels in this view.
|
| |
| int | getNumSamples () const noexcept |
| | Returns the number of samples per channel.
|
| |
| AudioBufferView | getSubView (int startSample, int length) const noexcept |
| | Returns a zero-copy sub-view starting at an offset.
|
| |
| void | clear () const noexcept |
| | Fills the valid sample range of all channels with zeros.
|
| |
| template<typename U , int M> |
| void | copyFrom (const AudioBufferView< U, M > &src) const noexcept |
| | Safely copies samples from a source view into this view.
|
| |
| template<typename U , int M> |
| void | addFrom (const AudioBufferView< U, M > &src, T gain=T(1)) const noexcept |
| | Adds samples from a source view into this view with optional gain.
|
| |
| void | applyGain (T gain) const noexcept |
| | Multiplies all samples in all valid channels by a gain factor.
|
| |
| std::remove_const_t< T > | getPeakLevel () const noexcept |
| | Returns the peak absolute sample value across all channels.
|
| |
template<typename T, int MaxViewChannels = 16>
class dspark::AudioBufferView< T, MaxViewChannels >
Non-owning view over audio channel data.
- Template Parameters
-
| T | Sample type (typically float, double, const float, or const double). |
| MaxViewChannels | Compile-time limit for the internal pointer array. |
Definition at line 49 of file AudioBuffer.h.
template<typename T , int MaxViewChannels = 16>
template<typename U >
requires std::is_convertible_v<U*, T*>
| dspark::AudioBufferView< T, MaxViewChannels >::AudioBufferView |
( |
U *const * |
channelPtrs, |
|
|
int |
numChannels, |
|
|
int |
numSamples |
|
) |
| |
|
inlinenoexcept |
Constructs a view from an array of channel pointers safely.
- Template Parameters
-
| U | Type of the source pointers (must be convertible to T*). |
- Parameters
-
| channelPtrs | Array of pointers, one per channel. |
| numChannels | Number of active channels. |
| numSamples | Number of samples per channel. |
Definition at line 64 of file AudioBuffer.h.
template<typename T , int MaxViewChannels = 16>
template<typename U , int OtherChannels>
requires (std::is_convertible_v<U*, T*> && OtherChannels <= MaxViewChannels)
Converts compatible sample types and widens pointer-array capacity.
Enables passing AudioBufferView<float> to functions expecting AudioBufferView<const float>. The reverse never compiles. A view with fewer pointer slots can also convert to a larger-capacity view, preserving every active channel. Capacity narrowing is not implicit.
The direction is a constraint rather than a body check, because the two say different things to the type system. A body check makes an illegal conversion a hard error inside an otherwise viable candidate, so overload resolution, std::is_convertible_v and every requires expression answer that a const view converts to a mutable one – which is the opposite of the truth for the pointers underneath. A constraint makes it a substitution failure, which is what those questions are asking about and what callers and concepts already assume they get.
- Template Parameters
-
| U | Source sample type. |
| OtherChannels | Source pointer-array capacity, no greater than this view's. |
- Parameters
-
| other | The view to convert from. |
Definition at line 101 of file AudioBuffer.h.
template<typename T , int MaxViewChannels = 16>
template<typename U , int M>
Adds samples from a source view into this view with optional gain.
Channel count and length are trimmed to the smaller of the two views. Unlike copyFrom(), the source must NOT overlap this view: the mix goes through restrict-qualified SIMD kernels (see SimdOps.h).
- Template Parameters
-
| U | Source sample type. |
| M | Source view channel capacity (any capacity is accepted). |
- Parameters
-
| src | Source view. |
| gain | Scaling factor. |
Definition at line 212 of file AudioBuffer.h.
template<typename T , int MaxViewChannels = 16>
template<typename U , int M>
Safely copies samples from a source view into this view.
For same-type trivially-copyable samples the copy goes through std::memmove, which is guaranteed safe even when the ranges overlap. Channel count and length are trimmed to the smaller of the two views.
- Template Parameters
-
| U | Source sample type. |
| M | Source view channel capacity (any capacity is accepted). |
- Parameters
-
| src | Source view to copy from. |
Definition at line 175 of file AudioBuffer.h.