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.
This commit is contained in:
1 parent
1ab9348a4c
commit
9c120a777a
22 files changed
+339
-85
No files matched your search
@@ -78,7 +78,7 @@ uint32_t AudioFileSourceBuffer::read(void *data, uint32_t len)
|
||||
uint32_t bytes = 0;
|
||||
if (!filled) {
|
||||
// Fill up completely before returning any data at all
|
||||
Serial.println("Buffering...");
|
||||
cb.st(STATUS_FILLING, "Refilling buffer");
|
||||
length = src->read(buffer, buffSize);
|
||||
writePtr = length % buffSize;
|
||||
filled = true;
|
||||
@@ -115,6 +115,7 @@ uint32_t AudioFileSourceBuffer::read(void *data, uint32_t len)
|
||||
writePtr = 0;
|
||||
length = 0;
|
||||
filled = false;
|
||||
cb.st(STATUS_UNDERFLOW, "Buffer underflow");
|
||||
}
|
||||
|
||||
fill();
|
||||
|
||||
Reference in new issue
Block a user