Coder Social home page Coder Social logo

usbd-audio's Introduction

usbd-audio

Crates.io docs.rs

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.

usbd-audio's People

Contributors

josefutbult avatar kiffie avatar nilclass avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

usbd-audio's Issues

Only every second frame arrives

Hi Stephan. I've been trying out the Audio Class implementation for a while now, and have run into a problem I cant seem to figure out. My devboard only seems to receive every second frame from the host. I have tried with both USB FS and HS boards, but the problem still remains. Every interrupt only occurs once every 2 ms, and the data is only present every 2 ms to. I checked with wireshark on the host, and it says that every frame is transmitted correctly and gets reported as transmitted correctly.

Have you had any similar issue? Thanks in advance.

Synchronization

Hello again Stephen.

I'm trying to figure out if it's possible to implement an asynchronous feedback channel for synchronizing the host and device clocks, but I have a hard time figuring out how creation of new endpoints and descriptors should work. I'm trying to follow the USB audio class specification, but I can't figure out how it should be translated to code. What material did you follow when you wrote the crate? Do you have any experience in this?

Thanks a lot, and sorry if I'm comming of as a bit intensive.

Cannot include usbd-audio as crate in cargo manifest

When I try to include the usbd-audio crate in my Cargo.toml, rust-analyzer starts to use 100% of my CPU and never finds any metadata.

My current rust setup:

$ rustc --version
$ rustc 1.64.0 (a55dd71d5 2022-09-19)

I use the rust-analyzer in the most recent release from the VS Code marketplace: rust-analyzer version: 0.3.1277-standalone

I want to use your library in a somewhat big project, where I already included a dozen crates without a problem. Any clue, on what it might be?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.