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// Add automatic using namespace audio_tools;
40#ifndef USE_AUDIOTOOLS_NS
41# define USE_AUDIOTOOLS_NS true
42#endif
43
52#ifndef USE_AUDIO_LOGGING
53# define USE_AUDIO_LOGGING true
54#endif
55
56#ifndef LOG_LEVEL
57# define LOG_LEVEL AudioLogger::Warning
58#endif
59
60#ifndef LOG_STREAM
61# define LOG_STREAM Serial
62#endif
63
64#ifndef LOG_PRINTF_BUFFER_SIZE
65# define LOG_PRINTF_BUFFER_SIZE 303
66#endif
67
68#ifndef LOG_METHOD
69# define LOG_METHOD __PRETTY_FUNCTION__
70#endif
71
72// cheange USE_CHECK_MEMORY to true to activate memory checks
73#ifndef USE_CHECK_MEMORY
74# define USE_CHECK_MEMORY false
75#endif
76
77// Activate/deactivate obsolete functionality
78#ifndef USE_OBSOLETE
79# define USE_OBSOLETE false
80#endif
81
86#ifndef DEFAULT_BUFFER_SIZE
87# define DEFAULT_BUFFER_SIZE 1024
88#endif
89
90#ifndef DEFAULT_SAMPLE_RATE
91# define DEFAULT_SAMPLE_RATE 44100
92#endif
93
94#ifndef DEFAULT_CHANNELS
95# define DEFAULT_CHANNELS 2
96#endif
97
98#ifndef DEFAULT_BITS_PER_SAMPLE
99# define DEFAULT_BITS_PER_SAMPLE 16
100#endif
101
102#ifndef I2S_DEFAULT_PORT
103# define I2S_DEFAULT_PORT 0
104#endif
105
106#ifndef I2S_BUFFER_SIZE
107# define I2S_BUFFER_SIZE 512
108#endif
109
110#ifndef I2S_BUFFER_COUNT
111# define I2S_BUFFER_COUNT 6 // 20
112#endif
113
114#ifndef ANALOG_BUFFER_SIZE
115# define ANALOG_BUFFER_SIZE 512
116#endif
117
118#ifndef ANALOG_BUFFER_COUNT
119# define ANALOG_BUFFER_COUNT 6 // 20
120#endif
121
122#ifndef A2DP_BUFFER_SIZE
123# define A2DP_BUFFER_SIZE 512
124#endif
125
126#ifndef A2DP_BUFFER_COUNT
127# define A2DP_BUFFER_COUNT 30
128#endif
129
130#ifndef CODEC_DELAY_MS
131# define CODEC_DELAY_MS 10
132#endif
133
134#ifndef COPY_DELAY_ON_NODATA
135# define COPY_DELAY_ON_NODATA 10
136#endif
137
138#ifndef COPY_RETRY_LIMIT
139# define COPY_RETRY_LIMIT 20
140#endif
141
142#ifndef MAX_SINGLE_CHARS
143# define MAX_SINGLE_CHARS 8
144#endif
145
146// max size of http processing buffer
147#ifndef HTTP_MAX_LEN
148# define HTTP_MAX_LEN 1024
149#endif
150
151// max size of chunked size line
152#ifndef HTTP_CHUNKED_SIZE_MAX_LEN
153# define HTTP_CHUNKED_SIZE_MAX_LEN 80
154#endif
155
156
157#ifndef USE_RESAMPLE_BUFFER
158# define USE_RESAMPLE_BUFFER true
159#endif
160
164#ifndef PWM_BUFFER_SIZE
165# define PWM_BUFFER_SIZE 1024
166#endif
167
168#ifndef PWM_BUFFER_COUNT
169# define PWM_BUFFER_COUNT 4
170#endif
171
172#ifndef PWM_AUDIO_FREQUENCY
173# define PWM_AUDIO_FREQUENCY 30000
174#endif
175
176// ICY Metadata
177#ifndef AUDIOTOOLS_METADATA_ICY_ASCII_ONLY
178#define AUDIOTOOLS_METADATA_ICY_ASCII_ONLY true
179#endif
180
181#ifndef AUDIOTOOLS_METADATA_ICY_LIMIT
182#define AUDIOTOOLS_METADATA_ICY_LIMIT 400
183#endif
184
185
186// Activate Networking for All Processors
187// #define USE_ETHERNET
188// #define USE_AUDIO_SERVER
189// #define USE_URL_ARDUINO
190
195#ifdef ARDUINO
196# include "Arduino.h"
197#endif
198
199
200#ifdef ESP32
202#endif
203
204//----- ESP8266 -----------
205#ifdef ESP8266
207#endif
208
209//------ nRF52840: e.g. NANO33BLE ----------
210#if (defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) || defined(ARDUINO_ARDUINO_NANO33BLE) ) && !defined(ARDUINO_ARCH_ZEPHYR)
212#endif
213
214//----- RP2040 MBED -----------
215#if defined(ARDUINO_ARCH_MBED_RP2040)
216// install https://github.com/pschatzmann/rp2040-i2s
218#endif
219
220//----- RP2040 -----------
221#if defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED)
223#endif
224
225//----- AVR -----------
226#ifdef __AVR__
228#endif
229
230//---- STM32 ------------
231#if defined(ARDUINO_ARCH_STM32) || defined(STM32)
233#endif
234
235//---- SAMD ------------
236#ifdef ARDUINO_ARCH_SAMD
238#endif
239
240//---- GIGA ------------
241// DRAFT: Not tested !
242#if defined(ARDUINO_GIGA)
244#endif
245
246//---- Portenta ------------
247// DRAFT: not tested
248#if defined(ARDUINO_ARCH_MBED_PORTENTA)
250#endif
251
252//------ RENESAS ----------
253// Arduino UNO R4
254#if defined(ARDUINO_ARCH_RENESAS) || defined(_RENESAS_RA_)
256#endif
257
258//------ Tang Nano 20K ----------
259#if defined(ARDUINO_ARCH_TANGNANO20K)
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// 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)
291#ifndef PREFER_FIXEDPOINT
292# define PREFER_FIXEDPOINT false
293#endif
294
295#ifndef ARDUINO
296# define USE_STREAM_WRITE_OVERRIDE
297#endif
298
299#ifndef ANALOG_MAX_SAMPLE_RATE
300# define ANALOG_MAX_SAMPLE_RATE 44100
301#endif
302
303#ifndef PWM_MAX_SAMPLE_RATE
304# define PWM_MAX_SAMPLE_RATE 8000
305#endif
306
307#ifndef URL_CLIENT_TIMEOUT
308# define URL_CLIENT_TIMEOUT 60000;
309#endif
310
311#ifndef URL_HANDSHAKE_TIMEOUT
312# define URL_HANDSHAKE_TIMEOUT 120000
313#endif
314
315#ifndef USE_TASK
316# define USE_TASK false
317#endif
318
319#ifndef USE_SERVER_ACCEPT
320# define USE_SERVER_ACCEPT false
321#endif
322
323#ifndef USE_ALLOCATOR
324# define USE_ALLOCATOR false
325#endif
326
327#ifndef USE_ESP32_LOGGER
328# define USE_ESP32_LOGGER false
329#endif
330
331// Standard Arduino Print provides flush function
332#ifndef USE_PRINT_FLUSH
333# define USE_PRINT_FLUSH true
334#endif
335
336#ifndef ESP_IDF_VERSION_VAL
337# define ESP_IDF_VERSION_VAL(a, b , c) 0
338#endif
339
340#ifdef USE_NO_MEMACCESS
341#pragma GCC diagnostic ignored "-Wclass-memaccess"
342#endif
343
344#ifdef USE_INITIALIZER_LIST
345#pragma GCC diagnostic ignored "-Wnarrowing"
346#endif
347
348#if USE_CHECK_MEMORY
349# define CHECK_MEMORY() checkMemory(true)
350#else
351# define CHECK_MEMORY()
352#endif
353
354
360#if USE_AUDIOTOOLS_NS
361namespace audio_tools {}
362using namespace audio_tools;
363#endif
364
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 LMSEchoCancellationStream.h:6