arduino-audio-tools
Loading...
Searching...
No Matches
USBAudioConfig.h
1#pragma once
2#include "stdint.h"
3#include "AudioTools/CoreAudio/AudioTypes.h"
4
5
6namespace audio_tools {
7
8
9
10#ifdef STANDALONE_USB
19struct USBAudioConfig {
20 uint32_t sample_rate = 44100; // Default sample rate
21 uint8_t channels = 2; // Default number of channels
22 uint8_t bits_per_sample = 16; // Default bits per sample
23#else
30struct USBAudioConfig : public AudioInfo {
31#endif
32 uint8_t entity_id_input_terminal = 1;
33 uint8_t entity_id_feature_unit = 2;
34 uint8_t entity_id_output_terminal = 3;
35
36 uint8_t ep_in = 0x81; // IN endpoint address (default 0x81)
37 uint8_t ep_out = 0x01; // OUT endpoint address (default 0x01)
38 uint16_t ep_in_size = 256;
39 uint16_t ep_out_size = 256;
40 //uint8_t interface_num = 1; // Audio streaming interface number
41 // Moved feature flags and buffer sizes:
42 bool enable_ep_in = true;
43 bool enable_ep_out = true;
44 bool enable_feedback_ep = false;
45 bool enable_ep_in_flow_control = false;
46 bool enable_interrupt_ep = false;
47 bool enable_fifo_mutex = false;
48 bool use_linear_buffer_rx = false;
49 bool use_linear_buffer_tx = false;
50 int audio_count = 1; // Number of audio functions (ex CFG_TUD_AUDIO)
51 int ctrl_buf_size_per_func = 64; // Control buffer size per function
52 int ep_in_buf_size_per_func = 256; // IN endpoint buffer size per function
53 int ep_out_buf_size_per_func = 256; // OUT endpoint buffer size per function
54 int lin_buf_in_size_per_func = 512; // Linear buffer size for IN
55
56 int audio_functions_count() const {
57 int count = 0;
58 if (enable_ep_in) count++;
59 if (enable_ep_out) count++;
60 return audio_count;
61 }
62};
63
64} // namespace audio_tools
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition AudioCodecsBase.h:10
Basic Audio information which drives e.g. I2S.
Definition AudioTypes.h:55
sample_rate_t sample_rate
Sample Rate: e.g 44100.
Definition AudioTypes.h:57
uint16_t channels
Number of channels: 2=stereo, 1=mono.
Definition AudioTypes.h:59
uint8_t bits_per_sample
Number of bits per sample (int16_t = 16 bits)
Definition AudioTypes.h:61
Configuration structure for USB Audio, inheriting from AudioInfo.
Definition USBAudioConfig.h:30