Skip to content

Commit 5eedb31

Browse files
refactor: update various comments
Signed-off-by: Maika Namuo <httpworldview@gmail.com>
1 parent 34c388a commit 5eedb31

29 files changed

Lines changed: 58 additions & 32 deletions

‎CONTRIBUTING.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ the existing visuals, but in short:
2828
4. The oscilloscope uses normalized autocorrelation period estimation
2929
and waveform-template correlation to keep traces stable across
3030
complex periodic signals and visible channel selections.
31-
5. The stereometer separates bands using LR4 Butterworth filters,
32-
along with linear and log scaling. The correlation meter uses those
33-
same Butterworth crossings.
31+
5. The stereometer uses LR4 (cascaded Butterworth) crossovers and
32+
linear or power-law radial scaling. Multiband correlation uses
33+
the same crossover outputs.
3434
6. The loudness meter implements K-weighting relative to full
3535
scale/LUFS momentary/short-term, True Peak, and RMS
3636
fast/slow. Standards used include ITU-R BS.1770.

‎src/domain.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub mod routing {
55
use serde::{Deserialize, Serialize};
66
use std::{collections::HashSet, sync::Arc};
77

8-
/// Stable key for one application's capture policy.
8+
/// Shared stream key for persisted capture policy.
99
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
1010
#[serde(transparent)]
1111
pub struct StreamIdentity(pub(crate) Arc<str>);

‎src/infra/pipewire.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-3.0-or-later
22
// Copyright (C) 2026 Maika Namuo
33

4-
//! Owned PipeWire graph tap and its two narrow cross-thread interfaces.
4+
//! Threaded PipeWire capture with ordered audio delivery.
55
66
mod graph;
77
mod policy;

‎src/infra/pipewire/stream.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use std::rc::Rc;
1818
use tracing::{error, info};
1919

2020
const DESCRIPTION: &str = "OpenMeters Audio Tap";
21+
// Requested latency at DEFAULT_SAMPLE_RATE.
2122
const LATENCY_FRAMES: u32 = 256;
2223
const EMPTY: i32 = spa::sys::SPA_CHUNK_FLAG_EMPTY as i32;
2324
const NATIVE_F32: spa::param::audio::AudioFormat =

‎src/infra/pipewire/transport.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ use std::sync::{Arc, RwLock};
1313
use std::time::{Duration, Instant};
1414
use tracing::info;
1515

16+
// Packet frame cap, independent of PipeWire's quantum.
1617
const BLOCK_FRAMES: usize = 256;
1718
const BLOCK_SAMPLES: usize = BLOCK_FRAMES * MAX_CAPTURE_CHANNELS;
19+
// Front-packet age from its end; current activity epoch only.
1820
const MAX_BACKLOG: Duration = Duration::from_secs(1);
21+
// 4/3 s of full packets at maximum rate.
1922
const RING_BLOCKS: usize = (MAX_CAPTURE_SAMPLE_RATE as usize * 4).div_ceil(BLOCK_FRAMES * 3);
2023
const PCM_FLUSH_SAMPLES: usize = BLOCK_SAMPLES * 4;
24+
// Packet-duration target, not a flush timer.
2125
const PACKET_FLUSH_INTERVAL: Duration = Duration::from_millis(50);
26+
// Minimum grace for packet continuity and inferred streaming silence.
2227
const IDLE_WATCHDOG: Duration = Duration::from_millis(100);
2328

2429
fn packet_frame_limit(rate: u64) -> usize {

‎src/meter.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-3.0-or-later
22
// Copyright (C) 2026 Maika Namuo
33

4-
//! Presentation-side ownership of the ordered audio timeline.
4+
//! Feeds audio and silence to visuals in timeline order.
55
//!
66
//! Capture stays at its negotiated PipeWire quantum. DSP work is amortized into
77
//! sample-rate-scaled batches so compositor cadence does not become DSP cadence.
@@ -15,7 +15,7 @@ use std::time::Instant;
1515
const SILENCE_CHUNK_FRAMES: usize = 4_096;
1616
const DSP_BATCH_FRAMES_AT_48K: usize = 256;
1717
const MAX_DSP_INGEST_FRAMES_AT_48K: usize = 1_024;
18-
// Cover the three-second loudness window plus recursive filter settling.
18+
// Per-span limit; longer silence resets audio state.
1919
const MAX_SILENCE_SECONDS: u64 = 4;
2020

2121
fn scaled_samples(frames_at_48k: usize, format: AudioFormat) -> usize {

‎src/ui/app.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use windowing::{
3636
};
3737

3838
const TOAST_DISPLAY_DURATION: Duration = Duration::from_secs(2);
39+
// Event-driven retry cooldown, not a timer.
3940
const BAR_RETRY_WINDOW: Duration = Duration::from_secs(5);
4041
const MAINTENANCE_INTERVAL: Duration = Duration::from_millis(100);
4142
const BAR_RESIZE_HANDLE_THICKNESS: f32 = 6.0;

‎src/ui/settings.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn get_closest_hop_divisor(fft_size: usize, hop_size: usize) -> usize {
168168
.unwrap()
169169
}
170170

171-
// Preserve the hop:fft ratio when fft_size changes.
171+
// Preserve the nearest supported hop divisor.
172172
fn update_fft_size(fft_size: &mut usize, hop_size: &mut usize, new_size: usize) -> bool {
173173
let hop_divisor = get_closest_hop_divisor(*fft_size, *hop_size);
174174
if !set(fft_size, new_size) {

‎src/ui/widgets/frame_clock.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::sync::{
1616
};
1717
use std::time::{Duration, Instant};
1818

19+
// Redraw polling interval and popout takeover delay.
1920
const WATCHDOG_INTERVAL: Duration = Duration::from_millis(50);
2021

2122
fn next_deadline(deadline: Instant, now: Instant, interval: Duration) -> Instant {
@@ -35,6 +36,7 @@ fn display_frame_due(
3536
})
3637
}
3738

39+
// Low bit: suspended. Upper bits: redraw/reset counter.
3840
#[derive(Clone, Default)]
3941
pub(in crate::ui) struct FrameHeartbeat(Arc<AtomicU64>);
4042

‎src/util/audio.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub(crate) use self::{
1919

2020
pub const DEFAULT_SAMPLE_RATE: f32 = 48_000.0;
2121
pub const MAX_SAMPLE_RATE: f32 = 768_000.0;
22+
// Caps configured FFT lengths and retained oscilloscope/stereometer frames.
2223
pub const MAX_DSP_BUFFER_LEN: usize = 1 << 20;
2324
pub const BAND_SPLITS_HZ: [f32; 2] = [200.0, 2000.0];
2425
pub const BAND_COUNT: usize = BAND_SPLITS_HZ.len() + 1;

0 commit comments

Comments
 (0)