diff --git a/lib/lib_audio/ESP8266Audio/src/AudioFileSourceFS.cpp b/lib/lib_audio/ESP8266Audio/src/AudioFileSourceFS.cpp index 05348f59e..232302fce 100644 --- a/lib/lib_audio/ESP8266Audio/src/AudioFileSourceFS.cpp +++ b/lib/lib_audio/ESP8266Audio/src/AudioFileSourceFS.cpp @@ -19,9 +19,6 @@ */ #include "AudioFileSourceFS.h" -#ifdef ESP32 -#include "SPIFFS.h" -#endif AudioFileSourceFS::AudioFileSourceFS(FS &fs, const char *filename) { diff --git a/lib/lib_audio/ESP8266Audio/src/AudioFileSourceSPIFFS.h b/lib/lib_audio/ESP8266Audio/src/AudioFileSourceSPIFFS.h deleted file mode 100644 index 74efefa44..000000000 --- a/lib/lib_audio/ESP8266Audio/src/AudioFileSourceSPIFFS.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - AudioFileSourceFS - Input Arduion "file" to be used by AudioGenerator - - Copyright (C) 2017 Earle F. Philhower, III - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef _AUDIOFILESOURCESPIFFS_H -#define _AUDIOFILESOURCESPIFFS_H - -#include -#include - -#include "AudioFileSource.h" -#include "AudioFileSourceFS.h" - -class AudioFileSourceSPIFFS : public AudioFileSourceFS -{ - public: - AudioFileSourceSPIFFS() : AudioFileSourceFS(SPIFFS) { }; - AudioFileSourceSPIFFS(const char *filename) : AudioFileSourceFS(SPIFFS, filename) {}; - // Others are inherited from base -}; - - -#endif - diff --git a/lib/lib_audio/ESP8266Audio/src/AudioOutputSPIFFSWAV.cpp b/lib/lib_audio/ESP8266Audio/src/AudioOutputSPIFFSWAV.cpp deleted file mode 100644 index 44a5022c3..000000000 --- a/lib/lib_audio/ESP8266Audio/src/AudioOutputSPIFFSWAV.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - AudioOutputSPIFFSWAV - Writes a WAV file to the SPIFFS filesystem - - Copyright (C) 2017 Earle F. Philhower, III - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include -#include -#ifdef ESP32 -#include "SPIFFS.h" -#endif - -#include "AudioOutputSPIFFSWAV.h" - -static const uint8_t wavHeaderTemplate[] PROGMEM = { // Hardcoded simple WAV header with 0xffffffff lengths all around - 0x52, 0x49, 0x46, 0x46, 0xff, 0xff, 0xff, 0xff, 0x57, 0x41, 0x56, 0x45, - 0x66, 0x6d, 0x74, 0x20, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x22, 0x56, 0x00, 0x00, 0x88, 0x58, 0x01, 0x00, 0x04, 0x00, 0x10, 0x00, - 0x64, 0x61, 0x74, 0x61, 0xff, 0xff, 0xff, 0xff }; - -void AudioOutputSPIFFSWAV::SetFilename(const char *name) -{ - if (filename) free(filename); - filename = strdup(name); -} - -bool AudioOutputSPIFFSWAV::begin() -{ - uint8_t wavHeader[sizeof(wavHeaderTemplate)]; - memset(wavHeader, 0, sizeof(wavHeader)); - - if (f) return false; // Already open! - SPIFFS.remove(filename); - f = SPIFFS.open(filename, "w+"); - if (!f) return false; - - // We'll fix the header up when we close the file - f.write(wavHeader, sizeof(wavHeader)); - return true; -} - -bool AudioOutputSPIFFSWAV::ConsumeSample(int16_t sample[2]) -{ - for (int i=0; i> 8) & 0xff; - f.write(&l, sizeof(l)); - f.write(&h, sizeof(h)); - } - } - return true; -} - - -bool AudioOutputSPIFFSWAV::stop() -{ - uint8_t wavHeader[sizeof(wavHeaderTemplate)]; - - memcpy_P(wavHeader, wavHeaderTemplate, sizeof(wavHeaderTemplate)); - - int chunksize = f.size() - 8; - wavHeader[4] = chunksize & 0xff; - wavHeader[5] = (chunksize>>8)&0xff; - wavHeader[6] = (chunksize>>16)&0xff; - wavHeader[7] = (chunksize>>24)&0xff; - - wavHeader[22] = channels & 0xff; - wavHeader[23] = 0; - - wavHeader[24] = hertz & 0xff; - wavHeader[25] = (hertz >> 8) & 0xff; - wavHeader[26] = (hertz >> 16) & 0xff; - wavHeader[27] = (hertz >> 24) & 0xff; - int byteRate = hertz * bps * channels / 8; - wavHeader[28] = byteRate & 0xff; - wavHeader[29] = (byteRate >> 8) & 0xff; - wavHeader[30] = (byteRate >> 16) & 0xff; - wavHeader[31] = (byteRate >> 24) & 0xff; - wavHeader[32] = channels * bps / 8; - wavHeader[33] = 0; - wavHeader[34] = bps; - wavHeader[35] = 0; - - int datasize = f.size() - sizeof(wavHeader); - wavHeader[40] = datasize & 0xff; - wavHeader[41] = (datasize>>8)&0xff; - wavHeader[42] = (datasize>>16)&0xff; - wavHeader[43] = (datasize>>24)&0xff; - - // Write real header out - f.seek(0, SeekSet); - f.write(wavHeader, sizeof(wavHeader)); - f.close(); - return true; -} - diff --git a/lib/lib_audio/ESP8266Audio/src/AudioOutputSPIFFSWAV.h b/lib/lib_audio/ESP8266Audio/src/AudioOutputSPIFFSWAV.h deleted file mode 100644 index 4a2afaf4e..000000000 --- a/lib/lib_audio/ESP8266Audio/src/AudioOutputSPIFFSWAV.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - AudioOutputSPIFFSWAV - Writes a WAV file to the SPIFFS filesystem - - Copyright (C) 2017 Earle F. Philhower, III - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef _AUDIOOUTPUTSPIFFSWAV_H -#define _AUDIOOUTPUTSPIFFSWAV_H - -#include -#include - -#include "AudioOutput.h" - -class AudioOutputSPIFFSWAV : public AudioOutput -{ - public: - AudioOutputSPIFFSWAV() { filename = NULL; }; - ~AudioOutputSPIFFSWAV() { free(filename); }; - virtual bool begin() override; - virtual bool ConsumeSample(int16_t sample[2]) override; - virtual bool stop() override; - void SetFilename(const char *name); - - private: - File f; - char *filename; -}; - -#endif - diff --git a/lib/lib_audio/ESP8266Audio/tasmota_lib_changes.md b/lib/lib_audio/ESP8266Audio/tasmota_lib_changes.md index 04ef4b535..bea02c652 100644 --- a/lib/lib_audio/ESP8266Audio/tasmota_lib_changes.md +++ b/lib/lib_audio/ESP8266Audio/tasmota_lib_changes.md @@ -1,2 +1,21 @@ -Attention when updating library. Changes in lib needed!! See -https://github.com/arendst/Tasmota/commit/feb08bcbc9a3e63c9f190fa1f227619985c96459 +Change in file `lib/lib_audio/ESP8266Audio/src/AudioOutputULP.cpp` +``` +from +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 +to +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 +``` + +remove in file `lib/lib_audio/ESP8266Audio/src/AudioFileSourceFS.cpp` +``` +#ifdef ESP32 +#include "SPIFFS.h" +#endif +``` + +Files to delete: +``` +lib/lib_audio/ESP8266Audio/src/AudioFileSourceSPIFFS.h +lib/lib_audio/ESP8266Audio/src/AudioOutputSPIFFSWAV.cpp +lib/lib_audio/ESP8266Audio/src/AudioOutputSPIFFSWAV.h +``` diff --git a/platformio_override_sample.ini b/platformio_override_sample.ini index 0e5e1dcca..bd1eac048 100644 --- a/platformio_override_sample.ini +++ b/platformio_override_sample.ini @@ -66,8 +66,6 @@ board = ${common.board} ;upload_port = COM5 extra_scripts = ${esp_defaults.extra_scripts} ; pio-tools/obj-dump.py -lib_ldf_mode = ${common.lib_ldf_mode} -lib_compat_mode = ${common.lib_compat_mode} lib_ignore = Servo(esp8266) ESP8266AVRISP @@ -112,6 +110,12 @@ upload_resetmethod = ${common.upload_resetmethod} extra_scripts = ${esp32_defaults.extra_scripts} ; pio-tools/obj-dump.py lib_ignore = + HTTPUpdateServer + ESP RainMaker + WiFiProv + USB + SPIFFS + SD_MMC ESP32 Azure IoT Arduino ESP32 Async UDP ESP32 BLE Arduino diff --git a/platformio_tasmota_env32.ini b/platformio_tasmota_env32.ini index 2c0e425b2..5efe66cea 100644 --- a/platformio_tasmota_env32.ini +++ b/platformio_tasmota_env32.ini @@ -19,9 +19,11 @@ lib_extra_dirs = ${common.lib_extra_dirs} lib/libesp32_div lib/libesp32_eink lib_ignore = + HTTPUpdateServer ESP RainMaker WiFiProv USB + SPIFFS SD_MMC ESP32 Azure IoT Arduino ESP32 Async UDP