32 return mImpl->pcm().size();
50 if (
mImpl ==
nullptr || other.
mImpl ==
nullptr) {
53 if (
mImpl->pcm().size() != other.
mImpl->pcm().size()) {
56 for (fl::size i = 0; i <
mImpl->pcm().
size(); ++i) {
57 if (
mImpl->pcm()[i] != other.
mImpl->pcm()[i]) {
65 return !(*
this == other);
69 static fl::i16 empty_data[1] = {0};
78 return mImpl->timestamp();
89 for (
int i = 0; i < N; ++i) {
90 fl::i32 x32 = fl::i32(
pcm()[i]);
93 float rms = sqrtf(
float(sum_sq) / N);
105 for (fl::size i = 0; i < count; ++i) {
106 double s = samples[i] / 32768.0;
109 double p = sum_sq / count;
110 double dbfs = 10.0 * log10(p + 1e-12);
137 get_flex_fft().
run(sample, out,
args);
const VectorPCM & pcm() const
fl::vector< fl::i16 > VectorPCM
bool operator!=(const AudioSample &other) const
bool operator==(const AudioSample &other) const
const fl::i16 & operator[](fl::size i) const
void fft(FFTBins *out) const
const fl::i16 & at(fl::size i) const
fl::u32 timestamp() const
AudioSample & operator=(const AudioSample &other)
static const VectorPCM & empty()
void run(const span< const i16 > &sample, FFTBins *out, const FFT_Args &args=FFT_Args())
SoundLevelMeter(double spl_floor=33.0, double smoothing_alpha=0.0)
double dbfs_floor_global_
void processBlock(const fl::i16 *samples, fl::size count)
Process a block of int16 PCM samples.
ThreadLocalFake< T > ThreadLocal
static int DefaultSampleRate()
static float DefaultMinFrequency()
static float DefaultMaxFrequency()