[−][src]Trait rodio::DeviceTrait
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.
Associated Types
type SupportedInputConfigs: Iterator
The iterator type yielding supported input stream formats.
type SupportedOutputConfigs: Iterator
The iterator type yielding supported output stream formats.
type Stream: StreamTrait
The stream type created by build_input_stream_raw
and build_output_stream_raw
.
Required methods
fn name(&self) -> Result<String, DeviceNameError>
The human-readable name of the device.
fn supported_input_configs(
&self
) -> Result<Self::SupportedInputConfigs, SupportedStreamConfigsError>
&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 (eg. it has been disconnected).
fn supported_output_configs(
&self
) -> Result<Self::SupportedOutputConfigs, SupportedStreamConfigsError>
&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 (eg. it has been disconnected).
fn default_input_config(
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
The default input stream format for the device.
fn default_output_config(
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
The default output stream format for the device.
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,
&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,
Create a dynamically typed input stream.
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,
&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,
Create a dynamically typed output stream.
Provided methods
fn build_input_stream<T, D, E>(
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError> where
D: FnMut(&[T], &InputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
T: Sample,
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError> where
D: FnMut(&[T], &InputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
T: Sample,
Create an input stream.
fn build_output_stream<T, D, E>(
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError> where
D: FnMut(&mut [T], &OutputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
T: Sample,
&self,
config: &StreamConfig,
data_callback: D,
error_callback: E
) -> Result<Self::Stream, BuildStreamError> where
D: FnMut(&mut [T], &OutputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
T: Sample,
Create an output stream.
Implementations on Foreign Types
impl DeviceTrait for Device
[src]
type SupportedInputConfigs = IntoIter<SupportedStreamConfigRange>
type SupportedOutputConfigs = IntoIter<SupportedStreamConfigRange>
type Stream = Stream
pub fn name(&self) -> Result<String, DeviceNameError>
[src]
pub fn supported_input_configs(
&self
) -> Result<<Device as DeviceTrait>::SupportedInputConfigs, SupportedStreamConfigsError>
[src]
&self
) -> Result<<Device as DeviceTrait>::SupportedInputConfigs, SupportedStreamConfigsError>
pub fn supported_output_configs(
&self
) -> Result<<Device as DeviceTrait>::SupportedOutputConfigs, SupportedStreamConfigsError>
[src]
&self
) -> Result<<Device as DeviceTrait>::SupportedOutputConfigs, SupportedStreamConfigsError>
pub fn default_input_config(
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
[src]
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
pub fn default_output_config(
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
[src]
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
pub fn build_input_stream_raw<D, E>(
&self,
conf: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<<Device as DeviceTrait>::Stream, BuildStreamError> where
D: FnMut(&Data, &InputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
[src]
&self,
conf: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<<Device as DeviceTrait>::Stream, BuildStreamError> where
D: FnMut(&Data, &InputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
pub fn build_output_stream_raw<D, E>(
&self,
conf: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<<Device as DeviceTrait>::Stream, BuildStreamError> where
D: FnMut(&mut Data, &OutputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
[src]
&self,
conf: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<<Device as DeviceTrait>::Stream, BuildStreamError> where
D: FnMut(&mut Data, &OutputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
Implementors
impl DeviceTrait for rodio::Device
[src]
type SupportedInputConfigs = SupportedInputConfigs
type SupportedOutputConfigs = SupportedOutputConfigs
type Stream = Stream
pub fn name(&self) -> Result<String, DeviceNameError>
[src]
pub fn supported_input_configs(
&self
) -> Result<<Device as DeviceTrait>::SupportedInputConfigs, SupportedStreamConfigsError>
[src]
&self
) -> Result<<Device as DeviceTrait>::SupportedInputConfigs, SupportedStreamConfigsError>
pub fn supported_output_configs(
&self
) -> Result<<Device as DeviceTrait>::SupportedOutputConfigs, SupportedStreamConfigsError>
[src]
&self
) -> Result<<Device as DeviceTrait>::SupportedOutputConfigs, SupportedStreamConfigsError>
pub fn default_input_config(
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
[src]
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
pub fn default_output_config(
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
[src]
&self
) -> Result<SupportedStreamConfig, DefaultStreamConfigError>
pub fn build_input_stream_raw<D, E>(
&self,
config: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<<Device as DeviceTrait>::Stream, BuildStreamError> where
D: FnMut(&Data, &InputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
[src]
&self,
config: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<<Device as DeviceTrait>::Stream, BuildStreamError> where
D: FnMut(&Data, &InputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
pub fn build_output_stream_raw<D, E>(
&self,
config: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<<Device as DeviceTrait>::Stream, BuildStreamError> where
D: FnMut(&mut Data, &OutputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,
[src]
&self,
config: &StreamConfig,
sample_format: SampleFormat,
data_callback: D,
error_callback: E
) -> Result<<Device as DeviceTrait>::Stream, BuildStreamError> where
D: FnMut(&mut Data, &OutputCallbackInfo) + Send + 'static,
E: FnMut(StreamError) + Send + 'static,