arduino-audio-tools
Loading...
Searching...
No Matches
AudioToolsConfig.h
Go to the documentation of this file.
1
7#pragma once
8
9// Prevent warnings
10#pragma GCC diagnostic ignored "-Wunused-variable"
11#pragma GCC diagnostic ignored "-Wunused-function"
12#pragma GCC diagnostic ignored "-Wvla"
13#pragma GCC diagnostic ignored "-Wsign-compare"
14#pragma GCC diagnostic ignored "-Woverloaded-virtual"
15#pragma GCC diagnostic ignored "-Wdouble-promotion"
16
17#define AUDIOTOOLS_VERSION "1.2.4"
18#define AUDIOTOOLS_MAJOR_VERSION 1
19#define AUDIOTOOLS_MINOR_VERSION 2
20
21// Prevent compile errors for rewind function on some platforms
22#undef rewind
23// fix compile error for ESP32 C3
24#undef HZ
25
26// Setup for desktop builds
28
29// If you don't want to use all the settings from here you can define your own local config settings in AudioConfigLocal.h
30#if __has_include("AudioConfigLocal.h")
31#include "AudioConfigLocal.h"
32#endif
33
34// Automatically include all core audio functionality
35#ifndef AUDIO_INCLUDE_CORE
36# define AUDIO_INCLUDE_CORE true
37#endif
38
39// 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)
40#ifndef PREFER_FIXEDPOINT
41# define PREFER_FIXEDPOINT false
42#endif
43
44// Add automatic using namespace audio_tools;
45#ifndef USE_AUDIOTOOLS_NS
46# define USE_AUDIOTOOLS_NS true
47#endif
48
57#ifndef USE_AUDIO_LOGGING
58# define USE_AUDIO_LOGGING true
59#endif
60
61#ifndef LOG_LEVEL
62# define LOG_LEVEL AudioLogger::Warning
63#endif
64
65#ifndef LOG_STREAM
66# define LOG_STREAM Serial
67#endif
68
69#ifndef LOG_PRINTF_BUFFER_SIZE
70# define LOG_PRINTF_BUFFER_SIZE 303
71#endif
72
73#ifndef LOG_METHOD
74# define LOG_METHOD __PRETTY_FUNCTION__
75#endif
76
77// cheange USE_CHECK_MEMORY to true to activate memory checks
78#ifndef USE_CHECK_MEMORY
79# define USE_CHECK_MEMORY false
80#endif
81
82// Activate/deactivate obsolete functionality
83#ifndef USE_OBSOLETE
84# define USE_OBSOLETE false
85#endif
86
91#ifndef DEFAULT_BUFFER_SIZE
92# define DEFAULT_BUFFER_SIZE 1024
93#endif
94
95#ifndef DEFAULT_SAMPLE_RATE
96# define DEFAULT_SAMPLE_RATE 44100
97#endif
98
99#ifndef DEFAULT_CHANNELS
100# define DEFAULT_CHANNELS 2
101#endif
102
103#ifndef DEFAULT_BITS_PER_SAMPLE
104# define DEFAULT_BITS_PER_SAMPLE 16
105#endif
106
107#ifndef I2S_DEFAULT_PORT
108# define I2S_DEFAULT_PORT 0
109#endif
110
111#ifndef I2S_BUFFER_SIZE
112# define I2S_BUFFER_SIZE 512
113#endif
114
115#ifndef I2S_BUFFER_COUNT
116# define I2S_BUFFER_COUNT 6 // 20
117#endif
118
119#ifndef ANALOG_BUFFER_SIZE
120# define ANALOG_BUFFER_SIZE 512
121#endif
122
123#ifndef ANALOG_BUFFER_COUNT
124# define ANALOG_BUFFER_COUNT 6 // 20
125#endif
126
127#ifndef A2DP_BUFFER_SIZE
128# define A2DP_BUFFER_SIZE 512
129#endif
130
131#ifndef A2DP_BUFFER_COUNT
132# define A2DP_BUFFER_COUNT 30
133#endif
134
135#ifndef CODEC_DELAY_MS
136# define CODEC_DELAY_MS 10
137#endif
138
139#ifndef COPY_DELAY_ON_NODATA
140# define COPY_DELAY_ON_NODATA 10
141#endif
142
143#ifndef COPY_RETRY_LIMIT
144# define COPY_RETRY_LIMIT 20
145#endif
146
147#ifndef MAX_SINGLE_CHARS
148# define MAX_SINGLE_CHARS 8
149#endif
150
151// max size of http processing buffer
152#ifndef HTTP_MAX_LEN
153# define HTTP_MAX_LEN 1024
154#endif
155
156// max size of chunked size line
157#ifndef HTTP_CHUNKED_SIZE_MAX_LEN
158# define HTTP_CHUNKED_SIZE_MAX_LEN 80
159#endif
160
161
162#ifndef USE_RESAMPLE_BUFFER
163# define USE_RESAMPLE_BUFFER true
164#endif
165
169#ifndef PWM_BUFFER_SIZE
170# define PWM_BUFFER_SIZE 1024
171#endif
172
173#ifndef PWM_BUFFER_COUNT
174# define PWM_BUFFER_COUNT 4
175#endif
176
177#ifndef PWM_AUDIO_FREQUENCY
178# define PWM_AUDIO_FREQUENCY 30000
179#endif
180
181// ICY Metadata
182#ifndef AUDIOTOOLS_METADATA_ICY_ASCII_ONLY
183#define AUDIOTOOLS_METADATA_ICY_ASCII_ONLY true
184#endif
185
186#ifndef AUDIOTOOLS_METADATA_ICY_LIMIT
187#define AUDIOTOOLS_METADATA_ICY_LIMIT 400
188#endif
189
190
191// Activate Networking for All Processors
192// #define USE_ETHERNET
193// #define USE_AUDIO_SERVER
194// #define USE_URL_ARDUINO
195
200#ifdef ARDUINO
201# include "Arduino.h"
202#endif
203
204
205#ifdef ESP32
207#endif
208
209//----- ESP8266 -----------
210#ifdef ESP8266
212#endif
213
214//------ nRF52840: e.g. NANO33BLE ----------
215#if (defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) || defined(ARDUINO_ARDUINO_NANO33BLE) ) && !defined(ARDUINO_ARCH_ZEPHYR)
217#endif
218
219//----- RP2040 MBED -----------
220#if defined(ARDUINO_ARCH_MBED_RP2040)
221// install https://github.com/pschatzmann/rp2040-i2s
223#endif
224
225//----- RP2040 -----------
226#if defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED)
228#endif
229
230//----- AVR -----------
231#ifdef __AVR__
233#endif
234
235//---- STM32 ------------
236#if defined(ARDUINO_ARCH_STM32) || defined(STM32)
238#endif
239
240//---- SAMD ------------
241#ifdef ARDUINO_ARCH_SAMD
243#endif
244
245//---- GIGA ------------
246// DRAFT: Not tested !
247#if defined(ARDUINO_GIGA)
249#endif
250
251//---- Portenta ------------
252// DRAFT: not tested
253#if defined(ARDUINO_ARCH_MBED_PORTENTA)
255#endif
256
257//------ RENESAS ----------
258// Arduino UNO R4
259#if defined(ARDUINO_ARCH_RENESAS) || defined(_RENESAS_RA_)
261#endif
262
263// ------ Zephyr -------
264#ifdef __ZEPHYR__
265#include <zephyr/kernel.h>
266#include <zephyr/sys/util.h>
268#endif
269
270//------ VS1053 ----------
271// see https://github.com/pschatzmann/arduino-vs1053/wiki/Pinouts-for-Processors-and-Tested-Boards#microcontrollers
272// Default Pins for VS1053
273#ifndef VS1053_DEFINED
274# define VS1053_CS 5
275# define VS1053_DCS 16
276# define VS1053_DREQ 4
277# define VS1053_RESET 15
278# define VS1053_CS_SD -1
279#endif
280
281// use 0 for https://github.com/baldram/ESP_VS1053_Library
282// use 1 for https://github.com/pschatzmann/arduino-vs1053
283#define VS1053_EXT 1
284#define VS1053_DEFAULT_VOLUME 0.7
285
286
287//----------------
288// Fallback defined if nothing was defined in the platform
289
290#ifndef ARDUINO
291# define USE_STREAM_WRITE_OVERRIDE
292#endif
293
294#ifndef ANALOG_MAX_SAMPLE_RATE
295# define ANALOG_MAX_SAMPLE_RATE 44100
296#endif
297
298#ifndef PWM_MAX_SAMPLE_RATE
299# define PWM_MAX_SAMPLE_RATE 8000
300#endif
301
302#ifndef URL_CLIENT_TIMEOUT
303# define URL_CLIENT_TIMEOUT 60000;
304#endif
305
306#ifndef URL_HANDSHAKE_TIMEOUT
307# define URL_HANDSHAKE_TIMEOUT 120000
308#endif
309
310#ifndef USE_TASK
311# define USE_TASK false
312#endif
313
314#ifndef USE_SERVER_ACCEPT
315# define USE_SERVER_ACCEPT false
316#endif
317
318#ifndef USE_ALLOCATOR
319# define USE_ALLOCATOR false
320#endif
321
322#ifndef USE_ESP32_LOGGER
323# define USE_ESP32_LOGGER false
324#endif
325
326// Standard Arduino Print provides flush function
327#ifndef USE_PRINT_FLUSH
328# define USE_PRINT_FLUSH true
329#endif
330
331#ifndef ESP_IDF_VERSION_VAL
332# define ESP_IDF_VERSION_VAL(a, b , c) 0
333#endif
334
335#ifdef USE_NO_MEMACCESS
336#pragma GCC diagnostic ignored "-Wclass-memaccess"
337#endif
338
339#ifdef USE_INITIALIZER_LIST
340#pragma GCC diagnostic ignored "-Wnarrowing"
341#endif
342
343#if USE_CHECK_MEMORY
344# define CHECK_MEMORY() checkMemory(true)
345#else
346# define CHECK_MEMORY()
347#endif
348
349
355#if USE_AUDIOTOOLS_NS
356namespace audio_tools {}
357using namespace audio_tools;
358#endif
359
If you want to use the framework w/o Arduino you need to provide the implementation of a couple of cl...
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition AudioCodecsBase.h:10