diff --git a/.gitignore b/.gitignore index de9489d5f..76eef990e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ docs/html/ build/ -.vscode/ \ No newline at end of file +.vscode/ +_deps/ +.ipynb_checkpoints/ +.DS_Store \ No newline at end of file diff --git a/examples/build-examples-log.txt b/examples/build-examples-log.txt index 5a7c80e84..99826fa48 100644 --- a/examples/build-examples-log.txt +++ b/examples/build-examples-log.txt @@ -14,7 +14,7 @@ ../examples/examples-stream/streams-adc-serial -> rc=0 ../examples/examples-stream/streams-adsr-i2s -> rc=0 ../examples/examples-stream/streams-generator-analog -> rc=0 -../examples/examples-stream/streams_generator_bin_serial -> rc=0 +../examples/examples-stream/streams-generator-bin-serial -> rc=0 ../examples/examples-stream/streams-generator-formatconverter-i2s -> rc=0 ../examples/examples-stream/streams-generator_fromarray-analog -> rc=0 ../examples/examples-stream/streams-generator-i2s -> rc=0 @@ -22,12 +22,13 @@ ../examples/examples-stream/streams-generator-pwm -> rc=0 ../examples/examples-stream/streams-generator-serial -> rc=0 ../examples/examples-stream/streams-generator-spdif -> rc=0 +../examples/examples-stream/streams-generator-timedstream-serial -> rc=0 ../examples/examples-stream/streams-generator-volume -> rc=0 ../examples/examples-stream/streams-generator-wm8960 -> rc=0 ../examples/examples-stream/streams-i2s-filter-i2s -> rc=0 ../examples/examples-stream/streams-i2s-i2s -> rc=0 ../examples/examples-stream/streams-i2s-i2s-2 -> rc=0 -../examples/examples-stream/streams-i2s_pdm-serial -> rc=0 +../examples/examples-stream/streams-i2s_pdm-serial -> rc=1 ../examples/examples-stream/streams-i2s-serial -> rc=0 ../examples/examples-stream/streams-i2s-serial_16bit -> rc=0 ../examples/examples-stream/streams-i2s-tf -> rc=0 @@ -69,20 +70,21 @@ ../examples/examples-audiokit/streams-generator_sinfromtable-audiokit -> rc=0 ../examples/examples-audiokit/streams-memory_mp3-audiokit -> rc=0 ../examples/examples-audiokit/streams-memory_pcm-mixer-audiokit -> rc=0 -../examples/examples-audiokit/streams-pins-audiokit -> rc=0 -../examples/examples-audiokit/streams-sd-audiokit -> rc=0 +../examples/examples-audiokit/streams-pins-audiokit -> rc=1 +../examples/examples-audiokit/streams-sd_flac-audiokit -> rc=0 ../examples/examples-audiokit/streams-sdmmc_wav-audiokit -> rc=0 +../examples/examples-audiokit/streams-sd_mp3-audiokit -> rc=0 ../examples/examples-audiokit/streams-synth-audiokit -> rc=0 ../examples/examples-audiokit/streams-synthbasic1-audiokit -> rc=0 ../examples/examples-audiokit/streams-synthbasic2-audiokit -> rc=0 -../examples/examples-audiokit/streams-synthbasic3-audiokit -> rc=1 +../examples/examples-audiokit/streams-synthbasic3-audiokit -> rc=0 ../examples/examples-audiokit/streams-synthstk-audiokit -> rc=0 ../examples/examples-audiokit/streams-tf-audiokit -> rc=0 ../examples/examples-tts/streams-azure_tts-i2s -> rc=0 -../examples/examples-tts/streams-espeak-audiokit -> rc=0 -../examples/examples-tts/streams-espeak-i2s -> rc=0 -../examples/examples-tts/streams-flite-audiokit -> rc=0 -../examples/examples-tts/streams-flite-i2s -> rc=0 +../examples/examples-tts/streams-espeak-audiokit -> rc=1 +../examples/examples-tts/streams-espeak-i2s -> rc=1 +../examples/examples-tts/streams-flite-audiokit -> rc=1 +../examples/examples-tts/streams-flite-i2s -> rc=1 ../examples/examples-tts/streams-google-audiokit -> rc=0 ../examples/examples-tts/streams-sam-audiokit -> rc=0 ../examples/examples-tts/streams-sam-i2s -> rc=0 @@ -135,25 +137,25 @@ ../examples/examples-dsp/examples-faust/streams-i2s-faust_copy-i2s -> rc=0 ../examples/examples-dsp/examples-faust/streams-i2s-faust_guitarix-i2s -> rc=0 ../examples/examples-dsp/examples-faust/streams-i2s-faust_pitchshift-i2s -> rc=0 -../examples/examples-communication/a2dp/base-adc-a2dp -> rc=0 -../examples/examples-communication/a2dp/base-generator-a2dp -> rc=0 -../examples/examples-communication/a2dp/base-i2s-a2dp -> rc=0 -../examples/examples-communication/a2dp/base-player-a2dp -> rc=0 ../examples/examples-communication/a2dp/basic-a2dp-audiokit -> rc=0 ../examples/examples-communication/a2dp/basic-a2dp-eq-audiokit -> rc=0 ../examples/examples-communication/a2dp/basic-a2dp-fft -> rc=0 ../examples/examples-communication/a2dp/basic-a2dp-fft-led -> rc=0 -../examples/examples-communication/a2dp/basic-a2dp-i2s -> rc=1 +../examples/examples-communication/a2dp/basic-a2dp-i2s -> rc=0 ../examples/examples-communication/a2dp/basic-a2dp-mixer-i2s -> rc=0 -../examples/examples-communication/a2dp/basic-a2dp-spdif -> rc=0 +../examples/examples-communication/a2dp/basic-adc-a2dp -> rc=0 ../examples/examples-communication/a2dp/basic-audiokit-a2dp -> rc=0 +../examples/examples-communication/a2dp/basic-generator-a2dp -> rc=0 +../examples/examples-communication/a2dp/basic-i2s-a2dp -> rc=0 +../examples/examples-communication/a2dp/basic-player-a2dp -> rc=0 ../examples/examples-communication/a2dp/player-sd_a2dp-audiokit -> rc=0 ../examples/examples-communication/a2dp/player-sdfat-a2dp -> rc=0 ../examples/examples-communication/a2dp/streams-a2dp-audiokit -> rc=0 ../examples/examples-communication/a2dp/streams-a2dp-serial -> rc=0 +../examples/examples-communication/a2dp/streams-a2dp-spdif -> rc=0 ../examples/examples-communication/a2dp/streams-generator-a2dp -> rc=0 ../examples/examples-communication/a2dp/streams-i2s-a2dp -> rc=0 -../examples/examples-communication/a2dp/streams-synth-a2dp -> rc=1 +../examples/examples-communication/a2dp/streams-synth-a2dp -> rc=0 ../examples/examples-communication/esp-now/codec/communication-codec-espnow-receive -> rc=0 ../examples/examples-communication/esp-now/codec/communication-codec-espnow-receive_measure -> rc=0 ../examples/examples-communication/esp-now/codec/communication-codec-espnow-send -> rc=0 @@ -172,16 +174,16 @@ ../examples/examples-communication/vban/streams-audiokit-vban -> rc=0 ../examples/examples-communication/vban/streams-generator-vban -> rc=0 ../examples/examples-communication/vban/streams-vban-audiokit -> rc=0 -../examples/examples-communication/rtsp/communication-audiokit-rtsp -> rc=1 -../examples/examples-communication/rtsp/communication-codec-rtsp -> rc=1 -../examples/examples-communication/rtsp/communication-generator-rtsp -> rc=1 +../examples/examples-communication/rtsp/communication-audiokit-rtsp -> rc=0 +../examples/examples-communication/rtsp/communication-codec-rtsp -> rc=0 +../examples/examples-communication/rtsp/communication-generator-rtsp -> rc=0 ../examples/examples-communication/rtsp/communication-rtsp-audiokit -> rc=0 ../examples/examples-communication/rtsp/communication-rtsp-i2s -> rc=0 ../examples/examples-communication/serial/send-8bit-receive -> rc=0 -../examples/examples-communication/serial/send-adpcm_framed-receive -> rc=1 +../examples/examples-communication/serial/send-adpcm_framed-receive -> rc=0 ../examples/examples-communication/serial/send-adpcm-receive -> rc=0 ../examples/examples-communication/serial/send-receive -> rc=0 -../examples/examples-communication/snapcast/snapclient-i2s -> rc=1 +../examples/examples-communication/snapcast/snapclient-i2s -> rc=0 ../examples/examples-communication/spi/spi-master -> rc=0 ../examples/examples-communication/spi/spi-slave-esp32 -> rc=0 ../examples/examples-communication/spi/spi-slave-rp2040 -> rc=1 @@ -189,7 +191,8 @@ ../examples/examples-communication/http-client/player-url_icy-audiokit -> rc=0 ../examples/examples-communication/http-client/player-url_icy-i2s -> rc=0 ../examples/examples-communication/http-client/player-url_subclass-i2s -> rc=0 -../examples/examples-communication/http-client/streams-eth_url_mp3_helix-i2s -> rc=1 +../examples/examples-communication/http-client/streams-eth_url_mp3_helix-i2s -> rc=0 +../examples/examples-communication/http-client/streams-http_post -> rc=0 ../examples/examples-communication/http-client/streams-url_aac-audiokit -> rc=0 ../examples/examples-communication/http-client/streams-url_aac-i2s -> rc=0 ../examples/examples-communication/http-client/streams-url-file -> rc=0 @@ -202,7 +205,8 @@ ../examples/examples-communication/http-client/streams-url_mp3_mad-i2s -> rc=0 ../examples/examples-communication/http-client/streams-url_mp3-metadata -> rc=0 ../examples/examples-communication/http-client/streams-url_mp3-metadata2 -> rc=0 -../examples/examples-communication/http-client/streams-url_mts-hex -> rc=1 +../examples/examples-communication/http-client/streams-url_mts-hex -> rc=0 +../examples/examples-communication/http-client/streams-url_post -> rc=0 ../examples/examples-communication/http-client/streams-url_raw-i2s -> rc=0 ../examples/examples-communication/http-client/streams-url_raw-serial -> rc=0 ../examples/examples-communication/http-client/streams-url_vorbis_i2s -> rc=0 @@ -233,7 +237,7 @@ ../examples/tests/codecs/test-codec-adpcm-xq -> rc=0 ../examples/tests/codecs/test-codec-aptx -> rc=0 ../examples/tests/codecs/test-codec-base64 -> rc=0 -../examples/tests/codecs/test-codec-codec2 -> rc=0 +../examples/tests/codecs/test-codec-codec2 -> rc=1 ../examples/tests/codecs/test-codec-flac -> rc=0 ../examples/tests/codecs/test-codec-g711_alaw -> rc=0 ../examples/tests/codecs/test-codec-g711_ulaw -> rc=0 @@ -248,20 +252,22 @@ ../examples/tests/codecs/test-codec-opus -> rc=0 ../examples/tests/codecs/test-codec-opusogg -> rc=0 ../examples/tests/codecs/test-codec-sbc -> rc=0 -../examples/tests/codecs/test-compile-all -> rc=1 +../examples/tests/codecs/test-compile-all -> rc=0 ../examples/tests/codecs/test-container-binary -> rc=0 ../examples/tests/codecs/test-container-binary-meta -> rc=0 ../examples/tests/codecs/test-container-ogg -> rc=0 ../examples/tests/codecs/test-memory-helix -> rc=0 ../examples/tests/codecs/test-mp3-helix -> rc=0 ../examples/tests/codecs/test-mp3-helix-reading -> rc=0 -../examples/tests/codecs/test-mp3-mad -> rc=0 -../examples/tests/codecs/test-streaming-adapter -> rc=0 -../examples/tests/communications/* -> rc=1 ../examples/tests/concurrency/NBuffer -> rc=0 ../examples/tests/concurrency/synchBufferRTOS -> rc=0 ../examples/tests/concurrency/synchNBuffer -> rc=0 ../examples/tests/concurrency/synchRingBuffer -> rc=0 +../examples/tests/conversion/channel-converter-avg -> rc=0 +../examples/tests/conversion/channel-converter-bin -> rc=0 +../examples/tests/conversion/channel-converter-bindiff -> rc=0 +../examples/tests/conversion/channel-converter-decimate -> rc=0 +../examples/tests/conversion/channel-converter-diff -> rc=0 ../examples/tests/conversion/channel-converter-increase-in -> rc=0 ../examples/tests/conversion/channel-converter-increase-out -> rc=0 ../examples/tests/conversion/channel-converter-reduce-in -> rc=0 @@ -289,10 +295,11 @@ ../examples/tests/fft/fft-cmsis -> rc=1 ../examples/tests/fft/fft-esp32 -> rc=0 ../examples/tests/fft/fft-espressif -> rc=0 -../examples/tests/fft/fft-kiss -> rc=0 +../examples/tests/fft/fft-kiss -> rc=1 ../examples/tests/fft/fft-real -> rc=0 ../examples/tests/fft/fft-topn -> rc=0 ../examples/tests/fft/fft-window -> rc=0 +../examples/tests/filters/test-90deg -> rc=0 ../examples/tests/filters/test-filter -> rc=0 ../examples/tests/filters/test-median-filter -> rc=0 ../examples/tests/performance/mp3-Speed -> rc=0 diff --git a/examples/examples-communication/serial/send-adpcm_framed-receive/send-adpcm_framed-receive.ino b/examples/examples-communication/serial/send-adpcm_framed-receive/send-adpcm_framed-receive.ino index cd082bd38..063274c55 100644 --- a/examples/examples-communication/serial/send-adpcm_framed-receive/send-adpcm_framed-receive.ino +++ b/examples/examples-communication/serial/send-adpcm_framed-receive/send-adpcm_framed-receive.ino @@ -28,8 +28,8 @@ ADPCMEncoder enc(AV_CODEC_ID_ADPCM_IMA_WAV); ADPCMDecoder dec(AV_CODEC_ID_ADPCM_IMA_WAV); BinaryContainerEncoder bin_enc(&enc); BinaryContainerDecoder bin_dec(&dec); -EncodedAudioStream enc_stream(&serial, &bin_enc); -EncodedAudioStream dec_stream(&out, &bin_dec); +EncodedAudioOutput enc_stream(&serial, &bin_enc); +EncodedAudioOutput dec_stream(&out, &bin_dec); Throttle throttle(enc_stream); static int frame_size = 498; StreamCopy copierOut(throttle, sound, frame_size); // copies sound into Serial diff --git a/examples/examples-communication/snapcast/snapclient-i2s/snapclient-i2s.h b/examples/examples-communication/snapcast/snapclient-i2s/snapclient-i2s.ino similarity index 71% rename from examples/examples-communication/snapcast/snapclient-i2s/snapclient-i2s.h rename to examples/examples-communication/snapcast/snapclient-i2s/snapclient-i2s.ino index 6125ec21b..56c5c7509 100644 --- a/examples/examples-communication/snapcast/snapclient-i2s/snapclient-i2s.h +++ b/examples/examples-communication/snapcast/snapclient-i2s/snapclient-i2s.ino @@ -24,11 +24,14 @@ OpusAudioDecoder opus; I2SStream out; -SnapClient client(out, opus); +WiFiClient wifi; +SnapTimeSyncDynamic synch(172, 10); // optional configuratioin +SnapClient client(wifi, out, opus); void setup() { Serial.begin(115200); - // login to wifi + + // login to wifi -> Define values in SnapConfig.h or replace them here WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD); Serial.print("Connecting to WiFi .."); while (WiFi.status() != WL_CONNECTED) { @@ -42,13 +45,18 @@ void setup() { // setup I2S to define custom pins auto cfg = out.defaultConfig(); - config.pin_bck = 14; - config.pin_ws = 15; - config.pin_data = 22; + cfg.pin_bck = 14; + cfg.pin_ws = 15; + cfg.pin_data = 22; + //cfg.buffer_size = 512; + //cfg.buffer_count = 6; out.begin(cfg); + // Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here + // client.setServerIP(IPAddress(192,168,1,38)); + // start snap client - client.begin(); + client.begin(synch); } void loop() { diff --git a/examples/examples-dsp/examples-mozzi/audio_input/audio_input.ino b/examples/examples-dsp/examples-mozzi/audio_input/audio_input.ino index 00f8dddc1..06b579265 100644 --- a/examples/examples-dsp/examples-mozzi/audio_input/audio_input.ino +++ b/examples/examples-dsp/examples-mozzi/audio_input/audio_input.ino @@ -43,7 +43,7 @@ void setup() { void updateControl() {} -int updateAudio() { +mozzi_ns::AudioOutput updateAudio() { int asig = mozzi.getAudioInput(); // range 0-1023 asig = asig - 512; // now range is -512 to 511 // output range in STANDARD mode is -244 to 243, diff --git a/examples/examples-dsp/examples-mozzi/control_gain-a2dp/control_gain-a2dp.ino b/examples/examples-dsp/examples-mozzi/control_gain-a2dp/control_gain-a2dp.ino index 4c2b8ce79..788ab5c26 100644 --- a/examples/examples-dsp/examples-mozzi/control_gain-a2dp/control_gain-a2dp.ino +++ b/examples/examples-dsp/examples-mozzi/control_gain-a2dp/control_gain-a2dp.ino @@ -53,7 +53,7 @@ void updateControl() { gain = gain - 3; } -int updateAudio() { +mozzi_ns::AudioOutput updateAudio() { // shift back to STANDARD audio range, like /256 but faster return (aSin.next() * gain) >> 8; } diff --git a/examples/examples-dsp/examples-mozzi/control_gain/control_gain.ino b/examples/examples-dsp/examples-mozzi/control_gain/control_gain.ino index 99bef40c7..6d8cef90b 100644 --- a/examples/examples-dsp/examples-mozzi/control_gain/control_gain.ino +++ b/examples/examples-dsp/examples-mozzi/control_gain/control_gain.ino @@ -46,7 +46,7 @@ void updateControl() { gain = gain - 3; } -int updateAudio() { +mozzi_ns::AudioOutput updateAudio() { return (aSin.next() * gain) >> 8; // shift back to STANDARD audio range, like /256 but faster } \ No newline at end of file diff --git a/examples/examples-stream/streams-generator-merge-pwm/streams-generator-merge-pwm.ino b/examples/examples-stream/streams-generator-merge-pwm/streams-generator-merge-pwm.ino index 59e2af42a..ea8362859 100644 --- a/examples/examples-stream/streams-generator-merge-pwm/streams-generator-merge-pwm.ino +++ b/examples/examples-stream/streams-generator-merge-pwm/streams-generator-merge-pwm.ino @@ -15,7 +15,7 @@ SineWaveGenerator sineWave2(32000); // subclass of SoundGenerator with GeneratedSoundStream sound2(sineWave2); // Stream generated from sine wave InputMerge imerge; PWMAudioOutput pwm; -StreamCopy copier(pwm, merge); // copy in to out +StreamCopy copier(pwm, imerge); // copy in to out void setup() { diff --git a/examples/tests/etc/test-tdm/test-tdm.ino b/examples/tests/etc/test-tdm/test-tdm.ino index 42a1d2fd1..04a67a7fb 100644 --- a/examples/tests/etc/test-tdm/test-tdm.ino +++ b/examples/tests/etc/test-tdm/test-tdm.ino @@ -12,7 +12,7 @@ InputMerge imerge; // merge to 8 channels DriverPins dac_pins; AudioBoard board(AudioDriverCS42448, dac_pins); AudioBoardStream tdm(board); -StreamCopy copier(tdm, merge); +StreamCopy copier(tdm, imerge); // we use the AudioBoard API to set up the pins for the DAC void setupDACPins() { diff --git a/src/AudioCodecs/AudioEncoded.h b/src/AudioCodecs/AudioEncoded.h index 67c936e75..845db33a0 100644 --- a/src/AudioCodecs/AudioEncoded.h +++ b/src/AudioCodecs/AudioEncoded.h @@ -382,6 +382,9 @@ class EncodedAudioStream : public ReformatBaseStream { void setLogLevel(AudioLogger::LogLevel level) { enc_out.setLogLevel(level); } #endif + /// defines the size of the decoded frame in bytes + void setFrameSize(int size) { enc_out.setFrameSize(size); } + protected: EncodedAudioOutput enc_out; diff --git a/src/AudioLibs/HLSStream.h b/src/AudioLibs/HLSStream.h index 6db77cd52..c2ed194f2 100644 --- a/src/AudioLibs/HLSStream.h +++ b/src/AudioLibs/HLSStream.h @@ -104,7 +104,7 @@ class URLLoaderHLS : public URLLoaderHLSBase { #if USE_TASK LockGuard lock_guard{mutex}; #endif - urls.push_back(str); + urls.push_back((const char*)str); } /// Provides the number of open urls which can be played. Refills them, when @@ -255,7 +255,7 @@ class URLHistory { if (!found) { char *str = new char[url_str.length() + 1]; memcpy(str, url, url_str.length() + 1); - history.push_back(str); + history.push_back((const char*)str); if (history.size() > 20) { delete (history[0]); history.pop_front(); diff --git a/src/AudioLibs/MozziStream.h b/src/AudioLibs/MozziStream.h index ef0f03ab1..ae0a8f05d 100644 --- a/src/AudioLibs/MozziStream.h +++ b/src/AudioLibs/MozziStream.h @@ -1,10 +1,13 @@ -#include #include "AudioTools.h" +namespace mozzi_ns { +#include +} + void updateControl(); -int updateAudio(); +mozzi_ns::AudioOutput updateAudio(); namespace audio_tools { @@ -142,7 +145,7 @@ class MozziStream : public AudioStream, public VolumeSupport { } // updateAudio() STANDARD mode is between -244 and 243 inclusive - int result = updateAudio() * cfg.output_volume; + auto result = updateAudio() * cfg.output_volume; // clip result if (result > 32767) result = 32767; if (result < -32768) result = -32768; diff --git a/src/AudioTools/BaseStream.h b/src/AudioTools/BaseStream.h index 0f4713ecf..5e3391a14 100644 --- a/src/AudioTools/BaseStream.h +++ b/src/AudioTools/BaseStream.h @@ -563,13 +563,13 @@ public: SmoothTransition clean_start(channels, true, false, factor); auto first = *list().begin(); if (first!=nullptr){ - clean_start.convert(first->data,first->len); + clean_start.convert(&(first->data[0]),first->len); } SmoothTransition clean_end(channels, false, true, factor); auto last = * (--(list().end())); if (last!=nullptr){ - clean_end.convert(last->data,last->len); + clean_end.convert(&(last->data[0]),last->len); } } diff --git a/src/Communication/UDPStream.h b/src/Communication/UDPStream.h index 6a003fe32..1cafc417f 100644 --- a/src/Communication/UDPStream.h +++ b/src/Communication/UDPStream.h @@ -109,9 +109,9 @@ public: /// Reads bytes using WiFi::readBytes size_t readBytes(uint8_t *data, size_t len) override { TRACED(); - size_t len = available(); + size_t avail = available(); size_t bytes_read = 0; - if (len > 0) { + if (avail > 0) { // get the data now bytes_read = p_udp->readBytes((uint8_t *)data, len); }