Rename FormatNotSupported to StreamConfigNotSupported
This commit is contained in:
parent
f292391190
commit
07b66f52f3
|
@ -90,9 +90,9 @@ pub enum BuildStreamError {
|
|||
/// program is running.
|
||||
#[error("The requested device is no longer available. For example, it has been unplugged.")]
|
||||
DeviceNotAvailable,
|
||||
/// The required format is not supported.
|
||||
#[error("The requested stream format is not supported by the device.")]
|
||||
FormatNotSupported,
|
||||
/// The specified stream configuration is not supported.
|
||||
#[error("The requested stream configuration is not supported by the device.")]
|
||||
StreamConfigNotSupported,
|
||||
/// We called something the C-Layer did not understand
|
||||
///
|
||||
/// On ALSA device functions called with a feature they do not support will yield this. E.g.
|
||||
|
|
|
@ -71,9 +71,9 @@ impl Device {
|
|||
|
||||
// Ensure that the desired sample type is supported.
|
||||
let sample_format = super::device::convert_data_type(&stream_type)
|
||||
.ok_or(BuildStreamError::FormatNotSupported)?;
|
||||
.ok_or(BuildStreamError::StreamConfigNotSupported)?;
|
||||
if config.sample_format != sample_format {
|
||||
return Err(BuildStreamError::FormatNotSupported);
|
||||
return Err(BuildStreamError::StreamConfigNotSupported);
|
||||
}
|
||||
|
||||
let num_channels = config.channels.clone();
|
||||
|
@ -237,9 +237,9 @@ impl Device {
|
|||
|
||||
// Ensure that the desired sample type is supported.
|
||||
let sample_format = super::device::convert_data_type(&stream_type)
|
||||
.ok_or(BuildStreamError::FormatNotSupported)?;
|
||||
.ok_or(BuildStreamError::StreamConfigNotSupported)?;
|
||||
if config.sample_format != sample_format {
|
||||
return Err(BuildStreamError::FormatNotSupported);
|
||||
return Err(BuildStreamError::StreamConfigNotSupported);
|
||||
}
|
||||
|
||||
let num_channels = config.channels.clone();
|
||||
|
@ -445,7 +445,7 @@ impl Device {
|
|||
let num_asio_channels = f.channels;
|
||||
check_config(&self.driver, config, num_asio_channels)
|
||||
}
|
||||
Err(_) => Err(BuildStreamError::FormatNotSupported),
|
||||
Err(_) => Err(BuildStreamError::StreamConfigNotSupported),
|
||||
}?;
|
||||
let num_channels = config.channels as usize;
|
||||
let ref mut streams = *self.asio_streams.lock();
|
||||
|
@ -485,7 +485,7 @@ impl Device {
|
|||
let num_asio_channels = f.channels;
|
||||
check_config(&self.driver, config, num_asio_channels)
|
||||
}
|
||||
Err(_) => Err(BuildStreamError::FormatNotSupported),
|
||||
Err(_) => Err(BuildStreamError::StreamConfigNotSupported),
|
||||
}?;
|
||||
let num_channels = config.channels as usize;
|
||||
let ref mut streams = *self.asio_streams.lock();
|
||||
|
@ -600,16 +600,16 @@ fn check_config(
|
|||
.set_sample_rate(sample_rate)
|
||||
.map_err(build_stream_err)?;
|
||||
} else {
|
||||
return Err(BuildStreamError::FormatNotSupported);
|
||||
return Err(BuildStreamError::StreamConfigNotSupported);
|
||||
}
|
||||
}
|
||||
// unsigned formats are not supported by asio
|
||||
match sample_format {
|
||||
SampleFormat::I16 | SampleFormat::F32 => (),
|
||||
SampleFormat::U16 => return Err(BuildStreamError::FormatNotSupported),
|
||||
SampleFormat::U16 => return Err(BuildStreamError::StreamConfigNotSupported),
|
||||
}
|
||||
if *channels > num_asio_channels {
|
||||
return Err(BuildStreamError::FormatNotSupported);
|
||||
return Err(BuildStreamError::StreamConfigNotSupported);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ impl From<coreaudio::Error> for BuildStreamError {
|
|||
| coreaudio::Error::NoKnownSubtype
|
||||
| coreaudio::Error::AudioUnit(coreaudio::error::AudioUnitError::FormatNotSupported)
|
||||
| coreaudio::Error::AudioCodec(_)
|
||||
| coreaudio::Error::AudioFormat(_) => BuildStreamError::FormatNotSupported,
|
||||
| coreaudio::Error::AudioFormat(_) => BuildStreamError::StreamConfigNotSupported,
|
||||
_ => BuildStreamError::DeviceNotAvailable,
|
||||
}
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ impl Device {
|
|||
r.mMinimum as u32 == sample_rate && r.mMaximum as u32 == sample_rate
|
||||
});
|
||||
let range_index = match maybe_index {
|
||||
None => return Err(BuildStreamError::FormatNotSupported),
|
||||
None => return Err(BuildStreamError::StreamConfigNotSupported),
|
||||
Some(i) => i,
|
||||
};
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ pub unsafe fn is_format_supported(
|
|||
},
|
||||
(winerror::S_FALSE, _) => {
|
||||
(*audio_client).Release();
|
||||
return Err(BuildStreamError::FormatNotSupported);
|
||||
return Err(BuildStreamError::StreamConfigNotSupported);
|
||||
},
|
||||
(_, Ok(())) => (),
|
||||
};
|
||||
|
@ -639,12 +639,12 @@ impl Device {
|
|||
// Computing the format and initializing the device.
|
||||
let waveformatex = {
|
||||
let format_attempt = format_to_waveformatextensible(format)
|
||||
.ok_or(BuildStreamError::FormatNotSupported)?;
|
||||
.ok_or(BuildStreamError::StreamConfigNotSupported)?;
|
||||
let share_mode = AUDCLNT_SHAREMODE_SHARED;
|
||||
|
||||
// Ensure the format is supported.
|
||||
match super::device::is_format_supported(audio_client, &format_attempt.Format) {
|
||||
Ok(false) => return Err(BuildStreamError::FormatNotSupported),
|
||||
Ok(false) => return Err(BuildStreamError::StreamConfigNotSupported),
|
||||
Err(_) => return Err(BuildStreamError::DeviceNotAvailable),
|
||||
_ => (),
|
||||
}
|
||||
|
@ -783,12 +783,12 @@ impl Device {
|
|||
// Computing the format and initializing the device.
|
||||
let waveformatex = {
|
||||
let format_attempt = format_to_waveformatextensible(format)
|
||||
.ok_or(BuildStreamError::FormatNotSupported)?;
|
||||
.ok_or(BuildStreamError::StreamConfigNotSupported)?;
|
||||
let share_mode = AUDCLNT_SHAREMODE_SHARED;
|
||||
|
||||
// Ensure the format is supported.
|
||||
match super::device::is_format_supported(audio_client, &format_attempt.Format) {
|
||||
Ok(false) => return Err(BuildStreamError::FormatNotSupported),
|
||||
Ok(false) => return Err(BuildStreamError::StreamConfigNotSupported),
|
||||
Err(_) => return Err(BuildStreamError::DeviceNotAvailable),
|
||||
_ => (),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue