Crate usbd_audio
source · [−]Expand description
USB Audio class
This crate provides a USB device class based on “Universal Serial Bus Device Class Definition for Audio Devices”, Release 1.0 (experimental implementation without the aim of standard compliance).
Since the USB descriptor can be quite large, it may be required to activate the feature
control-buffer-256
of the usb-device
crate.
Example
let mut usb_bus = ... // create a UsbBusAllocator in a platform specific way
let mut usb_audio = AudioClassBuilder::new()
.input(
StreamConfig::new_discrete(
Format::S16le,
1,
&[48000],
TerminalType::InMicrophone).unwrap())
.output(
StreamConfig::new_discrete(
Format::S24le,
2,
&[44100, 48000, 96000],
TerminalType::OutSpeaker).unwrap())
.build(&usb_bus)
.unwrap();
This example creates an audio device having a one channel (Mono) microphone with a fixed sampling frequency of 48 KHz and a two channel (Stereo) speaker output that supports three different sampling rates.
Structs
USB device class for audio devices.
Builder class to create an AudioClass
structure.
Enums
USB audio errors, including possible USB Stack errors
Sampling rates that shall be supported by an steaming endpoint
USB Audio Terminal Types from “Universal Serial Bus Device Class Definition for Terminal Types, Release 1.0”