pub trait DeviceTrait {
type SupportedInputConfigs: Iterator<Item = SupportedStreamConfigRange>;
type SupportedOutputConfigs: Iterator<Item = SupportedStreamConfigRange>;
type Stream: StreamTrait;
fn name(&self) -> Result<String, DeviceNameError>;
fn supported_input_configs(
&self
) -> Result<Self::SupportedInputConfigs, SupportedStreamConfigsError>;
fn supported_output_configs(
&self
) -> Result<Self::SupportedOutputConfigs, SupportedStreamConfigsError>;
fn default_input_config(
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>;
fn default_output_config(
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>;
fn build_input_stream_raw<D, E>(
&self,
config: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>
where
D: FnMut(&Data, &InputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static;
fn build_output_stream_raw<D, E>(
&self,
config: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>
where
D: FnMut(&mut Data, &OutputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static;
fn build_input_stream<T, D, E>(
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>
where
T: Sample,
D: FnMut(&[T], &InputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
{ ... }
fn build_output_stream<T, D, E>(
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>
where
T: Sample,
D: FnMut(&mut [T], &OutputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
{ ... }
}