Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio class #10

Open
XGudron opened this issue Mar 30, 2019 · 9 comments
Open

Audio class #10

XGudron opened this issue Mar 30, 2019 · 9 comments
Labels
enhancement New feature or request

Comments

@XGudron
Copy link

XGudron commented Mar 30, 2019

Is audio class support planned?

@benedekkupper benedekkupper added the enhancement New feature or request label Mar 30, 2019
@benedekkupper
Copy link
Member

benedekkupper commented Mar 30, 2019

While it would be certainly nice to have, I don't have any projects planned at the moment that would require an Audio class interface, so there is no timeline for it.

Of course there are incentives that could change this, and I don't just mean financial ones, if you are developing a fascinating project I might help you out just for the fun of it.

@XGudron
Copy link
Author

XGudron commented Mar 31, 2019

I am developing a open-source project of DDC/SDR Radio, and I plan to make sound output through USB. Also, now the project has 2 virtual COM ports for debugging output and control from a computer. I tried to make an audio class by analogy with the CDC, but my knowledge is clearly not enough for this.
Can you advise the literature that will help me form the descriptors correctly?

@benedekkupper
Copy link
Member

As far as I have seen, there are two important Audio class documents on the USB implementers forum: the latest official full-blown audio class spec and a simplified spec for the most common use-cases. I'd recommend that you check the latter. You can also get inspiration from other open-source projects, such as Mbed.

As a starting point I recommend that you check how the NCM implementation initializes the endpoints, as the audio class has the same mechanism, namely that the interface-specific endpoints are only opened once the alternate setting is set to the non-default 1. Another thing to bear in mind is that isochronous transfers aren't tested yet, so you might run into problems on the driver level. If that happens, document as much as you can from the circumstances, and open an issue.

@XGudron
Copy link
Author

XGudron commented Apr 1, 2019

Thank you for the information provided!
Descriptors are successfully registered and the device is detected.
But the isochronous transfer does not occur, the data is not transmitted.

class file https://github.com/XGudron/UA3REO-DDC-Transceiver/blob/master/STM32/USBDevice/Class/AUDIO/usbd_audio.c
header file https://github.com/XGudron/UA3REO-DDC-Transceiver/blob/master/STM32/USBDevice/Include/usbd_audio.h

errors on usb sniffer (device to host): https://yadi.sk/i/8UNzux8ygufiig
Host to device transfer on sniffer is OK. But receive buffer is empty.
isochronous interrupts also not work.

@benedekkupper
Copy link
Member

Can you provide a permanent link to the source code? The current links are broken.

@XGudron
Copy link
Author

XGudron commented Apr 9, 2019

@benedekkupper
Copy link
Member

So, the biggest issue with the code is these lines:

USBD_ReturnType ret=USBD_EpReceive(pdev->Base.Device, pdev->Config.InEpNum, haudio->buffer, AUDIO_OUT_PACKET);

The directions in the USB context are observed from the Host point of view, so the IN direction means from Device to Host. To receive data on the device side, you have to use the OUT endpoints. These calls should use the OutEpNum parameter, which should be in the 1..15 range (which is further limited by hardware).

@XGudron
Copy link
Author

XGudron commented Apr 9, 2019

Exactly, thank you! my mistake...

@WardBenjamin
Copy link

I would definitely be interested in using this library if an audio class was added - I'm working on some open-source audio hardware (equalizer, DAC, etc) where having several interfaces would be very useful for debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants