arduino-audio-tools
Loading...
Searching...
No Matches
AudioToolsConfig.h
Go to the documentation of this file.
1
7#pragma once
8
9#define AUDIOTOOLS_VERSION "1.2.3"
10#define AUDIOTOOLS_MAJOR_VERSION 1
11#define AUDIOTOOLS_MINOR_VERSION 2
12
13// Setup for desktop builds
15
16// Some top level functions: stop(), checkMemory()
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// ICY Metadata
172#ifndef AUDIOTOOLS_METADATA_ICY_ASCII_ONLY
173#define AUDIOTOOLS_METADATA_ICY_ASCII_ONLY true
174#endif
175
176#ifndef AUDIOTOOLS_METADATA_ICY_LIMIT
177#define AUDIOTOOLS_METADATA_ICY_LIMIT 400
178#endif
179
180
181// Activate Networking for All Processors
182// #define USE_ETHERNET
183// #define USE_AUDIO_SERVER
184// #define USE_URL_ARDUINO
185
191 #ifdef ESP32
193 #endif
194
195//----- ESP8266 -----------
196#ifdef ESP8266
198#endif
199
200//------ nRF52840: e.g. NANO33BLE ----------
201#if (defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) || defined(ARDUINO_ARDUINO_NANO33BLE) ) && !defined(ARDUINO_ARCH_ZEPHYR)
203#endif
204
205//----- RP2040 MBED -----------
206#if defined(ARDUINO_ARCH_MBED_RP2040)
207// install https://github.com/pschatzmann/rp2040-i2s
209#endif
210
211//----- RP2040 -----------
212#if defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED)
214#endif
215
216//----- AVR -----------
217#ifdef __AVR__
219#endif
220
221//---- STM32 ------------
222#if defined(ARDUINO_ARCH_STM32) || defined(STM32)
224#endif
225
226//---- SAMD ------------
227#ifdef ARDUINO_ARCH_SAMD
229#endif
230
231//---- GIGA ------------
232// DRAFT: Not tested !
233#if defined(ARDUINO_GIGA)
235#endif
236
237//---- Portenta ------------
238// DRAFT: not tested
239#if defined(ARDUINO_ARCH_MBED_PORTENTA)
241#endif
242
243//------ RENESAS ----------
244// Arduino UNO R4
245#if defined(ARDUINO_ARCH_RENESAS) || defined(_RENESAS_RA_)
247#endif
248
249// ------ Zephyr -------
250#ifdef ARDUINO_ARCH_ZEPHYR
251#endif
252
253//------ VS1053 ----------
254// see https://github.com/pschatzmann/arduino-vs1053/wiki/Pinouts-for-Processors-and-Tested-Boards#microcontrollers
255// Default Pins for VS1053
256#ifndef VS1053_DEFINED
257# define VS1053_CS 5
258# define VS1053_DCS 16
259# define VS1053_DREQ 4
260# define VS1053_RESET 15
261# define VS1053_CS_SD -1
262#endif
263
264// use 0 for https://github.com/baldram/ESP_VS1053_Library
265// use 1 for https://github.com/pschatzmann/arduino-vs1053
266#define VS1053_EXT 1
267#define VS1053_DEFAULT_VOLUME 0.7
268
269
270//----------------
271// Fallback defined if nothing was defined in the platform
272
273#ifndef ARDUINO
274# define USE_STREAM_WRITE_OVERRIDE
275#endif
276
277#ifndef ANALOG_MAX_SAMPLE_RATE
278# define ANALOG_MAX_SAMPLE_RATE 44100
279#endif
280
281#ifndef PWM_MAX_SAMPLE_RATE
282# define PWM_MAX_SAMPLE_RATE 8000
283#endif
284
285#ifndef URL_CLIENT_TIMEOUT
286# define URL_CLIENT_TIMEOUT 60000;
287#endif
288
289
290#ifndef URL_HANDSHAKE_TIMEOUT
291# define URL_HANDSHAKE_TIMEOUT 120000
292#endif
293
294#ifndef USE_TASK
295# define USE_TASK false
296#endif
297
298#ifndef USE_SERVER_ACCEPT
299# define USE_SERVER_ACCEPT false
300#endif
301
302#ifndef USE_ALLOCATOR
303# define USE_ALLOCATOR false
304#endif
305
306#ifndef USE_ESP32_LOGGER
307# define USE_ESP32_LOGGER false
308#endif
309
310// Standard Arduino Print provides flush function
311#ifndef USE_PRINT_FLUSH
312# define USE_PRINT_FLUSH true
313#endif
314
315#ifndef ESP_IDF_VERSION_VAL
316# define ESP_IDF_VERSION_VAL(a, b , c) 0
317#endif
318
319#if USE_CHECK_MEMORY
320# define CHECK_MEMORY() checkMemory(true)
321#else
322# define CHECK_MEMORY()
323#endif
324
325#pragma GCC diagnostic ignored "-Wunused-variable"
326#pragma GCC diagnostic ignored "-Wunused-function"
327#pragma GCC diagnostic ignored "-Wvla"
328#pragma GCC diagnostic ignored "-Wsign-compare"
329#pragma GCC diagnostic ignored "-Woverloaded-virtual"
330#pragma GCC diagnostic ignored "-Wdouble-promotion"
331
332#ifdef USE_NO_MEMACCESS
333#pragma GCC diagnostic ignored "-Wclass-memaccess"
334#endif
335
336#ifdef USE_INITIALIZER_LIST
337#pragma GCC diagnostic ignored "-Wnarrowing"
338#endif
339
340#undef rewind
341
342// select int24 implementation
346
347namespace audio_tools {
348 #ifdef USE_3BYTE_INT24
350 #else
352 #endif
353}
354
360#if USE_AUDIOTOOLS_NS
361using namespace audio_tools;
362#endif
363
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
audio_tools::int24_4bytes_t int24_t
Definition AudioToolsConfig.h:351