Add style check matching RP2040 core (#740)
Will let us backport the BackgroundAudio patches to libhelix easier and clean up some ugly formatting we've let develop.
This commit is contained in:
1 parent
62dd23a74a
commit
f9e72dbb21
434 files changed
+94604
-93082
No files matched your search
@@ -4,18 +4,18 @@ void setup() {}
|
||||
void loop() {}
|
||||
#else
|
||||
#ifdef ESP32
|
||||
#include "SPIFFS.h"
|
||||
#include "SPIFFS.h"
|
||||
#endif
|
||||
#include "AudioFileSourceSPIFFS.h"
|
||||
#include "AudioFileSourceID3.h"
|
||||
#include "AudioOutputSPDIF.h"
|
||||
#include "AudioGeneratorMP3.h"
|
||||
|
||||
// To run, set your ESP8266 build to 160MHz, and include a SPIFFS partition
|
||||
// To run, set your ESP8266 build to 160MHz, and include a SPIFFS partition
|
||||
// big enough to hold your MP3 file. Find suitable MP3 file from i.e.
|
||||
// https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/audio-samples.html
|
||||
// and download it into 'data' directory. Use the "Tools->ESP8266/ESP32 Sketch Data Upload"
|
||||
// menu to write the MP3 to SPIFFS. Then upload the sketch normally.
|
||||
// and download it into 'data' directory. Use the "Tools->ESP8266/ESP32 Sketch Data Upload"
|
||||
// menu to write the MP3 to SPIFFS. Then upload the sketch normally.
|
||||
|
||||
AudioFileSourceSPIFFS *file;
|
||||
AudioFileSourceID3 *id3;
|
||||
@@ -23,15 +23,14 @@ AudioOutputSPDIF *out;
|
||||
AudioGeneratorMP3 *mp3;
|
||||
|
||||
// Called when a metadata event occurs (i.e. an ID3 tag, an ICY block, etc.
|
||||
void MDCallback(void *cbData, const char *type, bool isUnicode, const char *string)
|
||||
{
|
||||
void MDCallback(void *cbData, const char *type, bool isUnicode, const char *string) {
|
||||
(void)cbData;
|
||||
Serial.printf("ID3 callback for: %s = '", type);
|
||||
|
||||
if (isUnicode) {
|
||||
string += 2;
|
||||
}
|
||||
|
||||
|
||||
while (*string) {
|
||||
char a = *(string++);
|
||||
if (isUnicode) {
|
||||
@@ -44,15 +43,14 @@ void MDCallback(void *cbData, const char *type, bool isUnicode, const char *stri
|
||||
}
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
Serial.println();
|
||||
audioLogger = &Serial;
|
||||
SPIFFS.begin();
|
||||
file = new AudioFileSourceSPIFFS();
|
||||
id3 = NULL;
|
||||
file = new AudioFileSourceSPIFFS();
|
||||
id3 = NULL;
|
||||
out = new AudioOutputSPDIF();
|
||||
mp3 = new AudioGeneratorMP3();
|
||||
String fileName = "";
|
||||
@@ -60,7 +58,7 @@ void setup()
|
||||
// Find first MP3 file in SPIFF and play it
|
||||
|
||||
#ifdef ESP32
|
||||
File dir, root = SPIFFS.open("/");
|
||||
File dir, root = SPIFFS.open("/");
|
||||
while ((dir = root.openNextFile())) {
|
||||
if (String(dir.name()).endsWith(".mp3")) {
|
||||
if (file->open(dir.name())) {
|
||||
@@ -92,10 +90,11 @@ void setup()
|
||||
}
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
void loop() {
|
||||
if (mp3->isRunning()) {
|
||||
if (!mp3->loop()) mp3->stop();
|
||||
if (!mp3->loop()) {
|
||||
mp3->stop();
|
||||
}
|
||||
} else {
|
||||
Serial.println("MP3 done");
|
||||
delay(1000);
|
||||
|
||||
Reference in new issue
Block a user