Replace Stream with simple string in MD callback

@armSeb found that the stream interface caused a big slowdown and
hiccups in his playback, replace the MetadataCallback's *Stream with
a simple *char for faster operation and less overhead.
This commit is contained in:
Earle F. Philhower, III committed 2017-12-15 12:54:49 -08:00
1 parent d923ebef36
commit 8e94702468
5 files changed
+29 -33

No files matched your search

@@ -18,20 +18,19 @@ AudioFileSourceID3 *id3;
// Called when a metadata event occurs (i.e. an ID3 tag, an ICY block, etc.
void MDCallback(void *cbData, const char *type, bool isUnicode, Stream *stream)
void MDCallback(void *cbData, const char *type, bool isUnicode, const char *string)
{
(void)cbData;
Serial.printf("ID3 callback for: %s = '", type);
if (isUnicode) {
// Skip byte order marker
stream->read();
stream->read();
string += 2;
}
while (stream->available()) {
char a = stream->read();
while (*string) {
char a = *(string++);
if (isUnicode) {
stream->read();
string++;
}
Serial.printf("%c", a);
}