46inline void map_samples(
const float* in,
float* out, std::size_t n, Fn&& fn) {
48 for (std::size_t i = 0; i < n; ++i)
51 for (std::size_t i = 0; i < n; ++i)
75template <std::size_t... Counts,
typename Fn>
79 ? (
static_cast<void>(fn(std::integral_constant<std::size_t, Counts>{})),
true)
105void clip(std::span<float> samples,
float lo,
float hi);
Non-owning view over multi-channel audio sample data.
Definition buffer.hpp:30
Definition buffer_ops.hpp:30
void apply_gain(std::span< float > samples, float gain)
Apply a constant gain to a single channel of samples in place.
void with_channel_count(std::size_t channels, Fn &&fn)
Call fn once with the channel count, as a compile-time constant when it is one of Counts....
Definition buffer_ops.hpp:76
float find_magnitude(std::span< const float > samples)
Find the peak absolute value (magnitude) in a span.
MinMax find_min_max(std::span< const float > samples)
Find the min and max sample values in a span.
void clip(std::span< float > samples, float lo, float hi)
Hard-clip every sample to [lo, hi] in place.
constexpr std::size_t kPeakRmsLanes
Number of independent partial sums measure_peak_rms keeps.
Definition buffer_ops.hpp:157
PeakRms measure_peak_rms(std::span< const float > samples) noexcept
Measure the peak absolute value and RMS of a block in one pass.
void apply_gain_ramp(std::span< float > samples, float start_gain, float end_gain)
Apply a linear gain ramp from start_gain to end_gain across the span.
void map_samples(const float *in, float *out, std::size_t n, Fn &&fn)
Write out[i] = fn(in[i]) for every sample, in index order.
Definition buffer_ops.hpp:46
Pair returned by find_min_max.
Definition buffer_ops.hpp:113
float max
Definition buffer_ops.hpp:115
float min
Definition buffer_ops.hpp:114
Block level reading returned by measure_peak_rms: the peak absolute sample value and the root-mean-sq...
Definition buffer_ops.hpp:143
float peak
Definition buffer_ops.hpp:144
float rms
Definition buffer_ops.hpp:145