Compare commits

...

9 Commits

Author SHA1 Message Date
Hema2 020b385733
Merge 5cbcfa2230 into 492a5beba4 2024-04-25 17:43:36 -07:00
Earle F. Philhower, III 492a5beba4
Update GH CI actions to latest (#681) 2024-04-17 10:22:17 -07:00
Earle F. Philhower, III 89a5a07712
Get ESP32 CI builds working again (#680) 2024-04-17 10:11:03 -07:00
Earle F. Philhower, III b3c41668a2
Fix GCC12.3 new warnings for RP2040 (#679)
* Fix GCC12.3 new warnings for RP2040

* Remove OPUS encoder, not supported on embedded
2024-04-16 16:32:16 -07:00
Hema2-official 5cbcfa2230 Fix includes 2024-04-04 23:13:12 +02:00
Hema2 8eaae770d5
Update README
Include ESP32-S3 in the title
2024-04-04 22:42:20 +02:00
Hema2 839810d9a3
Update README
Include information about the new class in the main README
2024-04-04 22:39:46 +02:00
Hema2-official 91c45a54bf Clean up 2024-04-04 22:34:27 +02:00
Hema2-official 9b95e963e6 Add support for ESP32-S3 2024-04-04 22:26:22 +02:00
15 changed files with 375 additions and 110 deletions

View File

@ -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@v4
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,7 +128,7 @@ jobs:
run:
shell: bash
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
- name: Run codespell

View File

@ -1,4 +1,4 @@
# ESP8266Audio - supports ESP8266 & ESP32 & Raspberry Pi Pico RP2040 [![Gitter](https://badges.gitter.im/ESP8266Audio/community.svg)](https://gitter.im/ESP8266Audio/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
# ESP8266Audio - supports ESP8266 & ESP32 & ESP32-S3 & Raspberry Pi Pico RP2040 [![Gitter](https://badges.gitter.im/ESP8266Audio/community.svg)](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.
@ -142,6 +142,8 @@ AudioOutputI2S: Interface for any I2S 16-bit DAC. Sends stereo or mono signals
AudioOutputI2SNoDAC: Abuses the I2S interface to play music without a DAC. Turns it into a 32x (or higher) oversampling delta-sigma DAC. Use the schematic below to drive a speaker or headphone from the I2STx pin (i.e. Rx). Note that with this interface, depending on the transistor used, you may need to disconnect the Rx pin from the driver to perform serial uploads. Mono-only output, of course.
AudioOutputI2SNoDACS3 (experimental): Same as the one above, but (ONLY) supports the ESP32-S3. It also requires a dummy (unused) pin for the clock output.
AudioOutputSPDIF (experimental): Another way to abuse the I2S peripheral to send out BMC encoded S/PDIF bitstream. To interface with S/PDIF receiver it needs optical or coaxial transceiver, for which some examples can be found at https://www.epanorama.net/documents/audio/spdif.html. It should work even with the simplest form with red LED and current limiting resistor, fed into TOSLINK cable. Minimum sample rate supported by is 32KHz. Due to BMC coding, actual symbol rate on the pin is 4x normal I2S data rate, which drains DMA buffers quickly. See more details inside [AudioOutputSPDIF.cpp](src/AudioOutputSPDIF.cpp#L17)
AudioOutputSerialWAV: Writes a binary WAV format with headers to the Serial port. If you capture the serial output to a file you can play it back on your development system.

View File

@ -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);
}

View File

@ -0,0 +1,184 @@
/*
AudioOutputI2SNoDACS3
Class for outputting PDM audio on the ESP32-S3 without an external DAC
Copyright (C) 2024 Hema2
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/>.
*/
#include "AudioOutputI2SNoDACS3.h"
#if CONFIG_IDF_TARGET_ESP32S3
AudioOutputI2SNoDACS3::AudioOutputI2SNoDACS3(int doutPin, int dummyPin, int port, int dma_buf_count)
{
this->doutPin = (gpio_num_t)doutPin;
this->dummyPin = (gpio_num_t)dummyPin;
this->portNo = port;
this->dma_buf_count = dma_buf_count;
// Set initial I2S state
i2sOn = false;
// Set defaults
mono = false;
bps = 16;
channels = 2;
hertz = 44100;
SetGain(1.0);
}
AudioOutputI2SNoDACS3::~AudioOutputI2SNoDACS3()
{
stop();
}
bool AudioOutputI2SNoDACS3::SetRate(int hz)
{
// TODO - have a list of allowable rates from constructor, check them
this->hertz = hz;
if (i2sOn)
{
i2s_set_sample_rates((i2s_port_t)portNo, AdjustI2SRate(hz));
}
return true;
}
bool AudioOutputI2SNoDACS3::SetBitsPerSample(int bits)
{
if ( (bits != 16) && (bits != 8) ) return false;
this->bps = bits;
return true;
}
bool AudioOutputI2SNoDACS3::SetChannels(int channels)
{
if ( (channels < 1) || (channels > 2) ) return false;
this->channels = channels;
return true;
}
bool AudioOutputI2SNoDACS3::SetOutputModeMono(bool mono)
{
this->mono = mono;
return true;
}
bool AudioOutputI2SNoDACS3::begin()
{
if (!i2sOn)
{
i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_PDM),
.sample_rate = 30000, // initial value ?????????
.bits_per_sample = i2s_bits_per_sample_t(bps),
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
.communication_format = I2S_COMM_FORMAT_STAND_I2S,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, // lowest interrupt priority
.dma_buf_count = dma_buf_count,
.dma_buf_len = 128,
.use_apll = true,
.tx_desc_auto_clear = true,
.fixed_mclk = 0,
.mclk_multiple = I2S_MCLK_MULTIPLE_256,
.bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT,
};
audioLogger->printf("+%d %p\n", portNo, &i2s_config);
if (i2s_driver_install((i2s_port_t)portNo, &i2s_config, 0, NULL) != ESP_OK)
{
audioLogger->println(F("ERROR: Unable to install I2S drives\n"));
return false;
}
// Set pinout
i2s_pin_config_t i2s_pinout = {
.bck_io_num = I2S_PIN_NO_CHANGE, // no bck
.ws_io_num = dummyPin, // dummy pin for LR clock
.data_out_num = doutPin, // PDM data out
.data_in_num = I2S_PIN_NO_CHANGE // no input
};
if (i2s_set_pin((i2s_port_t)portNo, &i2s_pinout) != ESP_OK)
{
audioLogger->println(F("ERROR: Unable to set I2S pins\n"));
return false;
}
i2s_zero_dma_buffer((i2s_port_t)portNo);
i2s_start((i2s_port_t)portNo);
}
i2sOn = true;
SetRate(hertz);
return true;
}
bool AudioOutputI2SNoDACS3::ConsumeSample(int16_t sample[2])
{
//return if we haven't called ::begin yet
if (!i2sOn)
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;
}
uint32_t s32 = ((Amplify(ms[RIGHTCHANNEL])) << 16) | (Amplify(ms[LEFTCHANNEL]) & 0xffff);
size_t i2s_bytes_written;
i2s_write((i2s_port_t)portNo, (const char*)&s32, sizeof(uint32_t), &i2s_bytes_written, 0);
return i2s_bytes_written;
}
void AudioOutputI2SNoDACS3::flush()
{
// makes sure that all stored DMA samples are consumed / played
int buffersize = 128 * this->dma_buf_count;
int16_t samples[2] = {0x0, 0x0};
for (int i = 0; i < buffersize; i++)
{
while (!ConsumeSample(samples))
{
delay(10);
}
}
}
bool AudioOutputI2SNoDACS3::stop()
{
if (!i2sOn)
return false;
i2s_zero_dma_buffer((i2s_port_t)portNo);
audioLogger->printf("UNINSTALL I2S\n");
i2s_driver_uninstall((i2s_port_t)portNo); //stop & destroy i2s driver
i2sOn = false;
return true;
}
#endif // CONFIG_IDF_TARGET_ESP32S3

View File

@ -0,0 +1,61 @@
/*
AudioOutputI2SNoDACS3
Class for outputting PDM audio on the ESP32-S3 without an external DAC
Copyright (C) 2024 Hema2
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"
#include "driver/i2s.h"
#include <Arduino.h>
#if CONFIG_IDF_TARGET_ESP32S3
class AudioOutputI2SNoDACS3 : public AudioOutput
{
public:
/// @brief No-DAC Audio Output for ESP32-S3
/// @param doutPin Pin to modulate audio on (PDM data)
/// @param dummyPin Dummy pin to use for WS/BCLK (PDM clock)
/// @param port
/// @param dma_buf_count
AudioOutputI2SNoDACS3(int doutPin, int dummyPin = GPIO_NUM_3, int port=0, int dma_buf_count = 8);
virtual ~AudioOutputI2SNoDACS3() 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:
virtual int AdjustI2SRate(int hz) { return (int)((float)hz / 1.0f); }
uint8_t portNo;
bool mono;
bool i2sOn;
int dma_buf_count;
gpio_num_t doutPin;
gpio_num_t dummyPin;
};
#endif // CONFIG_IDF_TARGET_ESP32S3

View File

@ -41,6 +41,7 @@
#include "AudioOutput.h"
#include "AudioOutputI2S.h"
#include "AudioOutputI2SNoDAC.h"
#include "AudioOutputI2SNoDACS3.h"
#include "AudioOutputPWM.h"
#include "AudioOutputMixer.h"
#include "AudioOutputNull.h"

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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
@ -117,10 +121,18 @@ if [ "$BUILD_TYPE" = "build" ]; then
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 -ai "$HOME/arduino_ide" -au "$GITHUB_WORKSPACE" -fqbn "$FQBN" -t esp32 -p "$GITHUB_WORKSPACE" -i $BUILD_REM -m $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"