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:
Earle F. Philhower, III committed 2017-12-06 21:11:23 -08:00
1 parent 1ab9348a4c
commit 9c120a777a
22 files changed
+339 -85

No files matched your search

+8 -2
View File
@@ -22,6 +22,7 @@
#define _AUDIOGENERATOR_H
#include <Arduino.h>
#include "AudioStatus.h"
#include "AudioFileSource.h"
#include "AudioOutput.h"
@@ -35,13 +36,18 @@ class AudioGenerator
virtual bool stop() { return false; };
virtual bool isRunning() { return false;};
public:
virtual bool RegisterMetadataCB(AudioStatus::metadataCBFn fn, void *data) { return cb.RegisterMetadataCB(fn, data); }
virtual bool RegisterStatusCB(AudioStatus::statusCBFn fn, void *data) { return cb.RegisterStatusCB(fn, data); }
protected:
bool running;
AudioFileSource *file;
AudioOutput *output;
int16_t lastSample[2];
protected:
AudioStatus cb;
};
#endif