Function awedio::utils::convert_num_samples
source ยท pub fn convert_num_samples(
old_num_samples: u64,
old_channel_count: u16,
old_sample_rate: u32,
new_channel_count: u16,
new_sample_rate: u32
) -> u64
Expand description
Convert a number of samples at an old sample rate and channel count to a new number of samples at a different channel rate or sample count such that the new number of samples would be at the same time offset as the old number of samples.
Any fractional samples are truncated.
Overflow occurs if old_num_samples * old_channel_count * old_sample_rate does not fit into a u64.