Crates.io | usbd-audio |
lib.rs | usbd-audio |
version | 0.1.0 |
source | src |
created_at | 2022-01-29 23:13:14.501586 |
updated_at | 2022-01-29 23:13:14.501586 |
description | USB Audio 1.0 class for usb-device |
homepage | |
repository | https://github.com/kiffie/usbd-audio |
max_upload_size | |
id | 523815 |
size | 28,459 |
USB Audio 1.0 class for usb-device
This crate provides a USB audio 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.