Trait rodio::DeviceTrait
source · [−]pub trait DeviceTrait {
type SupportedInputConfigs: Iterator
where
<Self::SupportedInputConfigs as Iterator>::Item == SupportedStreamConfigRange;
type SupportedOutputConfigs: Iterator
where
<Self::SupportedOutputConfigs as 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: 'static + FnMut(&Data, &InputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send;
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: 'static + FnMut(&mut Data, &OutputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send;
fn build_input_stream<T, D, E>(
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>
where
T: Sample,
D: 'static + FnMut(&[T], &InputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send,
{ ... }
fn build_output_stream<T, D, E>(
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>
where
T: Sample,
D: 'static + FnMut(&mut [T], &OutputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send,
{ ... }
}
Expand description
A device that is capable of audio input and/or output.
Please note that Device
s may become invalid if they get disconnected. Therefore, all the
methods that involve a device return a Result
allowing the user to handle this case.
Required Associated Types
sourcetype SupportedInputConfigs: Iterator
where
<Self::SupportedInputConfigs as Iterator>::Item == SupportedStreamConfigRange
type SupportedInputConfigs: Iterator
where
<Self::SupportedInputConfigs as Iterator>::Item == SupportedStreamConfigRange
The iterator type yielding supported input stream formats.
sourcetype SupportedOutputConfigs: Iterator
where
<Self::SupportedOutputConfigs as Iterator>::Item == SupportedStreamConfigRange
type SupportedOutputConfigs: Iterator
where
<Self::SupportedOutputConfigs as Iterator>::Item == SupportedStreamConfigRange
The iterator type yielding supported output stream formats.
sourcetype Stream: StreamTrait
type Stream: StreamTrait
The stream type created by build_input_stream_raw
and build_output_stream_raw
.
Required Methods
sourcefn name(&self) -> Result<String, DeviceNameError>
fn name(&self) -> Result<String, DeviceNameError>
The human-readable name of the device.
sourcefn supported_input_configs(
&self
) -> Result<Self::SupportedInputConfigs, SupportedStreamConfigsError>
fn supported_input_configs(
&self
) -> Result<Self::SupportedInputConfigs, SupportedStreamConfigsError>
An iterator yielding formats that are supported by the backend.
Can return an error if the device is no longer valid (e.g. it has been disconnected).
sourcefn supported_output_configs(
&self
) -> Result<Self::SupportedOutputConfigs, SupportedStreamConfigsError>
fn supported_output_configs(
&self
) -> Result<Self::SupportedOutputConfigs, SupportedStreamConfigsError>
An iterator yielding output stream formats that are supported by the device.
Can return an error if the device is no longer valid (e.g. it has been disconnected).
The default input stream format for the device.
The default output stream format for the device.
sourcefn build_input_stream_raw<D, E>(
&self,
config: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>where
D: 'static + FnMut(&Data, &InputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send,
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: 'static + FnMut(&Data, &InputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send,
Create a dynamically typed input stream.
sourcefn build_output_stream_raw<D, E>(
&self,
config: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>where
D: 'static + FnMut(&mut Data, &OutputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send,
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: 'static + FnMut(&mut Data, &OutputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send,
Create a dynamically typed output stream.
Provided Methods
sourcefn build_input_stream<T, D, E>(
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>where
T: Sample,
D: 'static + FnMut(&[T], &InputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send,
fn build_input_stream<T, D, E>(
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>where
T: Sample,
D: 'static + FnMut(&[T], &InputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send,
Create an input stream.
sourcefn build_output_stream<T, D, E>(
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>where
T: Sample,
D: 'static + FnMut(&mut [T], &OutputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send,
fn build_output_stream<T, D, E>(
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError>where
T: Sample,
D: 'static + FnMut(&mut [T], &OutputCallbackInfo) + Send,
E: 'static + FnMut(StreamError) + Send,
Create an output stream.