usb_audio USBSpeaker class & enabled on nordic#11062
Conversation
|
Is the best way to handle the ones that overflowed from nordic port to add the config disabling them individually to their mpconfigboard.mk files? Or is there some higher level switch that exists already or we could create that would allow turning off the swath of them at once? |
|
The latest commit limits this to only nrf52840 and boards with external flash. That looks to have resolved all of the overflowing ones. Thanks for the tip @dhalbert. |
There was a problem hiding this comment.
Now that you've added USBSpeaker, I'm wondering about the API. If you look at usb_midi, you see that usb_midi.enable() is just on/off. The PortIn and PortOut objects are not constructable, but are just available as pre-created singletons.
In the current usb_audio API, what would happen if you tried to create more than one USBSpeaker or USBMicrophone? I would think it would or should fail.
I'm thinking maybe USBSpeaker and USBMicrophone should also be fetchable singletons (or None) as in usb_midi, and not actually constructable.
The usb_audio.enable() call is somewhat confusing because the direction parameter doesn't relate directly to speakr or microphone. Suppose instead it were something like usb_audio.enable(speaker=True/False, microcphone=True/False, ... <other current optional params)?
…one args for enable() instead of Direction enum
|
The latest commits change
|
dhalbert
left a comment
There was a problem hiding this comment.
Make the instance names be usb_microphone and usb_speaker, instead of the being the class names. Expose the class names but forbid user-initiated creation. This is analogous to _bleio.Adapter vs _bleio.adapter, and microcontroller.Processor vs microcontroller.cpu, and you could take the coding patterns from there.
|
singletons are renamed to |
dhalbert
left a comment
There was a problem hiding this comment.
Thanks for the fix to the speaker example., Works nicely for me! This pair of this is a very nice addition!
Added
USBSpeakerimplementation that can take audio from a computer over USB and integrate with existing audio APIs. You can apply effects withaudiospeedand similar modules, and ultimately pipe it to an output source like I2SOutI also tested USBMicrophone on RP2350, nrf52840, and samd51 successfully. Right now this PR enables
usb_audiofor the nordic port which required a few changes to handle the way isosyncronous endpoints are handled under nordic. I've left it disabled on atmel port for now, I had to disable some other things to make room for it and I think there will be a fair number of boards that will overflow.