Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0a4a00757 | ||
|
|
c93201483f | ||
|
|
a6141473fb | ||
|
|
b837e7d36a | ||
|
|
51a584c2b7 | ||
|
|
492a5beba4 | ||
|
|
89a5a07712 | ||
|
|
b3c41668a2 | ||
|
|
139fba4116 | ||
|
|
b7d89058dd | ||
|
|
e306df208c | ||
|
|
f6c0d562f8 | ||
|
|
60b93433d8 | ||
|
|
0abcf71012 | ||
|
|
12131e9826 | ||
|
|
4ba7df1928 | ||
|
|
0b5da0e9dd | ||
|
|
46b36574ed | ||
|
|
f95f15fcb3 | ||
|
|
72ed4f76dd | ||
|
|
a323627243 | ||
|
|
93c4e3a15a | ||
|
|
bf31f0f8be | ||
|
|
e24223e3d5 | ||
|
|
6d3b8665f4 | ||
|
|
02225bcaa9 | ||
|
|
c4bf70bccf | ||
|
|
3b329b8201 |
No files matched your search
@@ -20,10 +20,10 @@ jobs:
|
||||
matrix:
|
||||
chunk: [0, 1, 2, 3, 4]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Build Sketches
|
||||
@@ -43,10 +43,10 @@ jobs:
|
||||
matrix:
|
||||
chunk: [0, 1, 2, 3, 4]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Build Sketches
|
||||
@@ -66,10 +66,10 @@ jobs:
|
||||
matrix:
|
||||
chunk: [0, 1, 2, 3, 4]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Build Sketches
|
||||
@@ -87,10 +87,10 @@ jobs:
|
||||
name: Host tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Run host tests
|
||||
@@ -115,7 +115,7 @@ jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: arduino/arduino-lint-action@v1
|
||||
with:
|
||||
library-manager: 'update'
|
||||
@@ -128,11 +128,11 @@ jobs:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Run codespell
|
||||
uses: codespell-project/actions-codespell@master
|
||||
with:
|
||||
skip: ./src/libmad,./src/libhelix-aac,./src/libopus
|
||||
skip: ./src/libmad,./src/libhelix-aac,./src/libopus,./src/libflac
|
||||
ignore_words_list: ESP8266,esp8266,esp,dout,DOUT,ser,ans,inout,numer,hist
|
||||
@@ -1,39 +1,30 @@
|
||||
# ESP8266Audio - supports ESP8266 & ESP32 & Raspberry Pi RP2040 [](https://gitter.im/ESP8266Audio/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
# ESP8266Audio - supports ESP8266 & ESP32 & Raspberry Pi Pico RP2040 [](https://gitter.im/ESP8266Audio/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
Arduino library for parsing and decoding MOD, WAV, MP3, FLAC, MIDI, AAC, and RTTL files and playing them on an I2S DAC or even using a software-simulated delta-sigma DAC with dynamic 32x-128x oversampling.
|
||||
|
||||
ESP8266 is fully supported and most mature, but ESP32 is also mostly there with built-in DAC as well as external ones.
|
||||
|
||||
For real-time, autonomous speech synthesis, check out [ESP8266SAM](https://github.com/earlephilhower/ESP8266SAM), a library which uses this one and a port of an ancient format-based synthesis program to allow your ESP8266 to talk with low memory and no network required.
|
||||
For real-time, autonomous speech synthesis, check out [ESP8266SAM](https://github.com/earlephilhower/ESP8266SAM), a library which uses this one and a port of an ancient formant-based synthesis program to allow your ESP8266 to talk with low memory and no network required.
|
||||
|
||||
## Disclaimer
|
||||
All this code is released under the GPL, and all of it is to be used at your own risk. If you find any bugs, please let me know via the GitHub issue tracker or drop me an email. The MOD and MP3 routines were taken from StellaPlayer and libMAD respectively. The software I2S delta-sigma 32x oversampling DAC was my own creation, and sounds quite good if I do say so myself.
|
||||
All this code is released under the GPL, and all of it is to be used at your own risk. If you find any bugs, please let me know via the GitHub issue tracker or drop me an email.
|
||||
|
||||
The AAC decode code is from the Helix project and licensed under RealNetwork's RSPL license. For commercial use you're still going to need the usual AAC licensing from [Via Licensing](http://www.via-corp.com/us/en/licensing/aac/overview.html).
|
||||
|
||||
On the ESP32, AAC-SBR is supported (many webradio stations use this to reduce bandwidth even further). The ESP8266, however, does not support it due to a lack of onboard RAM.
|
||||
|
||||
MIDI decoding comes from a highly ported [MIDITONES](https://github.com/LenShustek/miditones) combined with a massively memory-optimized [TinySoundFont](https://github.com/schellingb/TinySoundFont), see the respective source files for more information.
|
||||
|
||||
Opus, OGG, and OpusFile are from [Xiph.org](https://xiph.org) with the Xiph license and patent described in src/{opusfile,libggg,libopus}/COPYING.. **NOTE** Opus decoding currently only works on the ESP32 due to the large memory requirements of opusfile. PRs to rewrite it to be less memory intensive would be much appreciated.
|
||||
* The MOD and MP3 routines were taken from StellarPlayer and libMAD respectively.
|
||||
* The software I2S delta-sigma 32x oversampling DAC was my own creation, and sounds quite good if I do say so myself.
|
||||
* The AAC decode code is from the Helix project and licensed under RealNetwork's RSPL license. For commercial use you're still going to need the usual AAC licensing from [Via Licensing](http://www.via-corp.com/us/en/licensing/aac/overview.html). On the ESP32, AAC-SBR is supported (many webradio stations use this to reduce bandwidth even further). The ESP8266, however, does not support it due to a lack of onboard RAM.
|
||||
* MIDI decoding comes from a highly ported [MIDITONES](https://github.com/LenShustek/miditones) combined with a massively memory-optimized [TinySoundFont](https://github.com/schellingb/TinySoundFont), see the respective source files for more information.
|
||||
* Opus, OGG, and OpusFile are from [Xiph.org](https://xiph.org) with the Xiph license and patent described in src/{opusfile,libggg,libopus}/COPYING.. **NOTE** Opus decoding currently only works on the ESP32 due to the large memory requirements of opusfile. PRs to rewrite it to be less memory intensive would be much appreciated.
|
||||
|
||||
## Neat Things People Have Done With ESP8266Audio
|
||||
If you have a neat use for this library, [I'd love to hear about it](mailto:earlephilhower@yahoo.com)!
|
||||
|
||||
My personal use of the ESP8266Audio library is only to drive a 3D-printed, network-time-setting alarm clock for my kids which can play an MP3 instead of a bell to wake them up, called [Psychoclock](https://github.com/earlephilhower/psychoclock).
|
||||
|
||||
Harald Sattler has built a neat German [word clock with MP3 alarm](http://www.harald-sattler.de/html/mini-wecker.htm). Detailed discussion on the process and models are included.
|
||||
|
||||
Erich Heinemann has developed a Stomper (instrument for playing samples in real-time during a live stage performance) that you can find more info about [here](https://github.com/ErichHeinemann/hman-stomper).
|
||||
|
||||
Dagnall53 has integrated this into a really neat MQTT based model train controller to add sounds to his set. More info is available [here](https://github.com/dagnall53/ESPMQTTRocnetSound), including STL files for 3D printed components!
|
||||
|
||||
JohannesMTC has built a similar project especially for model trains: https://github.com/JohannesMTC/ESP32_MAS
|
||||
|
||||
A neat MQTT-driven ESP8266 light-and-sound device (alarm? toy? who can say!) was built by @CosmicMac, available at https://github.com/CosmicMac/ESParkle
|
||||
|
||||
A very interesting "linear clock" with a stepper motor, NTP time keeping, and configurable recorded chimes with schematics, 3D printer plans, and source code, is now available https://janderogee.com/projects/linear_clock/linear_clock.htm
|
||||
|
||||
Source and instructions for a gorgeous wooden MP3-playing clock, FM radio and a walkie-talkie using the ESP8266 and AVR microcontrollers is available https://github.com/zduka/mp3-player
|
||||
* My personal use of the ESP8266Audio library is only to drive a 3D-printed, network-time-setting alarm clock for my kids which can play an MP3 instead of a bell to wake them up, called [Psychoclock](https://github.com/earlephilhower/psychoclock).
|
||||
* Harald Sattler has built a neat German [word clock with MP3 alarm](http://www.harald-sattler.de/html/mini-wecker.htm). Detailed discussion on the process and models are included.
|
||||
* Erich Heinemann has developed a Stomper (instrument for playing samples in real-time during a live stage performance) that you can find more info about [here](https://github.com/ErichHeinemann/hman-stomper).
|
||||
* Dagnall53 has integrated this into a really neat MQTT based model train controller to add sounds to his set. More info is available [here](https://github.com/dagnall53/ESPMQTTRocnetSound), including STL files for 3D printed components!
|
||||
* JohannesMTC has built a similar project especially for model trains: https://github.com/JohannesMTC/ESP32_MAS
|
||||
* A neat MQTT-driven ESP8266 light-and-sound device (alarm? toy? who can say!) was built by @CosmicMac, available at https://github.com/CosmicMac/ESParkle
|
||||
* A very interesting "linear clock" with a stepper motor, NTP time keeping, and configurable recorded chimes with schematics, 3D printer plans, and source code, is now available https://janderogee.com/projects/linear_clock/linear_clock.htm
|
||||
* Source and instructions for a gorgeous wooden MP3-playing clock, FM radio and a walkie-talkie using the ESP8266 and AVR microcontrollers is available https://github.com/zduka/mp3-player
|
||||
|
||||
## Prerequisites
|
||||
First, make sure you are running the 2.6.3/later or GIT head version of the Arduino libraries for ESP8266, or the latest ESP32 SDK from Espressif.
|
||||
@@ -265,10 +256,11 @@ I've been told the Wemos SD card shield uses GPIO15 as the SD chip select. This
|
||||
There's no ESP8266-specific code in the AudioGenerator routines, so porting to other controllers should be relatively easy assuming they have the same endianness as the Xtensa core used. Drop me a line if you're doing this, I may be able to help point you in the right direction.
|
||||
|
||||
## Thanks
|
||||
Thanks to the authors of StellaPlayer and libMAD for releasing their code freely, and to the maintainers and contributors to the ESP8266 Arduino port.
|
||||
Thanks to the authors of StellarPlayer and libMAD for releasing their code freely, and to the maintainers and contributors to the ESP8266 Arduino port.
|
||||
|
||||
Also, big thanks to @tueddy for getting the initial ESP32 porting into the tree!
|
||||
|
||||
-Earle F. Philhower, III
|
||||
|
||||
earlephilhower@yahoo.com
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
// Do not build on GCC8, GCC8 has a compiler bug
|
||||
// Do not build on Espressif GCC8+, compiler bug
|
||||
|
||||
#if defined(ARDUINO_ARCH_RP2040) || (__GNUC__ == 8)
|
||||
#if defined(ARDUINO_ARCH_RP2040) || (defined(ESP32) && (__GNUC__ >= 8) && (__XTENSA__))
|
||||
void setup() {}
|
||||
void loop() {}
|
||||
#else
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,47 @@
|
||||
#include <Arduino.h>
|
||||
#include "AudioFileSourcePROGMEM.h"
|
||||
#include "AudioGeneratorMOD.h"
|
||||
#include "AudioOutputPWM.h"
|
||||
|
||||
#if !defined(ARDUINO_ARCH_RP2040)
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.printf("Only for the RP2040/Raspberry Pi Pico\n");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
}
|
||||
#else
|
||||
|
||||
// 5_steps.mod sample from the mod archive: https://modarchive.org/
|
||||
#include "5steps.h"
|
||||
|
||||
AudioGeneratorMOD *mod;
|
||||
AudioFileSourcePROGMEM *file;
|
||||
AudioOutputPWM *out;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
|
||||
audioLogger = &Serial;
|
||||
file = new AudioFileSourcePROGMEM(steps_mod, sizeof(steps_mod));
|
||||
out = new AudioOutputPWM();
|
||||
mod = new AudioGeneratorMOD();
|
||||
mod->SetBufferSize(3*1024);
|
||||
mod->SetSampleRate(44100);
|
||||
mod->SetStereoSeparation(32);
|
||||
mod->begin(file, out);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
if (mod->isRunning()) {
|
||||
if (!mod->loop()) mod->stop();
|
||||
} else {
|
||||
Serial.printf("MOD done\n");
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -23,6 +23,7 @@ AudioOutput KEYWORD1
|
||||
AudioOutputI2S KEYWORD1
|
||||
AudioOutputI2SNoDAC KEYWORD1
|
||||
AudioOutputI2SClass KEYWORD1
|
||||
AudioOutputPWM KEYWORD1
|
||||
AudioOutputNull KEYWORD1
|
||||
AudioOutputBuffer KEYWORD1
|
||||
AudioOutputSerialWAV KEYWORD1
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/earlephilhower/ESP8266Audio"
|
||||
},
|
||||
"version": "1.9.7",
|
||||
"version": "1.9.9",
|
||||
"homepage": "https://github.com/earlephilhower/ESP8266Audio",
|
||||
"frameworks": "Arduino",
|
||||
"examples": [
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
name=ESP8266Audio
|
||||
version=1.9.7
|
||||
version=1.9.9
|
||||
author=Earle F. Philhower, III
|
||||
maintainer=Earle F. Philhower, III
|
||||
sentence=Audio file and I2S sound playing routines for ESP8266, ESP32, and Raspberry Pi Pico RP2040
|
||||
|
||||
@@ -102,7 +102,11 @@ retry:
|
||||
}
|
||||
if ((size > 0) && (pos >= size)) return 0;
|
||||
|
||||
#if defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR >= 3
|
||||
NetworkClient *stream = http.getStreamPtr();
|
||||
#else
|
||||
WiFiClient *stream = http.getStreamPtr();
|
||||
#endif
|
||||
|
||||
// Can't read past EOF...
|
||||
if ( (size > 0) && (len > (uint32_t)(pos - size)) ) len = pos - size;
|
||||
|
||||
@@ -53,7 +53,11 @@ class AudioFileSourceHTTPStream : public AudioFileSource
|
||||
|
||||
private:
|
||||
virtual uint32_t readInternal(void *data, uint32_t len, bool nonBlock);
|
||||
#if defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR >= 3
|
||||
NetworkClient client;
|
||||
#else
|
||||
WiFiClient client;
|
||||
#endif
|
||||
HTTPClient http;
|
||||
int pos;
|
||||
int size;
|
||||
|
||||
@@ -115,7 +115,11 @@ retry:
|
||||
}
|
||||
if ((size > 0) && (pos >= size)) return 0;
|
||||
|
||||
#if defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR >= 3
|
||||
NetworkClient *stream = http.getStreamPtr();
|
||||
#else
|
||||
WiFiClient *stream = http.getStreamPtr();
|
||||
#endif
|
||||
|
||||
// Can't read past EOF...
|
||||
if ( (size > 0) && (len > (uint32_t)(pos - size)) ) len = pos - size;
|
||||
|
||||
@@ -196,7 +196,7 @@ char AudioGeneratorFLAC::error_cb_str[64];
|
||||
void AudioGeneratorFLAC::error_cb(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status)
|
||||
{
|
||||
(void) decoder;
|
||||
strncpy_P(error_cb_str, FLAC__StreamDecoderErrorStatusString[status], 64);
|
||||
strncpy_P(error_cb_str, FLAC__StreamDecoderErrorStatusString[status], sizeof(AudioGeneratorFLAC::error_cb_str) - 1);
|
||||
cb.st((int)status, error_cb_str);
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
|
||||
#include "AudioGeneratorMIDI.h"
|
||||
|
||||
#if __GNUC__ == 8
|
||||
// Do not build, GCC8 has a compiler bug
|
||||
#if defined(ESP32) && (__GNUC__ >= 8) && (__XTENSA__)
|
||||
// Do not build, Espressif's GCC8+ has a compiler bug
|
||||
#else // __GNUC__ == 8
|
||||
|
||||
#pragma GCC optimize ("O3")
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#ifndef _AUDIOGENERATORMIDI_H
|
||||
#define _AUDIOGENERATORMIDI_H
|
||||
|
||||
#if __GNUC__ == 8
|
||||
// Do not build, GCC8 has a compiler bug
|
||||
#if defined(ESP32) && (__GNUC__ >= 8) && (__XTENSA__)
|
||||
// Do not build, Espressif's GCC8+ has a compiler bug
|
||||
#else // __GNUC__ == 8
|
||||
|
||||
#include "AudioGenerator.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
AudioGeneratorMP3
|
||||
Wrap libmad MP3 library to play audio
|
||||
|
||||
|
||||
Copyright (C) 2017 Earle F. Philhower, III
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -62,7 +62,7 @@ AudioGeneratorMP3::~AudioGeneratorMP3()
|
||||
free(synth);
|
||||
free(frame);
|
||||
free(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ bool AudioGeneratorMP3::GetOneSample(int16_t sample[2])
|
||||
output->SetChannels(synth->pcm.channels);
|
||||
lastChannels = synth->pcm.channels;
|
||||
}
|
||||
|
||||
|
||||
// If we're here, we have one decoded frame and sent 0 or more samples out
|
||||
if (samplePtr < synth->pcm.length) {
|
||||
sample[AudioOutput::LEFTCHANNEL ] = synth->pcm.samples[0][samplePtr];
|
||||
@@ -190,7 +190,7 @@ bool AudioGeneratorMP3::GetOneSample(int16_t sample[2])
|
||||
samplePtr++;
|
||||
} else {
|
||||
samplePtr = 0;
|
||||
|
||||
|
||||
switch ( mad_synth_frame_onens(synth, frame, nsCount++) ) {
|
||||
case MAD_FLOW_STOP:
|
||||
case MAD_FLOW_BREAK: audioLogger->printf_P(PSTR("msf1ns failed\n"));
|
||||
@@ -248,6 +248,10 @@ retry:
|
||||
running = false;
|
||||
goto done;
|
||||
}
|
||||
if (lastChannels == 1)
|
||||
{
|
||||
lastSample[1] = lastSample[0];
|
||||
}
|
||||
} while (running && output->ConsumeSample(lastSample));
|
||||
|
||||
done:
|
||||
@@ -298,6 +302,7 @@ bool AudioGeneratorMP3::begin(AudioFileSource *source, AudioOutput *output)
|
||||
synth = reinterpret_cast<struct mad_synth *>(preallocateSynthSpace);
|
||||
}
|
||||
else {
|
||||
output->stop();
|
||||
audioLogger->printf_P("OOM error in MP3: Want %d/%d/%d/%d bytes, have %d/%d/%d/%d bytes preallocated.\n",
|
||||
preAllocBuffSize(), preAllocStreamSize(), preAllocFrameSize(), preAllocSynthSize(),
|
||||
preallocateSize, preallocateStreamSize, preallocateFrameSize, preallocateSynthSize);
|
||||
@@ -315,6 +320,7 @@ bool AudioGeneratorMP3::begin(AudioFileSource *source, AudioOutput *output)
|
||||
p += preAllocSynthSize();
|
||||
int neededBytes = p - reinterpret_cast<uint8_t *>(preallocateSpace);
|
||||
if (neededBytes > preallocateSize) {
|
||||
output->stop();
|
||||
audioLogger->printf_P("OOM error in MP3: Want %d bytes, have %d bytes preallocated.\n", neededBytes, preallocateSize);
|
||||
return false;
|
||||
}
|
||||
@@ -332,17 +338,20 @@ bool AudioGeneratorMP3::begin(AudioFileSource *source, AudioOutput *output)
|
||||
stream = NULL;
|
||||
frame = NULL;
|
||||
synth = NULL;
|
||||
|
||||
output->stop();
|
||||
audioLogger->printf_P("OOM error in MP3\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mad_stream_init(stream);
|
||||
mad_frame_init(frame);
|
||||
mad_synth_init(synth);
|
||||
synth->pcm.length = 0;
|
||||
mad_stream_options(stream, 0); // TODO - add options support
|
||||
madInitted = true;
|
||||
|
||||
|
||||
running = true;
|
||||
return true;
|
||||
}
|
||||
@@ -409,4 +418,3 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -236,13 +236,13 @@ bool AudioGeneratorRTTTL::GetNextNote()
|
||||
ptr++;
|
||||
note++;
|
||||
}
|
||||
if (!ReadInt(&scale)) {
|
||||
scale = defaultOctave;
|
||||
}
|
||||
if ((ptr < len) && (buff[ptr] == '.')) {
|
||||
ptr++;
|
||||
dur += dur / 2;
|
||||
}
|
||||
if (!ReadInt(&scale)) {
|
||||
scale = defaultOctave;
|
||||
}
|
||||
// Eat any trailing whitespace and comma
|
||||
SkipWhitespace();
|
||||
if ((ptr < len) && (buff[ptr]==',')) {
|
||||
|
||||
@@ -127,7 +127,7 @@ bool AudioGeneratorWAV::ReadWAVInfo()
|
||||
return false;
|
||||
};
|
||||
if (u32 != 0x46464952) {
|
||||
Serial.printf_P(PSTR("AudioGeneratorWAV::ReadWAVInfo: cannot read WAV, invalid RIFF header, got: %08X \n"), (uint32_t) u32);
|
||||
Serial.printf_P(PSTR("AudioGeneratorWAV::ReadWAVInfo: cannot read WAV, invalid RIFF header\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ bool AudioGeneratorWAV::ReadWAVInfo()
|
||||
return false;
|
||||
};
|
||||
if (u32 != 0x45564157) {
|
||||
Serial.printf_P(PSTR("AudioGeneratorWAV::ReadWAVInfo: cannot read WAV, invalid WAVE header, got: %08X \n"), (uint32_t) u32);
|
||||
Serial.printf_P(PSTR("AudioGeneratorWAV::ReadWAVInfo: cannot read WAV, invalid WAVE header\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+60
-18
@@ -49,6 +49,7 @@ AudioOutputI2S::AudioOutputI2S(int port, int output_mode, int dma_buf_count, int
|
||||
bclkPin = 26;
|
||||
wclkPin = 25;
|
||||
doutPin = 22;
|
||||
mclkPin = 0;
|
||||
SetGain(1.0);
|
||||
}
|
||||
|
||||
@@ -61,24 +62,16 @@ AudioOutputI2S::AudioOutputI2S(long sampleRate, pin_size_t sck, pin_size_t data)
|
||||
hertz = sampleRate;
|
||||
bclkPin = sck;
|
||||
doutPin = data;
|
||||
mclkPin = 0;
|
||||
use_mclk = false;
|
||||
swap_clocks = false;
|
||||
SetGain(1.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
AudioOutputI2S::~AudioOutputI2S()
|
||||
{
|
||||
#ifdef ESP32
|
||||
if (i2sOn) {
|
||||
audioLogger->printf("UNINSTALL I2S\n");
|
||||
i2s_driver_uninstall((i2s_port_t)portNo); //stop & destroy i2s driver
|
||||
}
|
||||
#elif defined(ESP8266)
|
||||
if (i2sOn)
|
||||
i2s_end();
|
||||
#elif defined(ARDUINO_ARCH_RP2040)
|
||||
stop();
|
||||
#endif
|
||||
i2sOn = false;
|
||||
stop();
|
||||
}
|
||||
|
||||
bool AudioOutputI2S::SetPinout()
|
||||
@@ -88,7 +81,9 @@ bool AudioOutputI2S::SetPinout()
|
||||
return false; // Not allowed
|
||||
|
||||
i2s_pin_config_t pins = {
|
||||
.mck_io_num = 0, // Unused
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
|
||||
.mck_io_num = mclkPin,
|
||||
#endif
|
||||
.bck_io_num = bclkPin,
|
||||
.ws_io_num = wclkPin,
|
||||
.data_out_num = doutPin,
|
||||
@@ -99,6 +94,8 @@ bool AudioOutputI2S::SetPinout()
|
||||
(void)bclkPin;
|
||||
(void)wclkPin;
|
||||
(void)doutPin;
|
||||
(void)mclkPin;
|
||||
(void)use_mclk;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
@@ -113,6 +110,22 @@ bool AudioOutputI2S::SetPinout(int bclk, int wclk, int dout)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputI2S::SetPinout(int bclk, int wclk, int dout, int mclk)
|
||||
{
|
||||
bclkPin = bclk;
|
||||
wclkPin = wclk;
|
||||
doutPin = dout;
|
||||
#ifdef ESP32
|
||||
mclkPin = mclk;
|
||||
if (i2sOn)
|
||||
return SetPinout();
|
||||
#else
|
||||
(void)mclk;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputI2S::SetRate(int hz)
|
||||
{
|
||||
// TODO - have a list of allowable rates from constructor, check them
|
||||
@@ -156,6 +169,26 @@ bool AudioOutputI2S::SetLsbJustified(bool lsbJustified)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputI2S::SwapClocks(bool swap_clocks)
|
||||
{
|
||||
if (i2sOn) {
|
||||
return false; // Not allowed
|
||||
}
|
||||
this->swap_clocks = swap_clocks;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputI2S::SetMclk(bool enabled){
|
||||
(void)enabled;
|
||||
#ifdef ESP32
|
||||
if (output_mode == INTERNAL_DAC || output_mode == INTERNAL_PDM)
|
||||
return false; // Not allowed
|
||||
|
||||
use_mclk = enabled;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputI2S::begin(bool txDAC)
|
||||
{
|
||||
#ifdef ESP32
|
||||
@@ -165,9 +198,9 @@ bool AudioOutputI2S::begin(bool txDAC)
|
||||
{
|
||||
// don't use audio pll on buggy rev0 chips
|
||||
use_apll = APLL_DISABLE;
|
||||
esp_chip_info_t out_info;
|
||||
esp_chip_info(&out_info);
|
||||
if (out_info.revision > 0)
|
||||
//esp_chip_info_t out_info;
|
||||
//esp_chip_info(&out_info);
|
||||
//if (out_info.revision > 0)
|
||||
{
|
||||
use_apll = APLL_ENABLE;
|
||||
}
|
||||
@@ -228,9 +261,11 @@ bool AudioOutputI2S::begin(bool txDAC)
|
||||
.dma_buf_len = 128,
|
||||
.use_apll = use_apll, // Use audio PLL
|
||||
.tx_desc_auto_clear = true, // Silence on underflow
|
||||
.fixed_mclk = 0, // Unused
|
||||
.mclk_multiple = I2S_MCLK_MULTIPLE_DEFAULT, // Unused
|
||||
.fixed_mclk = use_mclk, // Unused
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
|
||||
.mclk_multiple = I2S_MCLK_MULTIPLE_256, // Unused
|
||||
.bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT // Use bits per sample
|
||||
#endif
|
||||
};
|
||||
audioLogger->printf("+%d %p\n", portNo, &i2s_config_dac);
|
||||
if (i2s_driver_install((i2s_port_t)portNo, &i2s_config_dac, 0, NULL) != ESP_OK)
|
||||
@@ -277,6 +312,9 @@ bool AudioOutputI2S::begin(bool txDAC)
|
||||
if (!i2sOn) {
|
||||
i2s.setBCLK(bclkPin);
|
||||
i2s.setDATA(doutPin);
|
||||
if (swap_clocks) {
|
||||
i2s.swapClocks();
|
||||
}
|
||||
i2s.begin(hertz);
|
||||
}
|
||||
#endif
|
||||
@@ -355,6 +393,10 @@ bool AudioOutputI2S::stop()
|
||||
|
||||
#ifdef ESP32
|
||||
i2s_zero_dma_buffer((i2s_port_t)portNo);
|
||||
audioLogger->printf("UNINSTALL I2S\n");
|
||||
i2s_driver_uninstall((i2s_port_t)portNo); //stop & destroy i2s driver
|
||||
#elif defined(ESP8266)
|
||||
i2s_end();
|
||||
#elif defined(ARDUINO_ARCH_RP2040)
|
||||
i2s.end();
|
||||
#endif
|
||||
|
||||
@@ -38,6 +38,7 @@ class AudioOutputI2S : public AudioOutput
|
||||
AudioOutputI2S(long sampleRate = 44100, pin_size_t sck = 26, pin_size_t data = 28);
|
||||
#endif
|
||||
bool SetPinout(int bclkPin, int wclkPin, int doutPin);
|
||||
bool SetPinout(int bclkPin, int wclkPin, int doutPin, int mclkPin);
|
||||
virtual ~AudioOutputI2S() override;
|
||||
virtual bool SetRate(int hz) override;
|
||||
virtual bool SetBitsPerSample(int bits) override;
|
||||
@@ -50,6 +51,8 @@ class AudioOutputI2S : public AudioOutput
|
||||
bool begin(bool txDAC);
|
||||
bool SetOutputModeMono(bool mono); // Force mono output no matter the input
|
||||
bool SetLsbJustified(bool lsbJustified); // Allow supporting non-I2S chips, e.g. PT8211
|
||||
bool SetMclk(bool enabled); // Enable MCLK output (if supported)
|
||||
bool SwapClocks(bool swap_clocks); // Swap BCLK and WCLK
|
||||
|
||||
protected:
|
||||
bool SetPinout();
|
||||
@@ -61,6 +64,8 @@ class AudioOutputI2S : public AudioOutput
|
||||
bool i2sOn;
|
||||
int dma_buf_count;
|
||||
int use_apll;
|
||||
bool use_mclk;
|
||||
bool swap_clocks;
|
||||
// We can restore the old values and free up these pins when in NoDAC mode
|
||||
uint32_t orig_bck;
|
||||
uint32_t orig_ws;
|
||||
@@ -68,6 +73,7 @@ class AudioOutputI2S : public AudioOutput
|
||||
uint8_t bclkPin;
|
||||
uint8_t wclkPin;
|
||||
uint8_t doutPin;
|
||||
uint8_t mclkPin;
|
||||
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
I2S i2s;
|
||||
|
||||
@@ -43,7 +43,7 @@ class AudioOutputI2SNoDAC : public AudioOutputI2S
|
||||
|
||||
protected:
|
||||
virtual int AdjustI2SRate(int hz) override { return hz * oversample/32; }
|
||||
uint8_t oversample;
|
||||
int oversample;
|
||||
void DeltaSigma(int16_t sample[2], uint32_t dsBuff[4]);
|
||||
typedef int32_t fixed24p8_t;
|
||||
enum {fixedPosValue=0x007fff00}; /* 24.8 of max-signed-int */
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
AudioOutputPWM
|
||||
Base class for the RP2040 PWM audio
|
||||
|
||||
Copyright (C) 2023 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
#include <Arduino.h>
|
||||
#include "AudioOutputPWM.h"
|
||||
|
||||
AudioOutputPWM::AudioOutputPWM(long sampleRate, pin_size_t data) {
|
||||
pwmOn = false;
|
||||
mono = false;
|
||||
bps = 16;
|
||||
channels = 2;
|
||||
hertz = sampleRate;
|
||||
doutPin = data;
|
||||
SetGain(1.0);
|
||||
pwm.setStereo(true);
|
||||
}
|
||||
|
||||
AudioOutputPWM::~AudioOutputPWM() {
|
||||
stop();
|
||||
}
|
||||
|
||||
bool AudioOutputPWM::SetRate(int hz) {
|
||||
this->hertz = hz;
|
||||
if (pwmOn) {
|
||||
pwm.setFrequency(hz);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputPWM::SetBitsPerSample(int bits) {
|
||||
if ( (bits != 16) && (bits != 8) ) return false;
|
||||
this->bps = bits;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputPWM::SetChannels(int channels) {
|
||||
if ( (channels < 1) || (channels > 2) ) return false;
|
||||
this->channels = channels;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputPWM::SetOutputModeMono(bool mono) {
|
||||
this->mono = mono;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputPWM::begin() {
|
||||
if (!pwmOn) {
|
||||
pwm.setPin(doutPin);
|
||||
pwm.begin(hertz);
|
||||
}
|
||||
pwmOn = true;
|
||||
SetRate(hertz); // Default
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputPWM::ConsumeSample(int16_t sample[2]) {
|
||||
|
||||
if (!pwmOn)
|
||||
return false;
|
||||
|
||||
int16_t ms[2];
|
||||
|
||||
ms[0] = sample[0];
|
||||
ms[1] = sample[1];
|
||||
MakeSampleStereo16( ms );
|
||||
|
||||
if (this->mono) {
|
||||
// Average the two samples and overwrite
|
||||
int32_t ttl = ms[LEFTCHANNEL] + ms[RIGHTCHANNEL];
|
||||
ms[LEFTCHANNEL] = ms[RIGHTCHANNEL] = (ttl>>1) & 0xffff;
|
||||
}
|
||||
|
||||
if (pwm.available()) {
|
||||
pwm.write((int16_t) ms[0]);
|
||||
pwm.write((int16_t) ms[1]);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void AudioOutputPWM::flush() {
|
||||
pwm.flush();
|
||||
}
|
||||
|
||||
bool AudioOutputPWM::stop() {
|
||||
if (!pwmOn)
|
||||
return false;
|
||||
|
||||
pwm.end();
|
||||
pwmOn = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
AudioOutputPWM
|
||||
Base class for the RP2040 PWM audio output
|
||||
|
||||
Copyright (C) 2023 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "AudioOutput.h"
|
||||
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
#include <Arduino.h>
|
||||
#include <PWMAudio.h>
|
||||
|
||||
class AudioOutputPWM : public AudioOutput
|
||||
{
|
||||
public:
|
||||
AudioOutputPWM(long sampleRate = 44100, pin_size_t data = 0);
|
||||
virtual ~AudioOutputPWM() override;
|
||||
virtual bool SetRate(int hz) override;
|
||||
virtual bool SetBitsPerSample(int bits) override;
|
||||
virtual bool SetChannels(int channels) override;
|
||||
virtual bool begin() override;
|
||||
virtual bool ConsumeSample(int16_t sample[2]) override;
|
||||
virtual void flush() override;
|
||||
virtual bool stop() override;
|
||||
|
||||
bool SetOutputModeMono(bool mono); // Force mono output no matter the input
|
||||
|
||||
protected:
|
||||
bool SetPinout();
|
||||
virtual int AdjustI2SRate(int hz) { return hz; }
|
||||
uint8_t portNo;
|
||||
int output_mode;
|
||||
bool mono;
|
||||
bool pwmOn;
|
||||
|
||||
uint8_t doutPin;
|
||||
|
||||
PWMAudio pwm;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -7,7 +7,7 @@
|
||||
See: https://www.epanorama.net/documents/audio/spdif.html
|
||||
|
||||
Original idea and sources:
|
||||
Forum thread dicussing implementation
|
||||
Forum thread discussing implementation
|
||||
https://forum.pjrc.com/threads/28639-S-pdif
|
||||
Teensy Audio Library
|
||||
https://github.com/PaulStoffregen/Audio/blob/master/output_spdif2.cpp
|
||||
@@ -105,8 +105,13 @@ AudioOutputSPDIF::AudioOutputSPDIF(int dout_pin, int port, int dma_buf_count)
|
||||
.use_apll = true, // Audio PLL is needed for low clock jitter
|
||||
.tx_desc_auto_clear = true, // Silence on underflow
|
||||
.fixed_mclk = 0, // Unused
|
||||
#if defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR >= 3
|
||||
.mclk_multiple = I2S_MCLK_MULTIPLE_512, // Unused
|
||||
.bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT // Use bits per sample
|
||||
#elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
|
||||
.mclk_multiple = I2S_MCLK_MULTIPLE_DEFAULT, // Unused
|
||||
.bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT // Use bits per sample
|
||||
#endif
|
||||
};
|
||||
if (i2s_driver_install((i2s_port_t)portNo, &i2s_config_spdif, 0, NULL) != ESP_OK) {
|
||||
audioLogger->println(F("ERROR: Unable to install I2S drivers"));
|
||||
@@ -151,7 +156,9 @@ bool AudioOutputSPDIF::SetPinout(int bclk, int wclk, int dout)
|
||||
{
|
||||
#if defined(ESP32)
|
||||
i2s_pin_config_t pins = {
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
|
||||
.mck_io_num = 0, // unused
|
||||
#endif
|
||||
.bck_io_num = bclk,
|
||||
.ws_io_num = wclk,
|
||||
.data_out_num = dout,
|
||||
@@ -179,12 +186,14 @@ bool AudioOutputSPDIF::SetRate(int hz)
|
||||
int adjustedHz = AdjustI2SRate(hz);
|
||||
#if defined(ESP32)
|
||||
if (i2s_set_sample_rates((i2s_port_t)portNo, adjustedHz) == ESP_OK) {
|
||||
#if defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR < 3)
|
||||
if (adjustedHz == 88200) {
|
||||
// Manually fix the APLL rate for 44100.
|
||||
// See: https://github.com/espressif/esp-idf/issues/2634
|
||||
// sdm0 = 28, sdm1 = 8, sdm2 = 5, odir = 0 -> 88199.977
|
||||
rtc_clk_apll_enable(1, 28, 8, 5, 0);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
audioLogger->println("ERROR changing S/PDIF sample rate");
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
See: https://www.epanorama.net/documents/audio/spdif.html
|
||||
|
||||
Original idea and sources:
|
||||
Forum thread dicussing implementation
|
||||
Forum thread discussing implementation
|
||||
https://forum.pjrc.com/threads/28639-S-pdif
|
||||
Teensy Audio Library
|
||||
https://github.com/PaulStoffregen/Audio/blob/master/output_spdif2.cpp
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "AudioOutput.h"
|
||||
#include "AudioOutputI2S.h"
|
||||
#include "AudioOutputI2SNoDAC.h"
|
||||
#include "AudioOutputPWM.h"
|
||||
#include "AudioOutputMixer.h"
|
||||
#include "AudioOutputNull.h"
|
||||
#include "AudioOutputSerialWAV.h"
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
* print an error message if it fails (ie returns a value < 0).
|
||||
*
|
||||
* Ideally, a library should not print anything, but this macro is only used
|
||||
* for things that extremely unlikely to fail, like `chown` to a previoulsy
|
||||
* for things that extremely unlikely to fail, like `chown` to a previously
|
||||
* saved `uid`.
|
||||
*/
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
// return.
|
||||
// pPCM pointer to a buffer to decode into
|
||||
// pulPCMSize size of the PCM buffer. It will contain the
|
||||
// number of PCM bytes prodced upon return.
|
||||
// number of PCM bytes produced upon return.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
void DecodeFrame_v(unsigned char *pSource,
|
||||
unsigned long *pulSize,
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
* (see comment on Dequantize() for more info)
|
||||
*/
|
||||
#define DEF_NFRACBITS (DQ_FRACBITS_OUT - 2 - 2 - 15)
|
||||
#define CSHIFT 12 /* coefficients have 12 leading sign bits for early-terminating mulitplies */
|
||||
#define CSHIFT 12 /* coefficients have 12 leading sign bits for early-terminating multiplies */
|
||||
|
||||
static __inline short ClipToShort(int x, int fracBits)
|
||||
{
|
||||
|
||||
+69
-72
@@ -352,19 +352,18 @@ struct fixedfloat {
|
||||
|
||||
root_table[3 + x] = 2^(x/4)
|
||||
*/
|
||||
static mad_fixed_t const root_table_val[7] PROGMEM = {
|
||||
MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */,
|
||||
MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */,
|
||||
MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */,
|
||||
MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */,
|
||||
MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */,
|
||||
MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */,
|
||||
MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */
|
||||
};
|
||||
static inline mad_fixed_t root_table(int i)
|
||||
{
|
||||
static mad_fixed_t const root_table_val[7] PROGMEM = {
|
||||
MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */,
|
||||
MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */,
|
||||
MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */,
|
||||
MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */,
|
||||
MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */,
|
||||
MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */,
|
||||
MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */
|
||||
};
|
||||
volatile uint32_t a = *(uint32_t*)&root_table_val[i];
|
||||
return *(mad_fixed_t*)&a;
|
||||
return root_table_val[i];
|
||||
}
|
||||
/*
|
||||
coefficients for aliasing reduction
|
||||
@@ -374,28 +373,26 @@ static inline mad_fixed_t root_table(int i)
|
||||
cs[i] = 1 / sqrt(1 + c[i]^2)
|
||||
ca[i] = c[i] / sqrt(1 + c[i]^2)
|
||||
*/
|
||||
static mad_fixed_t const cs_val[8] PROGMEM = {
|
||||
+MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */,
|
||||
+MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */,
|
||||
+MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */,
|
||||
+MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */
|
||||
};
|
||||
static inline mad_fixed_t cs(int i)
|
||||
{
|
||||
static mad_fixed_t const cs_val[8] PROGMEM = {
|
||||
+MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */,
|
||||
+MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */,
|
||||
+MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */,
|
||||
+MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */
|
||||
};
|
||||
volatile uint32_t a = *(uint32_t*)&cs_val[i];
|
||||
return *(mad_fixed_t*)&a;
|
||||
return cs_val[i];
|
||||
}
|
||||
|
||||
static mad_fixed_t const ca_val[8] PROGMEM = {
|
||||
-MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */,
|
||||
-MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */,
|
||||
-MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */,
|
||||
-MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */
|
||||
};
|
||||
static inline mad_fixed_t ca(int i)
|
||||
{
|
||||
static mad_fixed_t const ca_val[8] PROGMEM = {
|
||||
-MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */,
|
||||
-MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */,
|
||||
-MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */,
|
||||
-MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */
|
||||
};
|
||||
volatile uint32_t a = *(uint32_t*)&ca_val[i];
|
||||
return *(mad_fixed_t*)&a;
|
||||
return ca_val[i];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -417,32 +414,31 @@ mad_fixed_t const imdct_s[6][6] PROGMEM = {
|
||||
|
||||
window_l[i] = sin((PI / 36) * (i + 1/2))
|
||||
*/
|
||||
static mad_fixed_t const window_l_val[36] PROGMEM = {
|
||||
MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
|
||||
MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */,
|
||||
MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */,
|
||||
MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
|
||||
MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */,
|
||||
MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */,
|
||||
|
||||
MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
|
||||
MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */,
|
||||
MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */,
|
||||
MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
|
||||
MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */,
|
||||
MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */,
|
||||
|
||||
MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */,
|
||||
MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */,
|
||||
MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */,
|
||||
MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */,
|
||||
MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */,
|
||||
MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */,
|
||||
};
|
||||
static inline mad_fixed_t window_l(int i)
|
||||
{
|
||||
static mad_fixed_t const window_l_val[36] PROGMEM = {
|
||||
MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
|
||||
MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */,
|
||||
MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */,
|
||||
MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
|
||||
MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */,
|
||||
MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */,
|
||||
|
||||
MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
|
||||
MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */,
|
||||
MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */,
|
||||
MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
|
||||
MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */,
|
||||
MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */,
|
||||
|
||||
MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */,
|
||||
MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */,
|
||||
MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */,
|
||||
MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */,
|
||||
MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */,
|
||||
MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */,
|
||||
};
|
||||
volatile uint32_t a = *(uint32_t*)&window_l_val[i];
|
||||
return *(mad_fixed_t*)&a;
|
||||
return window_l_val[i];
|
||||
}
|
||||
# endif /* ASO_IMDCT */
|
||||
|
||||
@@ -452,18 +448,17 @@ static inline mad_fixed_t window_l(int i)
|
||||
|
||||
window_s[i] = sin((PI / 12) * (i + 1/2))
|
||||
*/
|
||||
static mad_fixed_t const window_s_val[12] PROGMEM = {
|
||||
MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */,
|
||||
MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */,
|
||||
MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
|
||||
MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
|
||||
MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
|
||||
MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
|
||||
};
|
||||
static inline mad_fixed_t window_s(int i)
|
||||
{
|
||||
static mad_fixed_t const window_s_val[12] PROGMEM = {
|
||||
MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */,
|
||||
MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */,
|
||||
MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
|
||||
MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
|
||||
MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
|
||||
MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
|
||||
};
|
||||
volatile uint32_t a = *(uint32_t*)&window_s_val[i];
|
||||
return *(mad_fixed_t*)&a;
|
||||
return window_s_val[i];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -473,19 +468,18 @@ static inline mad_fixed_t window_s(int i)
|
||||
is_ratio[i] = tan(i * (PI / 12))
|
||||
is_table[i] = is_ratio[i] / (1 + is_ratio[i])
|
||||
*/
|
||||
static mad_fixed_t const is_table_val[7] PROGMEM = {
|
||||
MAD_F(0x00000000) /* 0.000000000 */,
|
||||
MAD_F(0x0361962f) /* 0.211324865 */,
|
||||
MAD_F(0x05db3d74) /* 0.366025404 */,
|
||||
MAD_F(0x08000000) /* 0.500000000 */,
|
||||
MAD_F(0x0a24c28c) /* 0.633974596 */,
|
||||
MAD_F(0x0c9e69d1) /* 0.788675135 */,
|
||||
MAD_F(0x10000000) /* 1.000000000 */
|
||||
};
|
||||
static inline mad_fixed_t is_table(int i)
|
||||
{
|
||||
static mad_fixed_t const is_table_val[7] PROGMEM = {
|
||||
MAD_F(0x00000000) /* 0.000000000 */,
|
||||
MAD_F(0x0361962f) /* 0.211324865 */,
|
||||
MAD_F(0x05db3d74) /* 0.366025404 */,
|
||||
MAD_F(0x08000000) /* 0.500000000 */,
|
||||
MAD_F(0x0a24c28c) /* 0.633974596 */,
|
||||
MAD_F(0x0c9e69d1) /* 0.788675135 */,
|
||||
MAD_F(0x10000000) /* 1.000000000 */
|
||||
};
|
||||
volatile uint32_t a = *(uint32_t*)&is_table_val[i];
|
||||
return *(mad_fixed_t*)&a;
|
||||
return is_table_val[i];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1739,7 +1733,10 @@ void sdctII(mad_fixed_t const x[18], mad_fixed_t X[18])
|
||||
s = *(volatile mad_fixed_t*)(volatile uint32_t*)&scale[i + 2]; tmp[i + 2] = mad_f_mul(x[i + 2] - x[18 - (i + 2) - 1], s); //scale[i + 2]);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
fastsdct(tmp, &X[1]);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* output accumulation */
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
//#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
//#endif
|
||||
@@ -2781,3 +2781,4 @@ void opus_encoder_destroy(OpusEncoder *st)
|
||||
{
|
||||
opus_free(st);
|
||||
}
|
||||
#endif
|
||||
@@ -24,7 +24,7 @@
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
//#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
//#endif
|
||||
@@ -1326,3 +1326,4 @@ void opus_multistream_encoder_destroy(OpusMSEncoder *st)
|
||||
{
|
||||
opus_free(st);
|
||||
}
|
||||
#endif
|
||||
@@ -24,7 +24,7 @@
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
//#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
//#endif
|
||||
@@ -465,4 +465,4 @@ bad_arg:
|
||||
va_end(ap);
|
||||
return OPUS_BAD_ARG;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -62,6 +62,8 @@ static OPUS_INLINE void silk_NLSF2A_find_poly(
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
/* compute whitening filter coefficients from normalized line spectral frequencies */
|
||||
void silk_NLSF2A(
|
||||
opus_int16 *a_Q12, /* O monic whitening filter coefficients in Q12, [ d ] */
|
||||
@@ -143,4 +145,4 @@ void silk_NLSF2A(
|
||||
free(Q);
|
||||
free(a32_QA1);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
@@ -24,6 +24,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
***********************************************************************/
|
||||
#if 0
|
||||
|
||||
//#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
@@ -574,3 +575,4 @@ opus_int silk_Encode( /* O Returns error co
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "../../celt/stack_alloc.h"
|
||||
#include "../tuning_parameters.h"
|
||||
|
||||
#if 0
|
||||
/* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */
|
||||
static OPUS_INLINE void silk_LBRR_encode_FIX(
|
||||
silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk FIX encoder state */
|
||||
@@ -446,3 +447,4 @@ static OPUS_INLINE void silk_LBRR_encode_FIX(
|
||||
silk_memcpy( psEncCtrl->Gains_Q16, TempGains_Q16, psEnc->sCmn.nb_subfr * sizeof( opus_int32 ) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -42,6 +42,16 @@
|
||||
|
||||
*/
|
||||
|
||||
// ESP32 as of 3.x has a compiler bug in this section, with the G++ generated assembly
|
||||
// being illegal. There's nothing wrong with the code here, it just looks like an
|
||||
// Xtensa backend issue. Until that's fixed, no MIDI for you!
|
||||
///home/earle/Arduino/libraries/ESP8266Audio/src/libtinysoundfont/tsf.h: In function 'void tsf_channel_midi_control(tsf*, int, int, int)':
|
||||
// /home/earle/Arduino/libraries/ESP8266Audio/src/libtinysoundfont/tsf.h:2101:1: error: insn does not satisfy its constraints:
|
||||
// 2101 | }
|
||||
// | ^
|
||||
|
||||
#if !defined(ESP32)
|
||||
|
||||
#ifndef TSF_INCLUDE_TSF_INL
|
||||
#define TSF_INCLUDE_TSF_INL
|
||||
|
||||
@@ -1440,6 +1450,7 @@ static void tsf_voice_render_fast(tsf* f, struct tsf_voice* v, short* outputBuff
|
||||
//double tmpSampleEndDbl = (double)v->sampleEnd, tmpLoopEndDbl = (double)tmpLoopEnd + 1.0;
|
||||
//double tmpSourceSamplePosition = v->sourceSamplePosition;
|
||||
fixed32p32 tmpSampleEndF32P32 = ((fixed32p32)(region->end)) << 32;
|
||||
fixed32p32 tmpLoopStartF32P32 = ((fixed32p32)(tmpLoopStart + 1)) << 32;
|
||||
fixed32p32 tmpLoopEndF32P32 = ((fixed32p32)(tmpLoopEnd + 1)) << 32;
|
||||
fixed32p32 tmpSourceSamplePositionF32P32 = v->sourceSamplePositionF32P32;
|
||||
struct tsf_voice_lowpass tmpLowpass = v->lowpass;
|
||||
@@ -1513,7 +1524,7 @@ static void tsf_voice_render_fast(tsf* f, struct tsf_voice* v, short* outputBuff
|
||||
// Next sample.
|
||||
tmpSourceSamplePositionF32P32 += pitchRatioF32P32;
|
||||
if (tmpSourceSamplePositionF32P32 >= tmpLoopEndF32P32 && isLooping)
|
||||
tmpSourceSamplePositionF32P32 -= (tmpLoopEndF32P32 - tmpLoopStart + (1LL<<32));
|
||||
tmpSourceSamplePositionF32P32 -= (tmpLoopEndF32P32 - tmpLoopStartF32P32 + (1LL<<32));
|
||||
}
|
||||
|
||||
if (tmpSourceSamplePositionF32P32 >= tmpSampleEndF32P32 || v->ampenv.segment == TSF_SEGMENT_DONE)
|
||||
@@ -2144,3 +2155,5 @@ TSFDEF float tsf_channel_get_tuning(tsf* f, int channel)
|
||||
#endif
|
||||
|
||||
#endif //TSF_IMPLEMENTATION
|
||||
|
||||
#endif // ! ESP32
|
||||
@@ -1481,7 +1481,7 @@ static int op_open_seekable2(OggOpusFile *_of){
|
||||
/*Clear out the current logical bitstream decoder.*/
|
||||
static void op_decode_clear(OggOpusFile *_of){
|
||||
/*We don't actually free the decoder.
|
||||
We might be able to re-use it for the next link.*/
|
||||
We might be able to reuse it for the next link.*/
|
||||
_of->op_count=0;
|
||||
_of->od_buffer_size=0;
|
||||
_of->prev_packet_gp=-1;
|
||||
@@ -1749,7 +1749,7 @@ opus_int64 op_raw_total(const OggOpusFile *_of,int _li){
|
||||
ogg_int64_t op_pcm_total(const OggOpusFile *_of,int _li){
|
||||
OggOpusLink *links;
|
||||
ogg_int64_t pcm_total;
|
||||
ogg_int64_t diff;
|
||||
ogg_int64_t diff = 0;
|
||||
int nlinks;
|
||||
nlinks=_of->nlinks;
|
||||
if(OP_UNLIKELY(_of->ready_state<OP_OPENED)
|
||||
|
||||
+37
-21
@@ -70,23 +70,13 @@ function install_esp32()
|
||||
local ide_path=$1
|
||||
pip install pyserial
|
||||
pip3 install pyserial
|
||||
cd $ide_path/hardware
|
||||
mkdir espressif
|
||||
cd espressif
|
||||
git clone https://github.com/espressif/arduino-esp32.git esp32
|
||||
pushd esp32
|
||||
# Set custom warnings for all builds
|
||||
|
||||
echo "compiler.c.extra_flags=-Wall -Wextra -Werror $debug_flags" > platform.local.txt
|
||||
echo "compiler.cpp.extra_flags=-Wall -Wextra -Werror $debug_flags" >> platform.local.txt
|
||||
echo -e "\n----platform.local.txt----"
|
||||
cat platform.local.txt
|
||||
git submodule update --init
|
||||
cd tools
|
||||
python3 get.py
|
||||
export PATH="$ide_path/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin/:$PATH"
|
||||
mkdir -p ~/bin
|
||||
pushd ~/bin
|
||||
wget -q https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.tar.gz
|
||||
tar xvf arduino-cli_latest_Linux_64bit.tar.gz
|
||||
export PATH=$PATH:$PWD
|
||||
popd
|
||||
cd esp32
|
||||
arduino-cli core install --additional-urls https://espressif.github.io/arduino-esp32/package_esp32_index.json esp32:esp32
|
||||
}
|
||||
|
||||
function install_arduino()
|
||||
@@ -99,6 +89,20 @@ function install_arduino()
|
||||
install_libraries
|
||||
}
|
||||
|
||||
function skip_esp32()
|
||||
{
|
||||
local ino=$1
|
||||
local skiplist=""
|
||||
# Add items to the following list with "\n" netween them to skip running. No spaces, tabs, etc. allowed
|
||||
read -d '' skiplist << EOL || true
|
||||
/MixerSample/
|
||||
EOL
|
||||
echo $ino | grep -q -F "$skiplist"
|
||||
echo $(( 1 - $? ))
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$BUILD_MOD" == "" ]; then
|
||||
export BUILD_MOD=1
|
||||
export BUILD_REM=0
|
||||
@@ -109,14 +113,26 @@ if [ "$BUILD_TYPE" = "build" ]; then
|
||||
install_arduino
|
||||
install_esp8266 "$HOME/arduino_ide"
|
||||
source "$HOME/arduino_ide/hardware/esp8266com/esp8266/tests/common.sh"
|
||||
build_sketches "$HOME/arduino_ide" "$TRAVIS_BUILD_DIR" "-l $HOME/Arduino/libraries" "$BUILD_MOD" "$BUILD_REM" "lm2f"
|
||||
export ESP8266_ARDUINO_SKETCHES=$(find $HOME/Arduino/libraries/ESP8266Audio -name *.ino | sort)
|
||||
# ESP8266 scripts now expect tools in wrong spot. Use simple and dumb fix
|
||||
mkdir -p "$HOME/work/ESP8266Audio/ESP8266Audio"
|
||||
ln -s "$HOME/arduino_ide/hardware/esp8266com/esp8266/tools" "$HOME/work/ESP8266Audio/ESP8266Audio/tools"
|
||||
build_sketches "$TRAVIS_BUILD_DIR" "$HOME/arduino_ide" "$HOME/arduino_ide/hardware" "$HOME/Arduino/libraries" "$BUILD_MOD" "$BUILD_REM" "lm2f"
|
||||
elif [ "$BUILD_TYPE" = "build_esp32" ]; then
|
||||
install_arduino
|
||||
install_esp32 "$HOME/arduino_ide"
|
||||
export FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
|
||||
mkdir -p "$GITHUB_WORKSPACE/hardware"
|
||||
ln -s "$GITHUB_WORKSPACE/../" "$GITHUB_WORKSPACE/libraries"
|
||||
source "$HOME/arduino_ide/hardware/espressif/esp32/.github/scripts/sketch_utils.sh" chunk_build "$HOME/arduino_ide" "$GITHUB_WORKSPACE" "$FQBN" esp32 "$GITHUB_WORKSPACE" $BUILD_REM $BUILD_MOD
|
||||
export testcnt=0
|
||||
for i in $(find ~/Arduino/libraries/ESP8266Audio -name "*.ino"); do
|
||||
testcnt=$(( ($testcnt + 1) % $BUILD_MOD ))
|
||||
if [ $testcnt -ne $BUILD_REM ]; then
|
||||
continue # Not ours to do
|
||||
fi
|
||||
if [[ $(skip_esp32 $i) = 1 ]]; then
|
||||
echo -e "\n ------------ Skipping $i ------------ \n";
|
||||
continue
|
||||
fi
|
||||
arduino-cli compile --fqbn esp32:esp32:esp32 --warnings all $i
|
||||
done
|
||||
elif [ "$BUILD_TYPE" = "build_rp2040" ]; then
|
||||
install_arduino
|
||||
install_rp2040 "$HOME/arduino_ide"
|
||||
|
||||
Reference in new issue
Block a user