uacConfiguration()
Configures the USB Audio Class (UAC) interface for both microphone and speaker functionality.Syntax
Parameters
Microphone Parameters
- mic_ch_num (
uint8_t) - Microphone channel numbers. UseUAC_CH_ANYto accept any channel number. - mic_bit_resolution (
uint16_t) - Microphone bit resolution. UseUAC_BITS_ANYto accept any bit resolution. - mic_samples_frequency (
uint32_t) - Microphone sample frequency in Hz. UseUAC_FREQUENCY_ANYto accept any frequency. - mic_buf_size (
uint32_t) - Microphone receive buffer size. Set to 0 if not using microphone.
Speaker Parameters
- spk_ch_num (
uint8_t) - Speaker channel numbers. UseUAC_CH_ANYto accept any channel number. - spk_bit_resolution (
uint16_t) - Speaker bit resolution. UseUAC_BITS_ANYto accept any bit resolution. - spk_samples_frequency (
uint32_t) - Speaker sample frequency in Hz. UseUAC_FREQUENCY_ANYto accept any frequency. - spk_buf_size (
uint32_t) - Speaker buffer size. Set to 0 if not using speaker.
Audio Format Constants
The library provides these constants for flexible audio format configuration:Examples
Microphone Only Configuration
Speaker Only Configuration
Microphone and Speaker Configuration
Specific Audio Format Configuration
Notes
- Call this method before
start()to configure the UAC interface. - Using
UAC_*_ANYconstants allows the library to automatically negotiate the best audio format with the connected USB host. - The buffer sizes affect latency and memory usage. Larger buffers provide more buffering but use more RAM.
- Set buffer size to 0 for unused audio direction (microphone or speaker) to disable it.
- Valid ranges when specifying exact values:
- Channel numbers: 1-2
- Bit resolution: 8-24 bits
- Sample frequency: 1000-48000 Hz