Skip to content

Commit 93b499d

Browse files
committed
VS1053 example
1 parent 567183c commit 93b499d

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* @brief SnapClient where the decoding is done by a VS1053 module.
3+
* This module supports: Ogg Vorbis / MP3 / AAC / WMA / FLAC / MIDI / WAV so
4+
* we can copy the received stream as is to the module.
5+
* DRAFT: not tested!
6+
* @author Phil Schatzmann
7+
* @copyright GPLv3
8+
*/
9+
#include "AudioTools.h"
10+
#include "SnapClient.h"
11+
#include "AudioLibs/VS1053Stream.h"
12+
13+
14+
VS1053Stream out; // final output
15+
WiFiClient wifi;
16+
SnapTimeSyncDynamic synch(172, 10); // optional configuratioin
17+
CopyDecoder codec;
18+
SnapClient client(wifi, out, codec);
19+
20+
void setup() {
21+
Serial.begin(115200);
22+
23+
// login to wifi -> Define values in SnapConfig.h or replace them here
24+
WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD);
25+
Serial.print("Connecting to WiFi ..");
26+
while (WiFi.status() != WL_CONNECTED) {
27+
Serial.print('.');
28+
delay(1000);
29+
}
30+
31+
// print ip address
32+
Serial.println();
33+
Serial.println(WiFi.localIP());
34+
35+
// use full volume of VS1053
36+
out.setVolume(1.0);
37+
38+
// Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here
39+
// client.setServerIP(IPAddress(192,168,1,38));
40+
41+
// start snap client
42+
client.begin(synch);
43+
}
44+
45+
void loop() {
46+
client.doLoop();
47+
}

0 commit comments

Comments
 (0)