Expand description
Waveform bar geometry (M-MEDIA.9 / AUT-105).
Maps an AudioHistogram (M-MEDIA.8) to a list of axis-aligned
rectangles that wisp’s graphics pipeline can render directly. The
point of this module is the crate-level architecture
boundary — wisp should NOT know about
audio. media produces geometry; wisp draws it.
§Coordinate convention
Rectangles use a y-up convention (matching wisp NDC): x/y is
the bottom-left corner, width/height are positive. Callers
pass layout values in whatever unit they want — NDC [-1, +1],
screen pixels, or normalized [0, 1]. The math is unit-agnostic.
§Display modes
mono_bars— one bar per bucket, two arrangement options:WaveformDisplayMode::Anchored— bar’s bottom sits onbaseline_y, grows upward byvalue * max_height. Common for dope-sheet rows above a timeline.WaveformDisplayMode::Mirrored— bar centered onbaseline_y, extendsvalue * max_height / 2in both directions. Common for centered “VU-style” displays.
stereo_bars— pairs left + right histograms: left grows up frombaseline_y, right grows down. Mode is implicitly anchored;WaveformLayout::modeis ignored.
§Bar metric
BarMetric::Peak uses each bucket’s peak (max |sample|); the
visualization feels punchier. BarMetric::Rms uses RMS; the
visualization feels smoother.
Structs§
- Waveform
BarRect - One waveform bar’s rectangle.
- Waveform
Layout - Layout parameters shared by every bar in one waveform.
Enums§
- BarMetric
- Which summary statistic to drive bar height with.
- Waveform
Display Mode - Arrangement of bars relative to the baseline.
Functions§
- i_
as_ 🔒f32 - mono_
bars - Layout one mono histogram into a list of bar rectangles.
- stereo_
bars - Layout stereo histograms:
leftbars extend up frombaseline_y,rightbars extend down. Always anchored;layout.modeis ignored.