diff --git a/src/host/coreaudio/macos/mod.rs b/src/host/coreaudio/macos/mod.rs index e066b1376..5b2133afd 100644 --- a/src/host/coreaudio/macos/mod.rs +++ b/src/host/coreaudio/macos/mod.rs @@ -300,19 +300,15 @@ impl Device { let buffer_size = get_io_buffer_frame_size_range(&audio_unit)?; // Collect the supported formats for the device. - let mut fmts = vec![]; - for range in ranges { let fmt = SupportedStreamConfigRange { channels: n_channels as ChannelCount, - min_sample_rate: SampleRate(range.mMinimum as _), - max_sample_rate: SampleRate(range.mMaximum as _), + min_sample_rate: SampleRate(ranges.iter().map(|v| v.mMinimum as u32).min().unwrap()), + max_sample_rate: SampleRate(ranges.iter().map(|v| v.mMaximum as u32).max().unwrap()), buffer_size, sample_format, }; - fmts.push(fmt); - } - Ok(fmts.into_iter()) + Ok(vec![fmt].into_iter()) } }