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:
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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user