// TODO: This function likely will need to verify that
// this device has an appropriate (or just any?) configuration
// as well. This is particularly important when the user doesn't
// specify a device name, but does request e.g. a particular
// channel count, sample rate, or buffer size. As a result, this
// function will need to be refactored to also take the
// EnvironmentSettings object as an argument.
This function likely will need to verify that
this device has an appropriate (or just any?) configuration
as well. This is particularly important when the user doesn't
specify a device name, but does request e.g. a particular
channel count, sample rate, or buffer size. As a result, this
function will need to be refactored to also take the
EnvironmentSettings object as an argument.
This function likely will need to verify that this device has an appropriate ( or just any? ) configuration as well . This is particularly important when the user doesn ' t specify a device name but does request e . g . a particular channel count sample rate or buffer size . As a result this function will need to be refactored to also take the EnvironmentSettings object as an argument .
pub fn find_device(
    requested_device: &Option<String>,
    mut device_iter: std::iter::Filter<cpal::Devices, for<'r> fn(&'r cpal::Device) -> bool>,
    get_default: &dyn Fn() -> Option<cpal::Device>
) -> Option<cpal::Device> {
    match requested_device {
        Some(requested_name) => {
            match device_iter.find(|device|
                match_device_name(requested_name, &device)) {
                Some(matched_device) => Some(matched_device),
                None => get_default()
            }
        },
        None => get_default()
    }
}
pub fn find_device ( requested_device : & Option < String > , mut device_iter : std :: iter :: Filter < cpal :: Devices , for < ' r > fn ( & ' r cpal :: Device ) -> bool > , get_default : & dyn Fn ( ) -> Option < cpal :: Device > ) -> Option < cpal :: Device > { match requested_device { Some ( requested_name ) => { match device_iter . find ( | device | match_device_name ( requested_name , & device ) ) { Some ( matched_device ) => Some ( matched_device ) , None => get_default ( ) } } , None => get_default ( ) } }
TODO: This function likely will need to verify that
this device has an appropriate (or just any?)
TODO : This function likely will need to verify that this device has an appropriate ( or just any? )
requested_device
&Option<String>
device_iter
std::iter::Filter<cpal::Devices, for<'r> fn(&'r cpal::Device) -> bool>
get_default
&dyn Fn() -> Option<cpal::Device>