Support i32 for asio (#737)

This commit is contained in:
Ruairidh Williamson 2022-12-27 22:25:02 +00:00 • committed by GitHub
parent 7776c6634a
commit 90471506b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View file

@ -209,13 +209,8 @@ pub(crate) fn convert_data_type(ty: &sys::AsioSampleType) -> Option<SampleFormat
sys::AsioSampleType::ASIOSTInt16LSB => SampleFormat::I16,
sys::AsioSampleType::ASIOSTFloat32MSB => SampleFormat::F32,
sys::AsioSampleType::ASIOSTFloat32LSB => SampleFormat::F32,
// NOTE: While ASIO does not support these formats directly, the stream callback created by
// CPAL supports converting back and forth between the following. This is because many ASIO
// drivers only support `Int32` formats, while CPAL does not support this format at all. We
// allow for this implicit conversion temporarily until CPAL gets support for an `I32`
// format.
sys::AsioSampleType::ASIOSTInt32MSB => SampleFormat::I16,
sys::AsioSampleType::ASIOSTInt32LSB => SampleFormat::I16,
sys::AsioSampleType::ASIOSTInt32MSB => SampleFormat::I32,
sys::AsioSampleType::ASIOSTInt32LSB => SampleFormat::I32,
_ => return None,
};
Some(fmt)

View file

@ -605,7 +605,7 @@ fn check_config(
}
// unsigned formats are not supported by asio
match sample_format {
SampleFormat::I16 | SampleFormat::F32 => (),
SampleFormat::I16 | SampleFormat::I32 | SampleFormat::F32 => (),
_ => return Err(BuildStreamError::StreamConfigNotSupported),
}
if *channels > num_asio_channels {