16 Commits
Author SHA1 Message Date
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
Christian Ferbar 074dfd47b0 Allow playing wav files via HTTPStream (#224)
* ReadWAVInfo(): print error message if seek() fails

* AudioFileSourceHTTPStream::seek() print error message - not implemented

* AudioFileSourceBuffer::seek if SEEK_CUR and seek_len < writePtr keep the buffer (fix for HTTPStream)

* Update AudioFileSourceBuffer.cpp
2019-11-24 08:52:50 -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 2d8a97767c Update to remove warnings, fix new 8266 core rev
Remove build warnings and use the faster pgm_read_*_aligned macros to
update to the latest ESP8266 Arduino core.
2019-04-12 15:45:34 -07:00
h3ndrik 135e912f3e increase max buffer size beyond 64k (#117)
The ESP32 can easily handle a buffer size greater than UINT16_MAX (64KB)
so make the size an uint32_t.
2018-08-20 07:53:59 -07:00
h3ndrik e3a3f2b278 Report buffer fill level (#52)
Add method to get the current buffer fill level (for real-time display/etc.)
2018-03-25 12:14:08 -07: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 d923ebef36 Move the callback constant strings to PMEM 2017-12-15 12:03:05 -08:00
Earle F. Philhower, III 634d0b8d02 Store AAC/MP3 flag in EEPROM for WebRadio 2017-12-15 10:31:19 -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 64032d8f43 Force refill of buffer when emptied completely
@armSeb founf another case in issue #9 where the buffer would never
refill if the input stream was very slightly below the output stream
velocity.  In that case, when we hit a 0-water mark, force a complete
refill of the buffer on the next pass.
2017-11-21 08:36:17 -08:00
Earle F. Philhower, III 8a19c9c093 Fix buffering losing bytes
Correct issue @armSeb found and fixed where some bytes on the fallthrough
case were not being recorded as stored, leading to mp3 playback errors.
Fixes one half of issue 7.
2017-11-20 06:59:57 -08:00
Earle F. Philhower, III 65c1373300 Less naive double-buffer reading
Use memcpy instead of complicated byte-by-byte operations to read data
out of the buffer.  Should allow for somewhat faster reads.
2017-11-15 13:17:43 -08:00
Earle F. Philhower, III 07531b905e Turn on O3 optimization on the buffer filter 2017-11-15 07:14:27 -08:00
Earle F. Philhower, III c669a329c4 Add double-buffer input file source
AudioFileSourceBuffer allows system RAM to be used to buffer an
input file (normally just a HTTP Stream) to help avoid hiccups.
This could also be subclassed to use an external SRAM, at some
soint.
2017-11-14 07:08:45 -08:00