Skip to content

Commit d3b7b00

Browse files
committed
Correct Server IP initialization
1 parent 0689bfa commit d3b7b00

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

examples/SnapClientFreeRTOS/SnapClientFreeRTOS.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ AudioBoardStream out(AudioKitEs8388V1); // or replace with e.g. I2SStream out;
1313
//WAVDecoder pcm;
1414
OpusAudioDecoder opus;
1515
WiFiClient wifi;
16-
SnapProcessorRTOS rtos(1024*8);
16+
SnapProcessorRTOS rtos(1024*8); // define queue with 8 kbytes
1717
SnapTimeSyncDynamic synch(172, 10); // optional configuratioin
1818
SnapClient client(wifi, out, opus);
1919

src/SnapClient.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class SnapClient {
3838
p_decoder = &decoder;
3939
p_output = &output_adapter;
4040
p_client = &client;
41+
server_ip.fromString(CONFIG_SNAPCAST_SERVER_HOST);
4142
}
4243

4344
SnapClient(Client &client, AudioStream &stream, StreamingDecoder &decoder,
@@ -48,13 +49,15 @@ class SnapClient {
4849
output_adapter.setStream(stream);
4950
p_output = &output_adapter;
5051
p_client = &client;
52+
server_ip.fromString(CONFIG_SNAPCAST_SERVER_HOST);
5153
}
5254

5355
SnapClient(Client &client, AudioOutput &output, AudioDecoder &decoder) {
5456
p_decoder = &decoder;
5557
p_output = &output;
5658
p_client = &client;
57-
}
59+
server_ip.fromString(CONFIG_SNAPCAST_SERVER_HOST);
60+
}
5861

5962
SnapClient(Client &client, AudioOutput &output, StreamingDecoder &decoder,
6063
int bufferSize = CONFIG_STREAMIN_DECODER_BUFFER) {
@@ -73,7 +76,7 @@ class SnapClient {
7376

7477
/// @brief Defines the Snapcast Server IP address
7578
/// @param address
76-
void setServerIP(IPAddress ipAddress) { this->address = ipAddress; }
79+
void setServerIP(IPAddress ipAddress) { this->server_ip = ipAddress; }
7780

7881
/// Defines the time synchronization logic
7982
void setSnapTimeSync(SnapTimeSync &timeSync){
@@ -111,7 +114,8 @@ class SnapClient {
111114
SnapTime::instance().setupSNTPTime();
112115
#endif
113116

114-
p_snapprocessor->setServerIP(address);
117+
p_snapprocessor->setServerIP(server_ip);
118+
p_snapprocessor->setServerPort(server_port);
115119
p_snapprocessor->setOutput(*p_output);
116120
p_snapprocessor->snapOutput().setSnapTimeSync(*p_time_sync);
117121
p_snapprocessor->setDecoder(*p_decoder);
@@ -158,7 +162,8 @@ class SnapClient {
158162
AudioDecoder *p_decoder = nullptr;
159163
Client *p_client = nullptr;
160164
SnapTimeSync *p_time_sync = nullptr;
161-
IPAddress address;
165+
IPAddress server_ip;
166+
int server_port = CONFIG_SNAPCAST_SERVER_PORT;
162167

163168
void setupMDNS() {
164169
#if CONFIG_SNAPCLIENT_USE_MDNS && defined(ESP32)

0 commit comments

Comments
 (0)