Add buffering to MP3 streaming
The buffer class seems to work very well to avoid hiccups while streaming from the web, so add it by default to the example to make it easier for users to cut-n-paste and make it work.
This commit is contained in:
1 parent
8b080899af
commit
9c3f579c96
3 files changed
+26
-2
No files matched your search
@@ -1,6 +1,7 @@
|
||||
#include <Arduino.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
#include "AudioFileSourceHTTPStream.h"
|
||||
#include "AudioFileSourceBuffer.h"
|
||||
#include "AudioGeneratorMP3.h"
|
||||
#include "AudioOutputI2SNoDAC.h"
|
||||
|
||||
@@ -15,6 +16,7 @@ const char *URL="http://streaming.shoutcast.com/80sPlanet?lang=en-US";
|
||||
|
||||
AudioGeneratorMP3 *mp3;
|
||||
AudioFileSourceHTTPStream *file;
|
||||
AudioFileSourceBuffer *buff;
|
||||
AudioOutputI2SNoDAC *out;
|
||||
|
||||
void setup()
|
||||
@@ -41,9 +43,10 @@ void setup()
|
||||
}
|
||||
|
||||
file = new AudioFileSourceHTTPStream(URL);
|
||||
buff = new AudioFileSourceBuffer(file, 2048);
|
||||
out = new AudioOutputI2SNoDAC();
|
||||
mp3 = new AudioGeneratorMP3();
|
||||
mp3->begin(file, out);
|
||||
mp3->begin(buff, out);
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
||||
Reference in new issue
Block a user