Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
audio_probe_snapshot.hpp
Go to the documentation of this file.
1#pragma once
2
19
20#include <cstdint>
21#include <type_traits>
22
23namespace pulp::audio {
24
36
46 static constexpr int kMaxChannels = 32;
47
48 // ── Identity tuple (stale/mismatch detection) ──────────────────────────
49 double sample_rate = 0.0;
50 std::uint32_t block_size = 0;
51 std::uint32_t channel_count = 0;
56 std::uint64_t sequence_number = 0;
57
58 // ── Per-channel scalar metrics (first `channel_count` valid) ────────────
60 float peak[kMaxChannels] = {};
62 float rms[kMaxChannels] = {};
63
64 // ── Aggregate scalar metrics (across active channels, this block) ───────
66 float peak_max = 0.0f;
68 float rms_max = 0.0f;
69
70 // ── Content event counters (cumulative since prepare()) ─────────────────
72 std::uint64_t clip_count = 0;
74 std::uint64_t nan_inf_count = 0;
78 std::uint64_t clipped_blocks = 0;
81 std::uint64_t nan_blocks = 0;
83 std::uint64_t callbacks = 0;
86 std::uint64_t silence_run_blocks = 0;
87
88 // ── Drop / overwrite accounting (flight-recorder honesty) ───────────────
91 std::uint64_t dropped_capture_frames = 0;
94 std::uint64_t overwritten_capture_frames = 0;
95};
96
97static_assert(std::is_trivially_copyable_v<AudioProbeSnapshot>,
98 "AudioProbeSnapshot must be trivially copyable to ride a "
99 "TripleBuffer without allocation");
100static_assert(std::is_trivially_destructible_v<AudioProbeSnapshot>,
101 "AudioProbeSnapshot must be trivially destructible (POD-like)");
102
103} // namespace pulp::audio
Definition analyzer_provider.hpp:12
AudioProbeStage
Identifies which audio boundary a snapshot was produced at.
Definition audio_probe_snapshot.hpp:28
@ kProcessorOutput
Definition audio_probe_snapshot.hpp:30
@ kUnknown
Definition audio_probe_snapshot.hpp:29
@ kDeviceCallback
Definition audio_probe_snapshot.hpp:33
@ kMeterBridge
Definition audio_probe_snapshot.hpp:32
@ kGraphNode
Definition audio_probe_snapshot.hpp:34
@ kStandaloneOutputBoundary
Definition audio_probe_snapshot.hpp:31
Realtime-produced, fixed-capacity, trivially-copyable probe summary.
Definition audio_probe_snapshot.hpp:42
static constexpr int kMaxChannels
Compile-time channel ceiling.
Definition audio_probe_snapshot.hpp:46
std::uint64_t clip_count
Samples seen with |x| > clip ceiling, summed over all blocks/channels.
Definition audio_probe_snapshot.hpp:72
double sample_rate
Definition audio_probe_snapshot.hpp:49
std::uint64_t silence_run_blocks
Consecutive blocks (most recent run) below the silence threshold.
Definition audio_probe_snapshot.hpp:86
std::uint64_t nan_blocks
BLOCKS that contained at least one NaN/Inf sample (per-block tally, not the per-sample nan_inf_count)...
Definition audio_probe_snapshot.hpp:81
float rms_max
Max RMS across active channels (linear).
Definition audio_probe_snapshot.hpp:68
std::uint64_t sequence_number
Monotonic per-publish counter.
Definition audio_probe_snapshot.hpp:56
std::uint64_t clipped_blocks
BLOCKS that contained at least one clipped sample (per-block tally, not the per-sample clip_count).
Definition audio_probe_snapshot.hpp:78
std::uint64_t callbacks
Number of analyzed callbacks (blocks) since prepare().
Definition audio_probe_snapshot.hpp:83
float rms[kMaxChannels]
RMS of this block, per channel (linear, >= 0).
Definition audio_probe_snapshot.hpp:62
AudioProbeStage stage_id
Definition audio_probe_snapshot.hpp:52
float peak_max
Max peak across active channels (linear).
Definition audio_probe_snapshot.hpp:66
std::uint32_t channel_count
Definition audio_probe_snapshot.hpp:51
float peak[kMaxChannels]
Peak absolute sample value this block, per channel (linear, >= 0).
Definition audio_probe_snapshot.hpp:60
std::uint64_t overwritten_capture_frames
Capture frames overwritten in the ring before a consumer read them (only meaningful when overwrite-on...
Definition audio_probe_snapshot.hpp:94
std::uint64_t dropped_capture_frames
Capture frames the producer could not enqueue because the ring was full (only meaningful when last-N ...
Definition audio_probe_snapshot.hpp:91
std::uint32_t block_size
Definition audio_probe_snapshot.hpp:50
std::uint64_t nan_inf_count
Samples seen as NaN or Inf, summed over all blocks/channels.
Definition audio_probe_snapshot.hpp:74