Skip to content

Commit 3db53e5

Browse files
committed
Support for ESP32 Logger
1 parent 28a8df1 commit 3db53e5

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Some basic __header-only C++ classes__ that can be used for __Audio Processing__
88
- Helps to [communicate](https://github.com/pschatzmann/arduino-audio-tools/wiki/Communication) audio over the wire or wirelessly
99
- Different [Sound Generators](https://pschatzmann.github.io/arduino-audio-tools/group__generator.html) (e.g. to generate a sine tone) for [GeneratedSoundStream](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_generated_sound_stream.html)
1010
- Support for [Sound Effects](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_audio_effect_stream.html) with different [Effect Implementations](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_audio_effect.html) (e.g. Boost, Distortion, Echo, Reverb...) for [AudioEffectStream](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_audio_effect_stream_t.html)
11+
- Provides a [3 Band Equilizer](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_equilizer3_bands.html)
1112
- Different [Converters](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_base_converter.html) for [ConverterStream](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_converter_stream.html)
1213
- Different [Filters](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_filter.html) for [FilteredStream](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_filtered_stream.html)
1314
- [Musical Notes](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_musical_notes.html) (with frequencies of notes)

src/AudioConfig.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ typedef WiFiClient WiFiClientSecure;
263263
# define USE_PRINT_FLUSH false
264264
# endif
265265
# define USE_SD_SUPPORTS_SPI
266+
//# define USE_ESP32_LOGGER true
266267
#endif
267268

268269
// ----- Regular ESP32 -----
@@ -831,6 +832,9 @@ using WiFiServerSecure = BearSSL::WiFiServerSecure;
831832
# define USE_ALLOCATOR false
832833
#endif
833834

835+
#ifndef USE_ESP32_LOGGER
836+
# define USE_ESP32_LOGGER false
837+
#endif
834838

835839
// Standard Arduino Print provides flush function
836840
#ifndef USE_PRINT_FLUSH

src/AudioTools/CoreAudio/AudioLogger.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010
#include "AudioTools/Concurrency/RP2040/MutexRP2040.h"
1111
#elif defined(ESP32)
1212
#include "AudioTools/Concurrency/RTOS/MutexRTOS.h"
13+
#include "esp_log.h"
1314
#endif
1415

1516
// Logging Implementation
17+
#if defined(ESP32)
18+
#endif
19+
1620
#if USE_AUDIO_LOGGING
1721

1822
namespace audio_tools {
@@ -211,6 +215,14 @@ class CustomLogLevel {
211215
if (AudioLogger::instance().level() <= AudioLogger::Error) { \
212216
LOG_MIN(AudioLogger::Error); \
213217
}
218+
#elif USE_ESP32_LOGGER
219+
220+
#define TAG_AUDIO "AUDIO"
221+
#define LOGD(...) ESP_LOGD(TAG_AUDIO,__VA_ARGS__);
222+
#define LOGI(...) ESP_LOGI(TAG_AUDIO,__VA_ARGS__);
223+
#define LOGW(...) ESP_LOGW(TAG_AUDIO,__VA_ARGS__);
224+
#define LOGE(...) ESP_LOGE(TAG_AUDIO,__VA_ARGS__);
225+
214226
#else
215227
// Log statments which store the fmt string in Progmem
216228
#define LOGD(fmt, ...) \
@@ -271,10 +283,10 @@ class CustomLogLevel {
271283
#else
272284

273285
// Switch off logging
274-
#define LOGD(...)
275-
#define LOGI(...)
276-
#define LOGW(...)
277-
#define LOGE(...)
286+
#define LOGD(...)
287+
#define LOGI(...)
288+
#define LOGW(...)
289+
#define LOGE(...)
278290
#define TRACED()
279291
#define TRACEI()
280292
#define TRACEW()

0 commit comments

Comments
 (0)