Files
ESP8266Audio/src/AudioFileStream.h
T
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

49 lines
1.3 KiB
C++

/*
AudioFileStream
Convert an AudioFileSource* to a Stream*
Copyright (C) 2017 Earle F. Philhower, III
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AUDIOFILESTREAM_H
#define AUDIOFILESTREAM_H
#include <Arduino.h>
#include "AudioFileSource.h"
class AudioFileStream : public Stream
{
public:
AudioFileStream(AudioFileSource *source, int definedLen);
virtual ~AudioFileStream();
public:
// Stream interface - see the Arduino library documentation.
virtual int available() override;
virtual int read() override;
virtual int peek() override;
virtual void flush() override;
virtual size_t write(uint8_t x) override { (void)x; return 0; };
private:
AudioFileSource *src;
int saved;
int len;
int ptr;
};
#endif