arduino-audio-tools
Loading...
Searching...
No Matches
AudioToolsConfig.h
1
7#pragma once
8
9#define AUDIOTOOLS_VERSION "1.1.3"
10#define AUDIOTOOLS_MAJOR_VERSION 1
11#define AUDIOTOOLS_MINOR_VERSION 1
12
13// Setup for desktop builds
14#include "AudioTools/PlatformConfig/desktop.h"
15
16// Some top level functions: stop(), checkMemory()
17#include "AudioTools/CoreAudio/AudioRuntime.h"
18
19// If you don't want to use all the settings from here you can define your own local config settings in AudioConfigLocal.h
20#if __has_include("AudioConfigLocal.h")
21#include "AudioConfigLocal.h"
22#endif
23
24// Automatically include all core audio functionality
25#ifndef AUDIO_INCLUDE_CORE
26# define AUDIO_INCLUDE_CORE true
27#endif
28
29// Use fixed point multiplication instead float for VolumeStream for slightly better performance on platforms without float hardware. Tested on RP2040 at 16 bit per second (still too slow for 32bit)
30#ifndef PREFER_FIXEDPOINT
31# define PREFER_FIXEDPOINT false
32#endif
33
34// Add automatic using namespace audio_tools;
35#ifndef USE_AUDIOTOOLS_NS
36# define USE_AUDIOTOOLS_NS true
37#endif
38
47#ifndef USE_AUDIO_LOGGING
48# define USE_AUDIO_LOGGING true
49#endif
50
51#ifndef LOG_LEVEL
52# define LOG_LEVEL AudioLogger::Warning
53#endif
54
55#ifndef LOG_STREAM
56# define LOG_STREAM Serial
57#endif
58
59#ifndef LOG_PRINTF_BUFFER_SIZE
60# define LOG_PRINTF_BUFFER_SIZE 303
61#endif
62
63#ifndef LOG_METHOD
64# define LOG_METHOD __PRETTY_FUNCTION__
65#endif
66
67// cheange USE_CHECK_MEMORY to true to activate memory checks
68#ifndef USE_CHECK_MEMORY
69# define USE_CHECK_MEMORY false
70#endif
71
72// Activate/deactivate obsolete functionality
73#ifndef USE_OBSOLETE
74# define USE_OBSOLETE false
75#endif
76
81#ifndef DEFAULT_BUFFER_SIZE
82# define DEFAULT_BUFFER_SIZE 1024
83#endif
84
85#ifndef DEFAULT_SAMPLE_RATE
86# define DEFAULT_SAMPLE_RATE 44100
87#endif
88
89#ifndef DEFAULT_CHANNELS
90# define DEFAULT_CHANNELS 2
91#endif
92
93#ifndef DEFAULT_BITS_PER_SAMPLE
94# define DEFAULT_BITS_PER_SAMPLE 16
95#endif
96
97#ifndef I2S_DEFAULT_PORT
98# define I2S_DEFAULT_PORT 0
99#endif
100
101#ifndef I2S_BUFFER_SIZE
102# define I2S_BUFFER_SIZE 512
103#endif
104
105#ifndef I2S_BUFFER_COUNT
106# define I2S_BUFFER_COUNT 6 // 20
107#endif
108
109#ifndef ANALOG_BUFFER_SIZE
110# define ANALOG_BUFFER_SIZE 512
111#endif
112
113#ifndef ANALOG_BUFFER_COUNT
114# define ANALOG_BUFFER_COUNT 6 // 20
115#endif
116
117#ifndef A2DP_BUFFER_SIZE
118# define A2DP_BUFFER_SIZE 512
119#endif
120
121#ifndef A2DP_BUFFER_COUNT
122# define A2DP_BUFFER_COUNT 30
123#endif
124
125#ifndef CODEC_DELAY_MS
126# define CODEC_DELAY_MS 10
127#endif
128
129#ifndef COPY_DELAY_ON_NODATA
130# define COPY_DELAY_ON_NODATA 10
131#endif
132
133#ifndef COPY_RETRY_LIMIT
134# define COPY_RETRY_LIMIT 20
135#endif
136
137#ifndef MAX_SINGLE_CHARS
138# define MAX_SINGLE_CHARS 8
139#endif
140
141// max size of http processing buffer
142#ifndef HTTP_MAX_LEN
143# define HTTP_MAX_LEN 1024
144#endif
145
146// max size of chunked size line
147#ifndef HTTP_CHUNKED_SIZE_MAX_LEN
148# define HTTP_CHUNKED_SIZE_MAX_LEN 80
149#endif
150
151
152#ifndef USE_RESAMPLE_BUFFER
153# define USE_RESAMPLE_BUFFER true
154#endif
155
159#ifndef PWM_BUFFER_SIZE
160# define PWM_BUFFER_SIZE 1024
161#endif
162
163#ifndef PWM_BUFFER_COUNT
164# define PWM_BUFFER_COUNT 4
165#endif
166
167#ifndef PWM_AUDIO_FREQUENCY
168# define PWM_AUDIO_FREQUENCY 30000
169#endif
170
171// Activate Networking for All Processors
172// #define USE_ETHERNET
173// #define USE_AUDIO_SERVER
174// #define USE_URL_ARDUINO
175
181 #ifdef ESP32
182 # include "AudioTools/PlatformConfig/esp32.h"
183 #endif
184
185//----- ESP8266 -----------
186#ifdef ESP8266
187# include "AudioTools/PlatformConfig/esp8266.h"
188#endif
189
190//------ nRF52840: e.g. NANO33BLE ----------
191#if (defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) || defined(ARDUINO_ARDUINO_NANO33BLE) ) && !defined(ARDUINO_ARCH_ZEPHYR)
192# include "AudioTools/PlatformConfig/nrf52840.h"
193#endif
194
195//----- RP2040 MBED -----------
196#if defined(ARDUINO_ARCH_MBED_RP2040)
197// install https://github.com/pschatzmann/rp2040-i2s
198# include "AudioTools/PlatformConfig/rp2040mbed.h"
199#endif
200
201//----- RP2040 -----------
202#if defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED)
203# include "AudioTools/PlatformConfig/rp2040hower.h"
204#endif
205
206//----- AVR -----------
207#ifdef __AVR__
208# include "AudioTools/PlatformConfig/avr.h"
209#endif
210
211//---- STM32 ------------
212#if defined(ARDUINO_ARCH_STM32) || defined(STM32)
213# include "AudioTools/PlatformConfig/stm32.h"
214#endif
215
216//---- SAMD ------------
217#ifdef ARDUINO_ARCH_SAMD
218# include "AudioTools/PlatformConfig/samd.h"
219#endif
220
221//---- GIGA ------------
222// DRAFT: Not tested !
223#if defined(ARDUINO_GIGA)
224# include "AudioTools/PlatformConfig/giga.h"
225#endif
226
227//---- Portenta ------------
228// DRAFT: not tested
229#if defined(ARDUINO_ARCH_MBED_PORTENTA)
230# include "AudioTools/PlatformConfig/portenta.h"
231#endif
232
233//------ RENESAS ----------
234// Arduino UNO R4
235#if defined(ARDUINO_ARCH_RENESAS) || defined(_RENESAS_RA_)
236# include "AudioTools/PlatformConfig/unor4.h"
237#endif
238
239// ------ Zephyr -------
240#ifdef ARDUINO_ARCH_ZEPHYR
241#endif
242
243//------ VS1053 ----------
244// see https://github.com/pschatzmann/arduino-vs1053/wiki/Pinouts-for-Processors-and-Tested-Boards#microcontrollers
245// Default Pins for VS1053
246#ifndef VS1053_DEFINED
247# define VS1053_CS 5
248# define VS1053_DCS 16
249# define VS1053_DREQ 4
250# define VS1053_RESET 15
251# define VS1053_CS_SD -1
252#endif
253
254// use 0 for https://github.com/baldram/ESP_VS1053_Library
255// use 1 for https://github.com/pschatzmann/arduino-vs1053
256#define VS1053_EXT 1
257#define VS1053_DEFAULT_VOLUME 0.7
258
259
260//----------------
261// Fallback defined if nothing was defined in the platform
262
263#ifndef ARDUINO
264# define USE_STREAM_WRITE_OVERRIDE
265#endif
266
267#ifndef ANALOG_MAX_SAMPLE_RATE
268# define ANALOG_MAX_SAMPLE_RATE 44100
269#endif
270
271#ifndef PWM_MAX_SAMPLE_RATE
272# define PWM_MAX_SAMPLE_RATE 8000
273#endif
274
275#ifndef URL_CLIENT_TIMEOUT
276# define URL_CLIENT_TIMEOUT 60000;
277# define URL_HANDSHAKE_TIMEOUT 120000
278#endif
279
280#ifndef USE_TASK
281# define USE_TASK false
282#endif
283
284#ifndef USE_SERVER_ACCEPT
285# define USE_SERVER_ACCEPT false
286#endif
287
288#ifndef USE_ALLOCATOR
289# define USE_ALLOCATOR false
290#endif
291
292#ifndef USE_ESP32_LOGGER
293# define USE_ESP32_LOGGER false
294#endif
295
296// Standard Arduino Print provides flush function
297#ifndef USE_PRINT_FLUSH
298# define USE_PRINT_FLUSH true
299#endif
300
301#ifndef ESP_IDF_VERSION_VAL
302# define ESP_IDF_VERSION_VAL(a, b , c) 0
303#endif
304
305#if USE_CHECK_MEMORY
306# define CHECK_MEMORY() checkMemory(true)
307#else
308# define CHECK_MEMORY()
309#endif
310
311#pragma GCC diagnostic ignored "-Wunused-variable"
312#pragma GCC diagnostic ignored "-Wunused-function"
313#pragma GCC diagnostic ignored "-Wvla"
314#pragma GCC diagnostic ignored "-Wsign-compare"
315#pragma GCC diagnostic ignored "-Woverloaded-virtual"
316#pragma GCC diagnostic ignored "-Wdouble-promotion"
317
318#ifdef USE_NO_MEMACCESS
319#pragma GCC diagnostic ignored "-Wclass-memaccess"
320#endif
321
322#ifdef USE_INITIALIZER_LIST
323#pragma GCC diagnostic ignored "-Wnarrowing"
324#endif
325
326#undef rewind
327
328// select int24 implementation
329#include "AudioTools/CoreAudio/AudioBasic/Int24_3bytes_t.h"
330#include "AudioTools/CoreAudio/AudioBasic/Int24_4bytes_t.h"
331#include "AudioTools/CoreAudio/AudioBasic/FloatAudio.h"
332
333namespace audio_tools {
334 #ifdef USE_3BYTE_INT24
335 using int24_t = audio_tools::int24_3bytes_t;
336 #else
337 using int24_t = audio_tools::int24_4bytes_t;
338 #endif
339}
340
346#if USE_AUDIOTOOLS_NS
347using namespace audio_tools;
348#endif
349
24bit integer which is used for I2S sound processing. The values are really using 3 bytes....
Definition Int24_3bytes_t.h:16
24bit integer which is used for I2S sound processing. The values are represented as int32_t,...
Definition Int24_4bytes_t.h:16
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition AudioCodecsBase.h:10