feat: spectrum-slice (PSD) panel + two-point marker/ruler tool
Spectrum slice (S): floating panel plotting the time-averaged power spectrum of the current selection (or the visible view when there's no selection). Frequency on X over the region's band, auto-ranged dB on Y, with a peak marker. Backed by ComputePowerSpectrum() in stft.c (mean linear power per bin over the time span). The selection stat panel now biases to the left when this panel is up so the two don't overlap. Marker/ruler tool (M): press-drag-release drops point A and B; the overlay shows crosshairs, a connecting line, and a readout of the ham-useful deltas — Δt, Δf, tone spacing (1/Δt), and drift (Δf/Δt). Marker mode swaps the LMB-drag gesture from box-select to marker drop (Alt/middle still pan); RMB/Esc clear the measurement. Markers reset on new-file load alongside the selection. Both are gated toggles (off by default), wired into the keymap (so they self-document in the About dialog) and the sidebar. Verified headlessly: idle viewport pixel-identical to baseline (AE=0, deterministic); both panels render correctly with sensible numbers. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -106,6 +106,17 @@ typedef struct {
|
||||
float dragFreqStart; // selection freq start when the move began
|
||||
} Selection;
|
||||
|
||||
// Two-point ruler for measuring deltas on the spectrogram (Δt, Δf, baud, drift).
|
||||
// Both points are 0-1 normalized: t over the whole signal, f as a fraction of
|
||||
// Nyquist. A press-drag-release drops A at press and B at release; the readout
|
||||
// stays on screen until cleared, so you can re-drag to re-measure.
|
||||
typedef struct {
|
||||
bool active; // a measurement exists (drawn + read out)
|
||||
bool dragging; // mid-drag, placing point B
|
||||
float t0, f0; // point A
|
||||
float t1, f1; // point B
|
||||
} MarkerTool;
|
||||
|
||||
// The visible window into the spectrogram (time + frequency), all 0-1
|
||||
// normalized, plus the range captured at the start of a pan drag.
|
||||
typedef struct {
|
||||
@@ -132,6 +143,12 @@ typedef struct {
|
||||
// Time + frequency box selection and its drag/move interaction state.
|
||||
Selection sel;
|
||||
|
||||
// Two-point ruler tool. markerMode swaps the LMB-drag gesture from
|
||||
// box-select to dropping markers; showSpectrum toggles the PSD slice panel.
|
||||
MarkerTool marker;
|
||||
bool markerMode;
|
||||
bool showSpectrum;
|
||||
|
||||
// Export settings
|
||||
float exportScale;
|
||||
char exportDir[4096];
|
||||
|
||||
Reference in New Issue
Block a user