pub struct WaveformLayout {
pub origin_x: f32,
pub baseline_y: f32,
pub bar_width: f32,
pub bar_gap: f32,
pub max_height: f32,
pub color: [f32; 4],
pub metric: BarMetric,
pub mode: WaveformDisplayMode,
}Expand description
Layout parameters shared by every bar in one waveform.
All values use the caller’s chosen unit system (NDC, pixels, …).
Fields§
§origin_x: f32x of the first bar’s left edge.
baseline_y: f32Reference y line for WaveformDisplayMode.
bar_width: f32Width of one bar (excluding gap). Must be > 0.
bar_gap: f32Horizontal spacing between adjacent bar left edges, on top of
bar_width. May be 0 for touching bars.
max_height: f32Bar height when the metric is 1.0. Must be > 0.
color: [f32; 4]Per-bar RGBA color.
metric: BarMetricWhether to read peak or rms from each bucket.
mode: WaveformDisplayModeAnchored vs mirrored.
Implementations§
Source§impl WaveformLayout
impl WaveformLayout
Sourcepub fn ndc_default() -> Self
pub fn ndc_default() -> Self
Reasonable defaults for an NDC [-1, +1] mono waveform centered
vertically: gray bars 0.02 wide, gap 0.005, max height
0.4, anchored at y = 0. Tweak from here.
Trait Implementations§
Source§impl Clone for WaveformLayout
impl Clone for WaveformLayout
Source§fn clone(&self) -> WaveformLayout
fn clone(&self) -> WaveformLayout
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WaveformLayout
impl Debug for WaveformLayout
impl Copy for WaveformLayout
Auto Trait Implementations§
impl Freeze for WaveformLayout
impl RefUnwindSafe for WaveformLayout
impl Send for WaveformLayout
impl Sync for WaveformLayout
impl Unpin for WaveformLayout
impl UnsafeUnpin for WaveformLayout
impl UnwindSafe for WaveformLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more