Skip to content

Commit

Permalink
changed the way to collect supported samplerate range
Browse files Browse the repository at this point in the history
  • Loading branch information
tomoyanonymous committed Nov 12, 2024
1 parent 582e93c commit ccb70c7
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/host/coreaudio/macos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,19 @@ 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 _),
buffer_size,
sample_format,
};
fmts.push(fmt);
}
let fmt = SupportedStreamConfigRange {
channels: n_channels as ChannelCount,
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,
};

Ok(fmts.into_iter())
Ok(vec![fmt].into_iter())
}
}

Expand Down

0 comments on commit ccb70c7

Please sign in to comment.