arduino-audio-tools
All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Modules Pages
AudioToolsConfig.h
1
7#pragma once
8
9#define AUDIOTOOLS_VERSION "1.0.1"
10#define AUDIOTOOLS_MAJOR_VERSION 1
11#define AUDIOTOOLS_MIOR_VERSION 0
12
13
14#if defined(IS_MIN_DESKTOP)
16# include "AudioTools/AudioLibs/Desktop/Time.h"
17# include "AudioTools/AudioLibs/Desktop/Main.h"
18# define USE_STREAM_READ_OVERRIDE
19# define USE_SD_NO_NS
20# ifndef EXIT_ON_STOP
21# define EXIT_ON_STOP
22# endif
23#elif defined(IS_DESKTOP_WITH_TIME_ONLY)
24# include "AudioTools/AudioLibs/Desktop/Time.h"
26# define USE_SD_NO_NS
27# ifndef EXIT_ON_STOP
28# define EXIT_ON_STOP
29# endif
30#elif defined(IS_DESKTOP)
31# include "Arduino.h"
32# include <Client.h>
33# include <WiFi.h>
34# define USE_SD_NO_NS
35# define USE_WIFI
36# define USE_URL_ARDUINO
37# define USE_STREAM_WRITE_OVERRIDE
38# define USE_STREAM_READ_OVERRIDE
39# define USE_STREAM_READCHAR_OVERRIDE
40# ifndef EXIT_ON_STOP
41# define EXIT_ON_STOP
42# endif
43//# define USE_3BYTE_INT24
44typedef WiFiClient WiFiClientSecure;
45#elif defined(ARDUINO)
46# include "Arduino.h"
47// --- ESP32 ------------
48// E.g when using the Espressif IDF. Use cmake for the necesseary defines
49#elif defined(ESP32_CMAKE)
50# define ESP32
51# include "esp_idf_version.h"
53#else
55# define IS_JUPYTER
56# define USE_STREAM_READ_OVERRIDE
57#endif
58
59#include <string.h>
60#include <stdint.h>
61#include <assert.h>
62#include "AudioTools/CoreAudio/AudioRuntime.h"
63
64
65// If you don't want to use all the settings from here you can define your own local config settings in AudioConfigLocal.h
66#if __has_include("AudioConfigLocal.h")
67#include "AudioConfigLocal.h"
68#endif
69
70// Automatically include all core audio functionality
71#ifndef AUDIO_INCLUDE_CORE
72# define AUDIO_INCLUDE_CORE true
73#endif
74
75// 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)
76#ifndef PREFER_FIXEDPOINT
77# define PREFER_FIXEDPOINT false
78#endif
79
80// Add automatic using namespace audio_tools;
81#ifndef USE_AUDIOTOOLS_NS
82# define USE_AUDIOTOOLS_NS true
83#endif
84
93#ifndef USE_AUDIO_LOGGING
94# define USE_AUDIO_LOGGING true
95#endif
96
97#ifndef LOG_LEVEL
98# define LOG_LEVEL AudioLogger::Warning
99#endif
100
101#ifndef LOG_STREAM
102# define LOG_STREAM Serial
103#endif
104
105#ifndef LOG_PRINTF_BUFFER_SIZE
106# define LOG_PRINTF_BUFFER_SIZE 303
107#endif
108
109#ifndef LOG_METHOD
110# define LOG_METHOD __PRETTY_FUNCTION__
111#endif
112
113// cheange USE_CHECK_MEMORY to true to activate memory checks
114#ifndef USE_CHECK_MEMORY
115# define USE_CHECK_MEMORY false
116#endif
117
118
119// Activate/deactivate obsolete functionality
120#ifndef USE_OBSOLETE
121# define USE_OBSOLETE false
122#endif
123
128#ifndef DEFAULT_BUFFER_SIZE
129# define DEFAULT_BUFFER_SIZE 1024
130#endif
131
132#ifndef DEFAULT_SAMPLE_RATE
133# define DEFAULT_SAMPLE_RATE 44100
134#endif
135
136#ifndef DEFAULT_CHANNELS
137# define DEFAULT_CHANNELS 2
138#endif
139
140#ifndef DEFAULT_BITS_PER_SAMPLE
141# define DEFAULT_BITS_PER_SAMPLE 16
142#endif
143
144#ifndef I2S_DEFAULT_PORT
145# define I2S_DEFAULT_PORT 0
146#endif
147
148#ifndef I2S_BUFFER_SIZE
149# define I2S_BUFFER_SIZE 512
150#endif
151
152#ifndef I2S_BUFFER_COUNT
153# define I2S_BUFFER_COUNT 6 // 20
154#endif
155
156#ifndef ANALOG_BUFFER_SIZE
157# define ANALOG_BUFFER_SIZE 512
158#endif
159
160#ifndef ANALOG_BUFFER_COUNT
161# define ANALOG_BUFFER_COUNT 6 // 20
162#endif
163
164#ifndef A2DP_BUFFER_SIZE
165# define A2DP_BUFFER_SIZE 512
166#endif
167
168#ifndef A2DP_BUFFER_COUNT
169# define A2DP_BUFFER_COUNT 30
170#endif
171
172#ifndef CODEC_DELAY_MS
173# define CODEC_DELAY_MS 10
174#endif
175
176#ifndef COPY_DELAY_ON_NODATA
177# define COPY_DELAY_ON_NODATA 10
178#endif
179
180#ifndef COPY_RETRY_LIMIT
181# define COPY_RETRY_LIMIT 20
182#endif
183
184#ifndef MAX_SINGLE_CHARS
185# define MAX_SINGLE_CHARS 8
186#endif
187
188// max size of http processing buffer
189#ifndef HTTP_MAX_LEN
190# define HTTP_MAX_LEN 1024
191#endif
192
193// max size of chunked size line
194#ifndef HTTP_CHUNKED_SIZE_MAX_LEN
195# define HTTP_CHUNKED_SIZE_MAX_LEN 80
196#endif
197
198
199#ifndef USE_RESAMPLE_BUFFER
200# define USE_RESAMPLE_BUFFER true
201#endif
202
206#ifndef PWM_BUFFER_SIZE
207# define PWM_BUFFER_SIZE 1024
208#endif
209
210#ifndef PWM_BUFFER_COUNT
211# define PWM_BUFFER_COUNT 4
212#endif
213
214#ifndef PWM_AUDIO_FREQUENCY
215# define PWM_AUDIO_FREQUENCY 30000
216#endif
217
218// Activate Networking for All Processors
219// #define USE_ETHERNET
220// #define USE_AUDIO_SERVER
221// #define USE_URL_ARDUINO
222
227//-------ESP32---------
228#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32C3)
229# define ESP32C3
230# define ESP32X
231# define USE_INT24_FROM_INT
232# define USE_TDM
233# define USE_PDM
234#endif
235#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32S2)
236# define ESP32S2
237# define ESP32X
238#endif
239#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32S3)
240# define ESP32S3
241# define ESP32X
242# define USE_TDM
243# define USE_PDM
244# define USE_PDM_RX
245#endif
246#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32C6)
247# define ESP32C6
248# define ESP32X
249# define USE_TDM
250# define USE_PDM
251#endif
252#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32P4)
253# define ESP32P4
254# define ESP32X
255# define USE_TDM
256# define USE_PDM
257# define USE_PDM_RX
258#endif
259
260// for all ESP32 families
261#if defined(ESP32)
262# define USE_STRTOD
263// We need to use accept instead of available
264# if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
265# define USE_SERVER_ACCEPT true
266# endif
267# if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
268# define USE_CONCURRENCY
269// Print has been fixed
270# define USE_PRINT_FLUSH true
271# else
272# define USE_PRINT_FLUSH false
273# endif
274# define USE_SD_SUPPORTS_SPI
275//# define USE_ESP32_LOGGER true
276# if !defined(ARDUINO)
277# define USE_IDF_LOGGER
278# endif
279# if !defined(I2S_USE_APLL)
280# define I2S_USE_APLL false
281# endif
282#endif
283
284// ----- Regular ESP32 -----
285#if defined(ESP32) && !defined(ESP32X) && !defined(CONFIG_IDF_TARGET_ESP32H2)
286#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
287# define USE_INT24_FROM_INT
288# define USE_PDM
289#endif
290
291#define USE_ANALOG
292#define USE_I2S
293#define USE_PDM_RX
294
295#ifdef ARDUINO
296# define USE_PWM
297# define USE_WIFI
298# define USE_WIFI_CLIENT_SECURE
299# define USE_URL_ARDUINO
300# define USE_AUDIO_SERVER
301# define USE_TIMER
302# define USE_TOUCH_READ
303#endif
304
305#define USE_TYPETRAITS
306#define USE_STREAM_WRITE_OVERRIDE
307#define USE_STREAM_READ_OVERRIDE
308#define USE_EXT_BUTTON_LOGIC
309// support for psram -> set to true
310#define USE_ALLOCATOR true
311#define HAS_IOSTRAM
312#define USE_TASK false
313
314#define PWM_FREQENCY 30000
315#define PIN_PWM_START 12
316#define PIN_I2S_BCK 14
317#define PIN_I2S_WS 15
318#define PIN_I2S_DATA_IN 32
319#define PIN_I2S_DATA_OUT 22
320#define PIN_I2S_MCK -1
321// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 23). Or you could drive the LED by assigning LED_BUILTIN
322#define PIN_I2S_MUTE -1
323#define SOFT_MUTE_VALUE 0
324#define PIN_CS SS
325#define PIN_ADC1 34
326
327#define I2S_AUTO_CLEAR true
328
329// URLStream
330#define URL_STREAM_CORE 0
331#define URL_STREAM_PRIORITY 2
332#define URL_STREAM_BUFFER_COUNT 10
333#define STACK_SIZE 30000
334#define URL_CLIENT_TIMEOUT 60000;
335#define URL_HANDSHAKE_TIMEOUT 120000
336
337// // Default LED
338// #ifndef LED_BUILTIN
339// # define LED_BUILTIN 13 // pin number is specific to your esp32 board
340// #endif
341
342// support for old idf releases
343#if ESP_IDF_VERSION_MAJOR < 4 && !defined(I2S_COMM_FORMAT_STAND_I2S)
344# define I2S_COMM_FORMAT_STAND_I2S (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB)
345# define I2S_COMM_FORMAT_STAND_MSB (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_LSB)
346# define I2S_COMM_FORMAT_STAND_PCM_LONG (I2S_COMM_FORMAT_PCM | I2S_COMM_FORMAT_PCM_LONG)
347# define I2S_COMM_FORMAT_STAND_PCM_SHORT (I2S_COMM_FORMAT_PCM | I2S_COMM_FORMAT_PCM_SHORT)
348
349typedef int eps32_i2s_sample_rate_type;
350#else
351typedef uint32_t eps32_i2s_sample_rate_type;
352#endif
353
354#endif
355
356//-------ESP32C3, ESP32S3, ESP32S2---------
357
358#if defined(ESP32) && defined(ESP32X)
359# ifdef ARDUINO
360# include "esp32-hal-log.h"
361# endif
362# if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
363# define USE_INT24_FROM_INT
364# define USE_ANALOG
365# endif
366
367#define USE_PWM
368#define USE_URL_ARDUINO
369#define USE_WIFI
370#define USE_WIFI_CLIENT_SECURE
371#define USE_I2S
372#define USE_AUDIO_SERVER
373#define USE_TYPETRAITS
374#define USE_TIMER
375#define USE_STREAM_WRITE_OVERRIDE
376#define USE_STREAM_READ_OVERRIDE
377// support for psram -> set to true
378#define USE_ALLOCATOR true
379//#define USE_INITIALIZER_LIST
380
381#define PWM_FREQENCY 30000
382#define PIN_PWM_START 1
383#define PIN_I2S_MCK -1
384#define PIN_I2S_BCK 6
385#define PIN_I2S_WS 7
386#define PIN_I2S_DATA_OUT 8
387#define PIN_I2S_DATA_IN 9
388// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 5). Or you could drive the LED by assigning LED_BUILTIN
389#define PIN_I2S_MUTE -1
390#define SOFT_MUTE_VALUE 0
391#define PIN_CS SS
392#define PIN_ADC1 21
393
394#define I2S_AUTO_CLEAR true
395
396// URLStream
397//#define USE_ESP8266_AUDIO
398#define URL_STREAM_CORE 0
399#define URL_STREAM_PRIORITY 2
400#define URL_STREAM_BUFFER_COUNT 10
401#define STACK_SIZE 30000
402#define URL_CLIENT_TIMEOUT 60000;
403#define URL_HANDSHAKE_TIMEOUT 120000
404
405// // Default LED
406// #ifndef LED_BUILTIN
407// # define LED_BUILTIN 13 // pin number is specific to your esp32 board
408// #endif
409
410typedef uint32_t eps32_i2s_sample_rate_type;
411
412#endif
413
414//-------ESP32H2---------
415
416#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32H2)
417#include "esp32-hal-log.h"
418#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
419# define USE_INT24_FROM_INT
420# define USE_ANALOG
421#endif
422
423#define ESP32H2
424#define USE_TDM
425#define USE_PWM
426#define USE_I2S
427#define USE_PDM
428#define USE_TYPETRAITS
429#define USE_TIMER
430#define USE_STREAM_WRITE_OVERRIDE
431#define USE_STREAM_READ_OVERRIDE
432// support for psram -> set to true
433#define USE_ALLOCATOR true
434//#define USE_INITIALIZER_LIST
435
436#define PWM_FREQENCY 30000
437#define PIN_PWM_START 1
438#define PIN_I2S_MCK -1
439#define PIN_I2S_BCK 6
440#define PIN_I2S_WS 7
441#define PIN_I2S_DATA_OUT 8
442#define PIN_I2S_DATA_IN 9
443// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 5). Or you could drive the LED by assigning LED_BUILTIN
444#define PIN_I2S_MUTE -1
445#define SOFT_MUTE_VALUE 0
446#define PIN_CS SS
447#define PIN_ADC1 21
448#define I2S_AUTO_CLEAR true
449
450typedef uint32_t eps32_i2s_sample_rate_type;
451
452#endif
453
454
455//----- ESP8266 -----------
456#ifdef ESP8266
457# include <ESP8266WiFi.h>
458//#define USE_URL_ARDUINO // commented out because of compile errors
459#define USE_I2S
460#define USE_TYPETRAITS
461#define USE_TIMER
462#define USE_WIFI
463#define USE_AUDIO_SERVER
464#define USE_URL_ARDUINO
465
466#define PIN_PWM_START 12
467#define PIN_I2S_BCK -1
468#define PIN_I2S_WS -1
469#define PIN_I2S_DATA_IN -1
470#define PIN_I2S_DATA_OUT -1
471#define I2S_USE_APLL false
472#define PIN_I2S_MUTE 23
473#define SOFT_MUTE_VALUE 0
474#define PIN_CS SS
475#define USE_SERVER_ACCEPT 1
476
477#define URL_CLIENT_TIMEOUT 60000;
478#define URL_HANDSHAKE_TIMEOUT 120000
479#define USE_SD_SUPPORTS_SPI
480
481#endif
482
483//------ NANO33BLE ----------
484#if (defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) || defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ARDUINO_ARCH_MBED_NANO)) && !defined(ARDUINO_ARCH_ZEPHYR)
485#define USE_NANO33BLE
486#define USE_INT24_FROM_INT
487#define USE_I2S
488#define USE_PWM
489#define USE_TYPETRAITS
490#define USE_TIMER
491//#define USE_INITIALIZER_LIST
492#define USE_ALT_PIN_SUPPORT
493
494#define PIN_PWM_START 5
495#define PIN_I2S_BCK 2
496#define PIN_I2S_WS 3
497#define PIN_I2S_DATA_IN 4
498#define PIN_I2S_DATA_OUT 4
499// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 4). Or you could drive the LED by assigning LED_BUILTIN
500#define PIN_I2S_MUTE -1
501#define SOFT_MUTE_VALUE 0
502#define PIN_CS SS
503#endif
504
505//----- RP2040 MBED -----------
506#if defined(ARDUINO_ARCH_MBED_RP2040)
507// install https://github.com/pschatzmann/rp2040-i2s
508#define RP2040_MBED
509#define USE_I2S 1
510#define USE_PWM
511#define USE_ANALOG_ARDUINO
512#define USE_TYPETRAITS
513#define USE_TIMER
514#define USE_INT24_FROM_INT
515
516#define PIN_ANALOG_START 26
517#define PIN_PWM_START 6
518#define PIN_I2S_BCK 26
519#define PIN_I2S_WS PIN_I2S_BCK+1
520#define PIN_I2S_DATA_IN 28
521#define PIN_I2S_DATA_OUT 28
522// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 4). Or you could drive the LED by assigning LED_BUILTIN
523#define PIN_I2S_MUTE -1
524#define SOFT_MUTE_VALUE 0
525#define PIN_CS 1 //PIN_SPI0_SS
526
527// fix missing __sync_synchronize symbol
528#define FIX_SYNC_SYNCHRONIZE
529#define IRAM_ATTR
530#ifndef ANALOG_BUFFER_SIZE
531#define ANALOG_BUFFER_SIZE 1024
532#endif
533
534#ifndef ANALOG_BUFFERS
535#define ANALOG_BUFFERS 50
536#endif
537
538//#define USE_ESP8266_AUDIO
539
540//----- RP2040 -----------
541#elif defined(ARDUINO_ARCH_RP2040)
542#define RP2040_HOWER
543#define USE_SD_NO_NS
544#define USE_I2S
545#define USE_PWM
546#define USE_ANALOG_ARDUINO
547#define USE_TYPETRAITS
548#define USE_TIMER
549#define USE_INT24_FROM_INT
550
551#define PIN_ANALOG_START 26
552#define PIN_PWM_START 6
553#define PIN_I2S_BCK 26
554#define PIN_I2S_WS PIN_I2S_BCK+1
555#define PIN_I2S_DATA_IN 28
556#define PIN_I2S_DATA_OUT 28
557#define PIN_I2S_MCK -1
558// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 4). Or you could drive the LED by assigning LED_BUILTIN
559#define PIN_I2S_MUTE -1
560#define SOFT_MUTE_VALUE 0
561#define PIN_CS PIN_SPI0_SS
562#define USE_SERVER_ACCEPT true
563
564// fix missing __sync_synchronize symbol
565//#define FIX_SYNC_SYNCHRONIZE
566#define IRAM_ATTR
567
568#ifndef ANALOG_BUFFER_SIZE
569#define ANALOG_BUFFER_SIZE 256
570#endif
571
572#ifndef ANALOG_BUFFERS
573#define ANALOG_BUFFERS 100
574#endif
575
576//#define USE_CONCURRENCY
577#define USE_SD_SUPPORTS_SPI
578
579// default pins for VS1053 shield
580#define VS1053_CS 17
581#define VS1053_DCS 9
582#define VS1053_DREQ 10
583#define VS1053_CS_SD -1
584#define VS1053_RESET 11
585#define VS1053_DEFINED
586#endif
587
588// The Pico W has WIFI support: but platformio is messing up, so we support NO_WIFI
589#if (defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_RASPBERRY_PI_PICO_W) || defined(ARDUINO_ARCH_RP2040)) && (LWIP_IPV4==1 || LWIP_IPV6==1) &&!defined(NO_WIFI)
590# include <WiFi.h>
591# define USE_WIFI
592# define USE_WIFI_CLIENT_SECURE
593# define USE_URL_ARDUINO
594# define USE_AUDIO_SERVER
595using WiFiServerSecure = BearSSL::WiFiServerSecure;
596#endif
597
598
599//----- AVR -----------
600#ifdef __AVR__
601#define USE_SD_NO_NS
602#define USE_PWM
603#define USE_TIMER
604#define NO_INPLACE_INIT_SUPPORT
605// Uncomment to activate network
606//#include <Ethernet.h>
607//#define USE_URL_ARDUINO
608#ifndef assert
609# define assert(T)
610#endif
611
612#define PIN_PWM_START 6
613#define PIN_CS SS
614
615#undef PWM_BUFFER_SIZE
616#define PWM_BUFFER_SIZE 125
617
618#undef DEFAULT_BUFFER_SIZE
619#define DEFAULT_BUFFER_SIZE 125
620
621// logging is using too much memory
622#undef USE_AUDIO_LOGGING
623#undef LOG_PRINTF_BUFFER_SIZE
624#define LOG_PRINTF_BUFFER_SIZE 60
625#define NO_TRACED
626#define NO_TRACEI
627#define NO_TRACEE
628
629// we use spi to emulate i2s
630#define PIN_I2S_BCK 13
631#define PIN_I2S_WS 10
632#define PIN_I2S_DATA_IN 12
633#define PIN_I2S_DATA_OUT 11
634#define PIN_I2S_MUTE -1
635
636#endif
637
638
639//---- STM32 ------------
640#if defined(ARDUINO_ARCH_STM32)
641#define STM32
642#endif
643
644#ifdef STM32
645#define USE_I2S
646#define USE_PWM
647#define USE_TIMER
648#define USE_ANALOG
649#define USE_ANALOG_ARDUINO
650#define USE_INT24_FROM_INT
651
652#define PIN_ANALOG_START PA0
653#define PIN_PWM_START PA0
654#define PWM_DEFAULT_TIMER TIM2
655#define PWM_FREQ_TIMER_NO 3
656#define USE_SD_NO_NS
657
658#define PIN_I2S_BCK -1
659#define PIN_I2S_WS -1
660#define PIN_I2S_DATA_IN -1
661#define PIN_I2S_DATA_OUT -1
662#define PIN_I2S_MUTE -1
663#define SOFT_MUTE_VALUE 0
664#define PIN_CS -1
665
666#define USE_ETHERNET
667#define USE_URL_ARDUINO
668#define USE_AUDIO_SERVER
669
670
671#endif
672
673//---- SAMD ------------
674
675#ifdef ARDUINO_ARCH_SAMD
676#define NO_INPLACE_INIT_SUPPORT
677#ifndef SEEED_XIAO_M0
678# define USE_I2S
679#endif
680#define USE_INT24_FROM_INT
681#define PIN_I2S_BCK 1
682#define PIN_I2S_WS PIN_I2S_BCK+1
683#define PIN_I2S_DATA_IN 3
684#define PIN_I2S_DATA_OUT 3
685#define PIN_I2S_MUTE -1
686#define SOFT_MUTE_VALUE 0
687#define USE_SD_NO_NS
688#define PIN_CS 4
689#endif
690
691#ifdef ARDUINO_SAMD_MKRWIFI1010
692#include <WiFiNINA.h>
693#define USE_URL_ARDUINO
694#define USE_AUDIO_SERVER
695#endif
696
697//---- GIGA ------------
698// DRAFT Support - Not tested !
699#if defined(ARDUINO_GIGA)
700#include <WiFi.h>
701#include <Arduino_AdvancedAnalog.h>
702#define IS_MBED
703#define USE_INT24_FROM_INT
704#define USE_TYPETRAITS
705#define USE_ANALOG
706#define USE_STREAM_WRITE_OVERRIDE
707#define ANALOG_BUFFER_SIZE 1024
708#define ANALOG_BUFFERS 10
709#define USE_URL_ARDUINO
710#define USE_AUDIO_SERVER
711
712#define PIN_ANALOG_START A7
713#define PIN_DAC_1 A12
714#define PIN_DAC_2 A13
715
716#endif
717
718// //---- Portenta ------------
719// // DRAFT: not tested
720#if defined(ARDUINO_ARCH_MBED_PORTENTA)
721#include <WiFi.h>
722#include <Arduino_AdvancedAnalog.h>
723#define IS_MBED
724#define USE_INT24_FROM_INT
725#define USE_TYPETRAITS
726#define USE_ANALOG
727#define USE_TIMER
728#define USE_PWM
729#define USE_STREAM_WRITE_OVERRIDE
730#define ANALOG_BUFFER_SIZE 1024
731#define ANALOG_BUFFERS 10
732#define USE_URL_ARDUINO
733#define USE_AUDIO_SERVER
734
735#define PIN_ANALOG_START A0
736#define PIN_PWM_START D2
737#define PIN_DAC_1 D0
738#define PIN_DAC_2 D1
739#endif
740
741//------ RENESAS ----------
742// Arduino UNO R4
743#if defined(ARDUINO_ARCH_RENESAS) || defined(_RENESAS_RA_)
744// no trace to save on memory
745#define NO_TRACE
746#define LOG_NO_MSG // around 4K less
747
748#define USE_INT24_FROM_INT
749#define IS_RENESAS 1
750#define USE_TYPETRAITS
751#define USE_TIMER
752#define USE_PWM
753#define PIN_PWM_START D2
754#define PIN_PWM_COUNT 12
755#define USE_ANALOG
756#define USE_ANALOG_ARDUINO
757#define USE_SD_NO_NS
758#define PIN_ANALOG_START A0
759#define ANALOG_BUFFER_SIZE 512
760#define ANALOG_BUFFERS 5
761#define ANALOG_MAX_OUT_CHANNELS 1
762#define ANALOG_MAX_SAMPLE_RATE 16000
763// default pins for UNO VS1053 shield
764#define VS1053_CS 6
765#define VS1053_DCS 7
766#define VS1053_DREQ 2
767#define VS1053_CS_SD 9
768#define VS1053_RESET 8
769#define VS1053_DEFINED
770#define PIN_CS 9
771
772#if defined(ARDUINO) && !defined(ARDUINO_MINIMA)
773# define USE_WIFI
774# define USE_URL_ARDUINO
775# define USE_AUDIO_SERVER
776# include "WiFiS3.h"
777#endif
778
779#endif
780
781
782// ------ Zephyr -------
783#ifdef ARDUINO_ARCH_ZEPHYR
784# define IS_ZEPHYR
785# define NO_INPLACE_INIT_SUPPORT
786# define USE_TYPETRAITS
787# define USE_I2S
788# define PIN_I2S_BCK 2
789# define PIN_I2S_WS 3
790# define PIN_I2S_DATA_IN 4
791# define PIN_I2S_DATA_OUT 4
792// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 4). Or you could drive the LED by assigning LED_BUILTIN
793# define PIN_I2S_MUTE -1
794# define SOFT_MUTE_VALUE 0
795# define USE_NANO33BLE
796# define USE_ALT_PIN_SUPPORT
797#endif
798
799//------ VS1053 ----------
800// see https://github.com/pschatzmann/arduino-vs1053/wiki/Pinouts-for-Processors-and-Tested-Boards#microcontrollers
801// Default Pins for VS1053
802#ifndef VS1053_DEFINED
803# define VS1053_CS 5
804# define VS1053_DCS 16
805# define VS1053_DREQ 4
806# define VS1053_RESET 15
807# define VS1053_CS_SD -1
808#endif
809
810// use 0 for https://github.com/baldram/ESP_VS1053_Library
811// use 1 for https://github.com/pschatzmann/arduino-vs1053
812#define VS1053_EXT 1
813#define VS1053_DEFAULT_VOLUME 0.7
814
815
816//----------------
817// Fallback defined if nothing was defined in the platform
818
819#ifndef ARDUINO
820# define USE_STREAM_WRITE_OVERRIDE
821#endif
822
823#ifndef ANALOG_MAX_SAMPLE_RATE
824# define ANALOG_MAX_SAMPLE_RATE 44100
825#endif
826
827#ifndef PWM_MAX_SAMPLE_RATE
828# define PWM_MAX_SAMPLE_RATE 8000
829#endif
830
831
832#ifndef URL_CLIENT_TIMEOUT
833# define URL_CLIENT_TIMEOUT 60000;
834# define URL_HANDSHAKE_TIMEOUT 120000
835#endif
836
837#ifndef USE_TASK
838# define USE_TASK false
839#endif
840
841#ifndef USE_SERVER_ACCEPT
842# define USE_SERVER_ACCEPT false
843#endif
844
845#ifndef USE_ALLOCATOR
846# define USE_ALLOCATOR false
847#endif
848
849#ifndef USE_ESP32_LOGGER
850# define USE_ESP32_LOGGER false
851#endif
852
853// Standard Arduino Print provides flush function
854#ifndef USE_PRINT_FLUSH
855# define USE_PRINT_FLUSH true
856#endif
857
858#ifndef ESP_IDF_VERSION_VAL
859# define ESP_IDF_VERSION_VAL(a, b , c) 0
860#endif
861
862#if USE_CHECK_MEMORY
863# define CHECK_MEMORY() checkMemory(true)
864#else
865# define CHECK_MEMORY()
866#endif
867
868#pragma GCC diagnostic ignored "-Wunused-variable"
869#pragma GCC diagnostic ignored "-Wunused-function"
870#pragma GCC diagnostic ignored "-Wvla"
871#pragma GCC diagnostic ignored "-Wsign-compare"
872#pragma GCC diagnostic ignored "-Woverloaded-virtual"
873#pragma GCC diagnostic ignored "-Wdouble-promotion"
874
875#ifdef USE_NO_MEMACCESS
876#pragma GCC diagnostic ignored "-Wclass-memaccess"
877#endif
878
879#ifdef USE_INITIALIZER_LIST
880#pragma GCC diagnostic ignored "-Wnarrowing"
881#endif
882
883#undef rewind
884
885// select int24 implementation
886#include "AudioTools/CoreAudio/AudioBasic/Int24_3bytes_t.h"
887#include "AudioTools/CoreAudio/AudioBasic/Int24_4bytes_t.h"
888#include "AudioTools/CoreAudio/AudioBasic/FloatAudio.h"
889
890namespace audio_tools {
891 #ifdef USE_3BYTE_INT24
892 using int24_t = audio_tools::int24_3bytes_t;
893 #else
894 using int24_t = audio_tools::int24_4bytes_t;
895 #endif
896}
897
903#if USE_AUDIOTOOLS_NS
904using namespace audio_tools;
905#endif
906
If you want to use the framework w/o Arduino you need to provide the implementation of a couple of cl...
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