in src/backend/mod.rs [1073:1097]
fn audiounit_convert_channel_layout(layout: &AudioChannelLayout) -> Result<Vec<mixer::Channel>> {
if layout.mChannelLayoutTag != kAudioChannelLayoutTag_UseChannelDescriptions {
// kAudioChannelLayoutTag_UseChannelBitmap
// kAudioChannelLayoutTag_Mono
// kAudioChannelLayoutTag_Stereo
// ....
cubeb_log!("Only handling UseChannelDescriptions for now.\n");
return Err(Error::error());
}
let channel_descriptions = unsafe {
slice::from_raw_parts(
layout.mChannelDescriptions.as_ptr(),
layout.mNumberChannelDescriptions as usize,
)
};
let mut channels = Vec::with_capacity(layout.mNumberChannelDescriptions as usize);
for description in channel_descriptions {
let label = CAChannelLabel(description.mChannelLabel);
channels.push(label.into());
}
Ok(channels)
}