Skip to main content

sample_count_usize

Function sample_count_usize 

Source
pub fn sample_count_usize(v: f64) -> usize
Expand description

Convert a sample-count expressed as f64 (e.g. seconds * sample_rate) to usize, saturating on overflow / negative / non-finite inputs.

Mirrors the is_finite && >= 0 guard pattern that truce-driver open-coded across its offline-render path. NaN and negative inputs collapse to 0; positive infinity and any value past usize::MAX clamp to usize::MAX.