Commit Graph
15 Commits
Author SHA1 Message Date
Wojtek Kaniewski 05f2fb0045 Fix memory corruption in AudioGeneratorAAC on non-ESP8266 platforms (#807)
The description of `AACDecode()` function states that the output buffer
must be big enough for 1024 samples per channel _or_ 2048 if SBR is
enabled. By default SBR is enabled on non-ESP8266 platforms, yet the
buffer in `AudioGeneratorAAC` is always 1024 samples per channel long.
This causes memory corruption on ESP32 and possibly Pi Pico. This change
makes the output buffer correct.
2026-03-18 07:30:39 -07:00
Earle F. Philhower, III 058e131b26 Remove 8-bit handling in output, promote WAV/FLAC to 16 (#782)
Only the WAV and FLAC generators can generate 8-bit values, so it is
more efficient and sane to just have those generators upscale to 16-bit
signed (if necessary) in generation and simplify all the other
Generators and Outputs.
2025-10-13 09:56:39 -07:00
Earle F. Philhower, III f9e72dbb21 Add style check matching RP2040 core (#740)
Will let us backport the BackgroundAudio patches to libhelix easier and clean
up some ugly formatting we've let develop.
2025-04-11 12:09:49 -07:00
Earle F. Philhower, III cdf71d6bcf Fix AAC mono decode (#297)
As noted by Marc Madaule (thanks!), the mono AAC decode was not
functioning properly.  Adjust the output stuff loop to fix.
2020-08-15 21:05:12 -07:00
david gauchard 4fed6a230f install and use a global audioLogger instead of Serial (#198)
* use of global audioLogger-> instead of Serial.

* default to silence

* initialize logger in examples
2019-07-24 10:02:21 -07:00
Earle F. Philhower, III e8e7acb884 Fix warnings and off-by-one in AAC 2018-01-21 19:27:07 -08:00
Earle F. Philhower, III 8ffebe6496 Enable static allocated buffers, no dynamic malloc
Because we are allocating objects totaling over 80% of the ESP8266 memory
space, we are very sensitive to memory fragmentation.  While we can control
our own allocs, the IP and SDK can allocate any size, at any time, which
can cause us to not be able to find the large contiguous memory areas we need
for the codes.

Work around this by preallocating, before anything else, buffer memory and
never freeing it.  Pass this memory into the codec and it will allocate from
this block and be guaranteed to always succeed.

This may fix the last of the hangs on the webradio/http streaming, which only
seemed to happen after a stop/start cycle.
2018-01-21 13:02:05 -08:00
Earle F. Philhower, III 24e9d0a585 Add AAC valgrind test on the host, clean up warns
The AAC codec didn't show any issues on initial valgrind runs except
for having a different stop() behavior than the MP3 one.  Make them
match.
2018-01-19 22:11:52 -08:00
Earle F. Philhower, III d923ebef36 Move the callback constant strings to PMEM 2017-12-15 12:03:05 -08:00
Earle F. Philhower, III 8d401a4a39 Move strings to PROGMEM, save a few heap bytes 2017-12-14 10:50:55 -08:00
Earle F. Philhower, III 9c120a777a Add callbacks for metadata and status reports
All objects can have a metadata and/or status report callback once created.
They will call the source program with the parsed ID3 tag, ICY StreamTitle,
or text and numeric error ID of any interesting event.  It is up to the end
application to figure out what to do with this.  Normally, you'd just print
it to the LCD or Serial port.  But it is possible to detect, say, a buffer
overflow and then switch to a lower bitrate stream for example.
2017-12-06 21:11:23 -08:00
Earle F. Philhower, III fece88a9be Add loop method to all input and outputs
Adds a virtual loop() method to the file input and audio output objects.
By default does nothing, but it can be used to prefill buffers/etc. in the
case of a buffered input, or to update a volume meter on an output, etc.

The AudioGenerators all now call it as part of their own loop()s, so there
is no user intervention required to make it work.

Thanks to @armSeb for the idea with his SPI RAM code.
2017-11-24 10:35:20 -08:00
Earle F. Philhower, III 1875683ce1 Add SBR code back in, but disable for now.
The SBR code compiles, but it requires an additional 50,788 bytes of system
RAM to run so it's not going to work on the ESP8266.  Add the code in just in
case someone wants to move it to another architecture w/more RAM available.
2017-11-23 19:04:30 -08:00
Earle F. Philhower, III f4702a0719 Remove GCC -Wall warnings
Clear up warnings generated with -Wall used to compile.  No functional change.
2017-11-18 18:53:58 -08:00
Earle F. Philhower, III 551a8ac0bb Add AAC playback using Helix from RealNetworks
AACs can now be played back on the ESP8266 thanks to the RealNetworks
Helix project's AAC decoder.  SBR is *not* supported, as there is not
enough RAM in the system to support it.
2017-11-18 08:42:09 -08:00