Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
audio_assertions.hpp File Reference

Reusable signal assertions over rendered buffers (harness PR 1A). More...

#include "audio_metrics.hpp"

Go to the source code of this file.

Classes

struct  pulp::test::audio::CheckResult
 Outcome of one signal assertion. More...

Namespaces

namespace  pulp
namespace  pulp::test
namespace  pulp::test::audio

Functions

CheckResult pulp::test::audio::assert_no_nan_inf (const BufferMetrics &metrics)
 Fails if any channel contains NaN or ±Inf samples.
CheckResult pulp::test::audio::assert_not_clipped (const BufferMetrics &metrics, double ceiling_dbfs=-0.1)
 Fails if any channel's peak reaches ceiling_dbfs or any sample counted as clipped during analysis.
CheckResult pulp::test::audio::assert_silent (const BufferMetrics &metrics, double threshold_dbfs=-90.0)
 Fails if any channel's RMS is at or above threshold_dbfs.
CheckResult pulp::test::audio::assert_not_silent (const BufferMetrics &metrics, double min_rms_dbfs=-60.0)
 Fails if every channel's RMS is below min_rms_dbfs.
CheckResult pulp::test::audio::assert_peak_between (const BufferMetrics &metrics, double min_dbfs, double max_dbfs)
 Fails unless every channel's peak lies within [min_dbfs, max_dbfs].
CheckResult pulp::test::audio::assert_rms_between (const BufferMetrics &metrics, double min_dbfs, double max_dbfs)
 Fails unless every channel's RMS lies within [min_dbfs, max_dbfs].
CheckResult pulp::test::audio::assert_frequency_near (std::span< const float > samples, double sample_rate, double expected_hz, double tolerance_cents=5.0)
 Fails unless the zero-crossing frequency estimate is within tolerance_cents of expected_hz.
CheckResult pulp::test::audio::assert_null_near (const pulp::audio::BufferView< const float > &a, const pulp::audio::BufferView< const float > &b, double tolerance_dbfs=-120.0)
 Null test: fails if the per-sample residual |a−b| peak is at or above tolerance_dbfs.
CheckResult pulp::test::audio::assert_null_near (const pulp::audio::Buffer< float > &a, const pulp::audio::Buffer< float > &b, double tolerance_dbfs=-120.0)
 Null test: fails if the per-sample residual |a−b| peak is at or above tolerance_dbfs.
CheckResult pulp::test::audio::assert_channels_independent (const pulp::audio::BufferView< const float > &buffer)
 Fails if any two channels are sample-identical (within 1e-9), which usually means a channel-routing bug duplicated one channel.
CheckResult pulp::test::audio::assert_channels_independent (const pulp::audio::Buffer< float > &buffer)
 Fails if any two channels are sample-identical (within 1e-9), which usually means a channel-routing bug duplicated one channel.

Detailed Description

Reusable signal assertions over rendered buffers (harness PR 1A).

Each assertion returns a CheckResult whose message is written for audio developers per the harness plan's failure-message policy: expected vs actual in dBFS/Hz/cents plus the relevant scenario facts, never bare floats. Framework-agnostic — use from Catch2 as:

auto result = assert_not_silent(metrics, -60.0);
INFO(result.message);
REQUIRE(result.passed);

Tolerances are explicit parameters (named per the plan's Threshold Policy); none of these assertions embeds a hidden magic number.