pub const fn sample_rate_to_capacity(sample_rate_hz: u32) -> usize
Expand description

sample_rate_to_capacity(sr_hz) is the calculated capacity needed for the internal buffer based on the sample rate.

Const function allows us to use the result of this expression as a generic argument when we create ribbon objects. If rust support for generic expressions improves, this function could be refactored out.

The capacity needs space for the main samples that we will actually care about, as well as room for the most recent samples to discard. This is to avoid including spurious readings in the average.