pschatzmann / arduino-audiokit

Arduino ADF/Audiokit HAL (support for ESP32-A1S, AI-Thinker, LyraT for ES7148, ES7210, ES7243, ES8311, ES8347, ES8388, TAS5805M, AC101 audio chips)
GNU General Public License v3.0
159 stars 42 forks source link

PlatformIO: errors compiling streams-audiokit-audiokit #49

Closed lnetwalker closed 1 year ago

lnetwalker commented 1 year ago

Hi,

I try to use the streams-audiokit-audiokit example on my LyraT 4.3 board to send the audio from "line in" to the speaker. I followed the hints in the wiki regarding platformio, my platformio.ini looks like this:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

lib_deps =
    https://github.com/pschatzmann/arduino-audiokit.git
    https://github.com/pschatzmann/arduino-audio-tools.git

lib_ldf_mode = deep+
build_flags = -DCORE_DEBUG_LEVEL=5 -DAUDIOKIT_BOARD=1 

upload_port = COM4
monitor_port = COM4
monitor_speed = 115200

The example is untouched like this:

/**
 * @file streams-audiokit-audiokit.ino
 * @author Phil Schatzmann
 * @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/streams-audiokit-audiokit/README.md
 * 
 * @author Phil Schatzmann
 * @copyright GPLv3
 */

#include "AudioTools.h"
#include "AudioLibs/AudioKit.h"

AudioKitStream kit; // Access I2S as stream
StreamCopy copier(kit, kit); // copy kit to kit

// Arduino Setup
void setup(void) {
    Serial.begin(115200);
    AudioLogger::instance().begin(Serial, AudioLogger::Warning);

    auto cfg = kit.defaultConfig(RXTX_MODE);
    cfg.sd_active = false;
    cfg.input_device = AUDIO_HAL_ADC_INPUT_LINE2;
    kit.begin(cfg);
}

// Arduino loop - copy data
void loop() {
    copier.copy();
}

When I do a build I got lot's of errors I don't understand:

In file included from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioPrint.h:7:0,
                 from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioFilter/Equilizer.h:3,
                 from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools.h:16,
                 from C:/Users/hartmut/src/hiberbear/src/HiberBear.ino:11:
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreams.h:70:15: error: 'virtual int audio_tools::AudioStream::availableForWrite()' marked 'override', but does not override
   virtual int availableForWrite() override { return DEFAULT_BUFFER_SIZE; }
               ^
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreams.h: In member function 'virtual int audio_tools::AudioStreamWrapper::availableForWrite()':
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreams.h:135:54: error: 'class Stream' has no member named 'availableForWrite'
   virtual int availableForWrite() { return p_stream->availableForWrite(); }
                                                      ^
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreams.h: In member function 'virtual int audio_tools::ConvertedStream<T, ConverterT>::availableForWrite()':
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\ai_thinker_ac101\board.c.o
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreams.h:925:60: error: 'class Stream' has no member named 'availableForWrite'
Archiving .pio\build\esp-wrover-kit\lib03c\libOLED.a
         virtual int availableForWrite() { return p_stream->availableForWrite(); }
                                                            ^
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreams.h: In member function 'virtual int audio_tools::VolumeStream::availableForWrite()':
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreams.h:1078:47: error: 'class Print' has no member named 'availableForWrite'
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\ai_thinker_ac101\board_pins_config.c.o
             return p_out==nullptr? 0 : p_out->availableForWrite();
                                               ^
Archiving .pio\build\esp-wrover-kit\lib824\libNTPClient.a
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreams.h: In member function 'virtual int audio_tools::MeasuringStream::availableForWrite()':
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreams.h:1280:23: error: 'class Print' has no member named 'availableForWrite'
       return p_print->availableForWrite();
                       ^
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\ai_thinker_es8388_2957\board.c.o
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreams.h: In member function 'virtual int audio_tools::FilteredStream<T, TF>::availableForWrite()':.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreams.h:1458:28: error: 'class Stream' has no member named 'availableForWrite'
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\ai_thinker_es8388_2957\board_pins_config.c.o
           return p_stream->availableForWrite();
                            ^
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\ai_thinker_es8388_3478\board.c.o
In file included from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTimer/AudioTimer.h:2:0,
                 from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools.h:11,
                 from C:/Users/hartmut/src/hiberbear/src/HiberBear.ino:11:
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioPrint.h: In member function 'virtual size_t audio_tools::MemoryPrint::write(const uint8_t*, size_t)':
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioLogger.h:132:94: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 
has type 'size_t {aka unsigned int}' [-Wformat=]
     snprintf(AudioLogger::instance().str(), LOG_PRINTF_BUFFER_SIZE, PSTR(fmt),  ##__VA_ARGS__); \
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\ai_thinker_es8388_3478\board_pins_config.c.o
                                                                                              ^
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioLogger.h:146:83: note: in expansion of macro 'LOG_OUT_PGMEM'
 #define LOGE(fmt, ...) if (AudioLogger::instance().level()<=AudioLogger::Error) { LOG_OUT_PGMEM(AudioLogger::Error, fmt, ##__VA_ARGS__);}
                                                                                   ^
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\esp32_s2_kaluga_1_v1_2\board.c.o
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\esp32_s2_kaluga_1_v1_2\board_pins_config.c.o
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioPrint.h:692:17: note: in expansion of macro 'LOGE'
                 LOGE("Buffer too small: pos:%d, size: %lu ", pos, max_size);
                 ^
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioLogger.h:132:94: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 
has type 'size_t {aka unsigned int}' [-Wformat=]
     snprintf(AudioLogger::instance().str(), LOG_PRINTF_BUFFER_SIZE, PSTR(fmt),  ##__VA_ARGS__); \
                                                                                              ^
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioLogger.h:146:83: note: in expansion of macro 'LOG_OUT_PGMEM'
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\generic_es8388\board.c.o
 #define LOGE(fmt, ...) if (AudioLogger::instance().level()<=AudioLogger::Error) { LOG_OUT_PGMEM(AudioLogger::Error, fmt, ##__VA_ARGS__);}
                                                                                   ^
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioPrint.h:692:17: note: in expansion of macro 'LOGE'
                 LOGE("Buffer too small: pos:%d, size: %lu ", pos, max_size);
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\generic_es8388\board_pins_config.c.o
                 ^
In file included from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools.h:16:0,
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\lyrat_mini_v1_1\board.c.o
                 from C:/Users/hartmut/src/hiberbear/src/HiberBear.ino:11:
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioFilter/Equilizer.h: In member function 'virtual int audio_tools::Equilizer3Bands::availableForWrite()':
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioFilter/Equilizer.h:101:29: error: 'class Print' has no member named 'availableForWrite'
             return p_print->availableForWrite();
                             ^
In file included from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools.h:23:0,
Compiling .pio\build\esp-wrover-kit\liba19\audiokit\audio_board\lyrat_mini_v1_1\board_pins_config.c.o
                 from C:/Users/hartmut/src/hiberbear/src/HiberBear.ino:11:
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreamsConverter.h: In member function 'virtual int audio_tools::ChannelFormatConverterStreamT<T>::availableForWrite()':
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreamsConverter.h:68:43: error: 'class Print' has no member named 'availableForWrite'
           return 1.0f / factor * p_print->availableForWrite();
                                           ^
In file included from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools.h:23:0,
                 from C:/Users/hartmut/src/hiberbear/src/HiberBear.ino:11:
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreamsConverter.h: In member function 'virtual int audio_tools::NumberFormatConverterStreamT<T, TArg>::availableForWrite()':
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreamsConverter.h:324:27: error: 'class Print' has no member named 'availableForWrite'
           return p_print->availableForWrite();
                           ^
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreamsConverter.h: In member function 'virtual int audio_tools::NumberFormatConverterStream::availableForWrite()':
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioStreamsConverter.h:451:29: error: 'class Print' has no member named 'availableForWrite'
             return p_print->availableForWrite();
                             ^
In file included from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools.h:25:0,
                 from C:/Users/hartmut/src/hiberbear/src/HiberBear.ino:11:
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/Resample.h: In member function 'int audio_tools::Resample<T>::availableForWrite()':
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/Resample.h:76:58: error: 'class Print' has no member named 'availableForWrite'
         int availableForWrite() override { return p_out->availableForWrite(); }
                                                          ^
In file included from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools.h:26:0,
                 from C:/Users/hartmut/src/hiberbear/src/HiberBear.ino:11:
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioCopy.h: In member function 'size_t audio_tools::StreamCopyT<T>::copy()':
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools/AudioCopy.h:95:32: error: 'class Print' has no member named 'availableForWrite'
             int to_write = to->availableForWrite();
                                ^
In file included from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools.h:28:0,
                 from C:/Users/hartmut/src/hiberbear/src/HiberBear.ino:11:
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioCodecs/AudioEncoded.h: In member function 'virtual int audio_tools::EncodedAudioStream::availableForWrite()':  
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioCodecs/AudioEncoded.h:347:54: error: 'class Print' has no member named 'availableForWrite'
   int availableForWrite() override { return ptr_out->availableForWrite(); }
                                                      ^
In file included from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioHttp/AudioHttp.h:2:0,
                 from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioTools.h:30,
                 from C:/Users/hartmut/src/hiberbear/src/HiberBear.ino:11:
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioHttp/URLStream.h: In member function 'Client& audio_tools::URLStreamDefault::getClient(bool)':
.pio\libdeps\esp-wrover-kit\audio-tools\src/AudioHttp/URLStream.h:242:35: error: 'class WiFiClientSecure' has no member named 'setInsecure'
                     clientSecure->setInsecure();
                                   ^
In file included from .pio\libdeps\esp-wrover-kit\audio-tools\src/AudioLibs/AudioKit.h:4:0,
                 from C:/Users/hartmut/src/hiberbear/src/HiberBear.ino:12:
.pio\libdeps\esp-wrover-kit\audiokit\src/AudioKitHAL.h: In member function 'i2s_config_t AudioKitConfig::i2sConfig()':
.pio\libdeps\esp-wrover-kit\audiokit\src/AudioKitHAL.h:129:34: warning: narrowing conversion of 'AudioKitConfig::sampleRate()' from 'uint32_t {aka unsigned int}' to 'int' inside { } [-Wnarrowing]
         .sample_rate = sampleRate(),
                                  ^
*** [.pio\build\esp-wrover-kit\src\HiberBear.ino.cpp.o] Error 1

Can anybody give me hints on what I missed ?

Sorry for inconvinience and thanks a lot Hartmut

pschatzmann commented 1 year ago

It seems that you are using somehow some obsolete Arduino/ESP32 version. Try to update PlatformiIO...

In addtion you should to add the following line in your PlatformIO sketch

#include "Arduino.h"

If this does not help try to use the platform as indicated in the Wiki

platform = https://github.com/platformio/platform-espressif32.git

But whatever I do, I can't reproduce your issue. I am getting the following output


Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
---------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (5.2.0+sha.03254d4) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20005.220925 (2.0.5) 
 - tool-esptoolpy @ 1.40201.0 (4.2.1) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ deep+, Compatibility ~ soft
Found 51 compatible libraries
Scanning dependencies...
Dependency Graph
|-- audio-tools @ 0.9.3+sha.45e780a
|-- libhelix @ 0.1.0+sha.ee1023c
|-- audiokit @ 0.0.1+sha.4abca27
|   |-- Wire @ 2.0.0
|-- SdFat @ 2.2.0+sha.628effa
|   |-- SPI @ 2.0.0
|-- WiFiClientSecure @ 2.0.0
|   |-- WiFi @ 2.0.0
|-- WiFi @ 2.0.0
|-- SPI @ 2.0.0
lnetwalker commented 1 year ago

Thanks for your help. I deleted the PlatformIO Espressif32 Environment and installed it new. Now everything works!