Configuration for USB Audio (inherits sample_rate / channels / bits_per_sample from AudioInfo).
More...
#include <USBAudioConfig.h>
Configuration for USB Audio (inherits sample_rate / channels / bits_per_sample from AudioInfo).
◆ clear()
◆ copyFrom()
◆ equals()
Returns true if alt values are the same like the current values.
◆ equalsExSampleRate()
Checks if only the sample rate is different.
◆ logInfo()
| virtual void logInfo |
( |
const char * |
source = "" | ) |
|
|
inlinevirtualinherited |
◆ operator bool()
Returns true if all components are defined (no component is 0)
◆ operator!=() [1/2]
Returns true if alt values are the different from the current values.
◆ operator!=() [2/2]
◆ operator==() [1/2]
Returns true if alt values are the same like the current values.
◆ operator==() [2/2]
◆ set()
Copies the values from info.
◆ setAudioInfo()
◆ begin_usb
When true (default), beginUSB() calls USB.begin() automatically. Set to false for composite USB (e.g. Audio + CDC): register all interfaces first, then call USB.begin() yourself.
◆ bits_per_sample
Number of bits per sample (int16_t = 16 bits)
◆ channels
Number of channels: 2=stereo, 1=mono.
◆ enable_ep_in
device → host (capture / microphone)
◆ enable_ep_in_flow_control
| bool enable_ep_in_flow_control = true |
Enable UAC2 IN-endpoint flow control: vary the per-frame isochronous packet size so non-integer sample-per-frame rates are delivered at the exact average rate. Without it the device sends a fixed (rounded-up) packet every frame, which makes e.g. 44100 Hz run at 45000 Hz effective (45 samples/ms instead of the required 44.1 average).
◆ enable_ep_out
| bool enable_ep_out = true |
host → device (playback / speaker)
◆ enable_feedback_ep
| bool enable_feedback_ep = true |
Enable isochronous feedback endpoint so the host can adjust its clock.
◆ enable_interrupt_ep
| bool enable_interrupt_ep = false |
Enable the AC interrupt IN endpoint for device-initiated volume, mute, and sample-rate change notifications. Without it the host must poll via GET_CUR; the controls might still work, just without push updates.
◆ enable_multi_sample_rate
| bool enable_multi_sample_rate = false |
When false (default): the clock source is fixed at sample_rate. The descriptor reports an internal fixed clock, and GET_RANGE returns only the configured rate. This avoids complex host negotiation. When true: the clock source is programmable and GET_RANGE returns 14 discrete rates (8 kHz – 192 kHz). The host can change the rate via SET_CUR, and the descriptor wMaxPacketSize covers 192 kHz.
◆ ep_fb
ISO IN (explicit feedback, RX-only mode)
◆ ep_in
ISO IN (device → host, capture/microphone)
Addresses must not conflict with other USB interfaces (e.g. CDC uses 0x81, 0x82, 0x02). The defaults below (overridable per-platform via the USB_AUDIO_EP_* build flags, see top of this file) are safe for CDC + Audio composite devices on most MCUs. Signed so a negative value (the -1 default on platforms without a fixed hardware endpoint) can be told apart from a real address: USBAudioDeviceTinyUSB treats < 0 as "allocate dynamically" and any value you set >= 0 (including these defaults) as a pinned address.
◆ ep_int
INT IN (AC status/change notifications)
◆ ep_out
ISO OUT (host → device, playback/speaker)
◆ fifo_packets
| uint8_t fifo_packets = 32 |
Depth of the audio FIFO expressed as a number of 1 ms packets. Larger values reduce the risk of underrun/overrun at the cost of latency. 32 packets (~32 ms at 44.1 kHz stereo 16-bit, ~6 kB RAM) is the minimum reliable value for RP2040 at 133 MHz: the I2S DMA write can block for 2-3 ms, and 16 packets leave no margin for those stalls.
◆ itf_num_ac
Interface number of the Audio Control interface. Increment when other USB functions (CDC, HID …) occupy lower numbers.
◆ manufacturer
| const char* manufacturer = "Audio Tools" |
◆ max_power_ma
| uint8_t max_power_ma = 100 |
◆ pid
◆ product
| const char* product = "USB Audio" |
◆ sample_rate
◆ self_powered
◆ serial
| const char* serial = "000001" |
◆ terminal_id
Terminal ID reported to Zephyr usbd_uac2 callbacks (ignored on TinyUSB). TX_MODE: Output Terminal ID (device → host, ISO IN). RX_MODE: Input Terminal ID (host → device, ISO OUT). Must match the UAC2 node topology in the board device tree.
◆ use_linear_buffer_rx
| bool use_linear_buffer_rx = true |
Use a flat contiguous buffer for RX instead of a circular FIFO. Required when the downstream audio driver uses DMA.
◆ use_linear_buffer_tx
| bool use_linear_buffer_tx = true |
Use a flat contiguous buffer for TX instead of a circular FIFO. Required when the upstream audio driver uses DMA.
◆ vid
◆ volume_active
| bool volume_active = false |
When true we will process the volume and mute settings in the audio stream. When false we will not process the volume and mute settings but just provide the data for external processing.
The documentation for this struct was generated from the following file: