diff --git a/_audio_server_8h_source.html b/_audio_server_8h_source.html
index 920025f42..82781a4a1 100644
--- a/_audio_server_8h_source.html
+++ b/_audio_server_8h_source.html
@@ -81,373 +81,374 @@ $(function() {
-
-
-
-
- 17 #include "AudioCodecs/CodecWAV.h"
-
-
-
-
- 23 typedef void (*AudioServerDataCallback)(Print *out);
-
- 34 template<
class Client,
class Server>
-
-
- 41 AudioServerT(
int port = 80) {
-
- 43 copier.setCheckAvailableForWrite(
false);
-
-
-
- 53 AudioServerT(
const char *network,
const char *password,
int port = 80) {
- 54 this->network = (
char *)network;
- 55 this->password = (
char *)password;
-
- 57 copier.setCheckAvailableForWrite(
false);
-
-
-
- 68 bool begin(Stream &in,
const char *contentType) {
-
-
- 71 this->content_type = contentType;
-
-
-
-
-
-
-
-
-
- 87 bool begin(AudioServerDataCallback cb,
const char *contentType) {
-
-
-
- 91 this->content_type = contentType;
-
-
-
-
-
-
-
-
-
-
- 110 bool copy() {
return doLoop(); }
-
-
-
-
- 119 if (!client_obj.connected()) {
- 120 #if USE_SERVER_ACCEPT
- 121 client_obj = server.accept();
-
- 123 client_obj = server.available();
-
-
-
-
-
- 129 if (callback ==
nullptr) {
- 130 LOGD(
"copy data...");
- 131 if (converter_ptr ==
nullptr) {
-
-
- 134 copier.copy(*converter_ptr);
-
-
-
-
- 139 LOGI(
"stop client...");
-
-
-
-
-
- 145 LOGI(
"client was not connected");
-
-
-
-
-
- 152 void setConverter(BaseConverter *c) { converter_ptr = c; }
-
- 155 Stream &out() {
return client_obj; }
-
- 158 Client *out_ptr() {
return &client_obj; }
-
- 161 bool isClientConnected() {
return client_obj.connected(); }
-
- 164 void setCopyBufferSize(
int size){
-
-
-
-
-
-
-
-
-
-
-
- 176 char *password =
nullptr;
- 177 char *network =
nullptr;
-
-
- 180 const char *content_type =
nullptr;
- 181 AudioServerDataCallback callback =
nullptr;
- 182 Stream *in =
nullptr;
-
- 184 BaseConverter *converter_ptr =
nullptr;
-
- 186 void setupServer(
int port) {
-
-
-
-
-
-
-
- 194 if (WiFi.status() != WL_CONNECTED && network !=
nullptr &&
- 195 password !=
nullptr) {
- 196 WiFi.begin(network, password);
- 197 while (WiFi.status() != WL_CONNECTED) {
-
-
-
-
- 202 WiFi.setSleep(
false);
-
-
-
- 206 Serial.print(
"IP address: ");
- 207 Serial.println(WiFi.localIP());
-
-
-
- 211 virtual void sendReplyHeader() {
-
-
-
- 215 client_obj.println(
"HTTP/1.1 200 OK");
- 216 LOGI(
"Reply: HTTP/1.1 200 OK");
- 217 if (content_type !=
nullptr) {
- 218 client_obj.print(
"Content-type:");
- 219 client_obj.println(content_type);
- 220 LOGI(
"Content-type: %s", content_type);
-
- 222 client_obj.println();
- 223 if (!client_obj.connected()){
- 224 LOGE(
"connection was closed");
-
-
-
- 228 virtual void sendReplyContent() {
-
- 230 if (callback !=
nullptr) {
-
- 232 LOGI(
"sendReply - calling callback");
- 233 callback(&client_obj);
-
- 235 }
else if (in !=
nullptr) {
-
- 237 LOGI(
"sendReply - Returning audio stream...");
- 238 copier.begin(client_obj, *in);
- 239 if (!client_obj.connected()){
- 240 LOGE(
"connection was closed");
-
-
-
-
-
- 246 void processClient() {
-
-
-
-
-
- 252 while (client_obj.connected()) {
-
-
- 255 char c = client_obj.read();
-
- 257 LOGI(
"Request: %s", currentLine.c_str());
-
-
-
- 261 if (currentLine.length() == 0) {
-
-
-
-
-
-
-
- 269 }
else if (c !=
'\r') {
-
-
-
-
-
-
-
-
-
-
- 280 using AudioServer = AudioServerT<WiFiClient, WiFiServer>;
- 281 using AudioServerWiFi = AudioServerT<WiFiClient, WiFiServer>;
-
- 283 using AudioServer = AudioServerT<EthernetClient, EthernetServer>;
-
-
-
+
+
+ 15 # include <Ethernet.h>
+
+
+ 18 #include "AudioCodecs/CodecWAV.h"
+
+
+
+
+ 24 typedef void (*AudioServerDataCallback)(Print *out);
+
+ 35 template<
class Client,
class Server>
+
+
+ 42 AudioServerT(
int port = 80) {
+
+ 44 copier.setCheckAvailableForWrite(
false);
+
+
+
+ 54 AudioServerT(
const char *network,
const char *password,
int port = 80) {
+ 55 this->network = (
char *)network;
+ 56 this->password = (
char *)password;
+
+ 58 copier.setCheckAvailableForWrite(
false);
+
+
+
+ 69 bool begin(Stream &in,
const char *contentType) {
+
+
+ 72 this->content_type = contentType;
+
+
+
+
+
+
+
+
+
+ 88 bool begin(AudioServerDataCallback cb,
const char *contentType) {
+
+
+
+ 92 this->content_type = contentType;
+
+
+
+
+
+
+
+
+
+
+ 111 bool copy() {
return doLoop(); }
+
+
+
+
+ 120 if (!client_obj.connected()) {
+ 121 #if USE_SERVER_ACCEPT
+ 122 client_obj = server.accept();
+
+ 124 client_obj = server.available();
+
+
+
+
+
+ 130 if (callback ==
nullptr) {
+ 131 LOGD(
"copy data...");
+ 132 if (converter_ptr ==
nullptr) {
+
+
+ 135 copier.copy(*converter_ptr);
+
+
+
+
+ 140 LOGI(
"stop client...");
+
+
+
+
+
+ 146 LOGI(
"client was not connected");
+
+
+
+
+
+ 153 void setConverter(BaseConverter *c) { converter_ptr = c; }
+
+ 156 Stream &out() {
return client_obj; }
+
+ 159 Client *out_ptr() {
return &client_obj; }
+
+ 162 bool isClientConnected() {
return client_obj.connected(); }
+
+ 165 void setCopyBufferSize(
int size){
+
+
+
+
+
+
+
+
+
+
+
+ 177 char *password =
nullptr;
+ 178 char *network =
nullptr;
+
+
+ 181 const char *content_type =
nullptr;
+ 182 AudioServerDataCallback callback =
nullptr;
+ 183 Stream *in =
nullptr;
+
+ 185 BaseConverter *converter_ptr =
nullptr;
+
+ 187 void setupServer(
int port) {
+
+
+
+
+
+
+
+ 195 if (WiFi.status() != WL_CONNECTED && network !=
nullptr &&
+ 196 password !=
nullptr) {
+ 197 WiFi.begin(network, password);
+ 198 while (WiFi.status() != WL_CONNECTED) {
+
+
+
+
+ 203 WiFi.setSleep(
false);
+
+
+
+ 207 Serial.print(
"IP address: ");
+ 208 Serial.println(WiFi.localIP());
+
+
+
+ 212 virtual void sendReplyHeader() {
+
+
+
+ 216 client_obj.println(
"HTTP/1.1 200 OK");
+ 217 LOGI(
"Reply: HTTP/1.1 200 OK");
+ 218 if (content_type !=
nullptr) {
+ 219 client_obj.print(
"Content-type:");
+ 220 client_obj.println(content_type);
+ 221 LOGI(
"Content-type: %s", content_type);
+
+ 223 client_obj.println();
+ 224 if (!client_obj.connected()){
+ 225 LOGE(
"connection was closed");
+
+
+
+ 229 virtual void sendReplyContent() {
+
+ 231 if (callback !=
nullptr) {
+
+ 233 LOGI(
"sendReply - calling callback");
+ 234 callback(&client_obj);
+
+ 236 }
else if (in !=
nullptr) {
+
+ 238 LOGI(
"sendReply - Returning audio stream...");
+ 239 copier.begin(client_obj, *in);
+ 240 if (!client_obj.connected()){
+ 241 LOGE(
"connection was closed");
+
+
+
+
+
+ 247 void processClient() {
+
+
+
+
+
+ 253 while (client_obj.connected()) {
+
+
+ 256 char c = client_obj.read();
+
+ 258 LOGI(
"Request: %s", currentLine.c_str());
+
+
+
+ 262 if (currentLine.length() == 0) {
+
+
+
+
+
+
+
+ 270 }
else if (c !=
'\r') {
+
+
+
+
+
+
+
+
+
+
+ 281 using AudioServer = AudioServerT<WiFiClient, WiFiServer>;
+ 282 using AudioServerWiFi = AudioServerT<WiFiClient, WiFiServer>;
+
+
+
+ 286 using AudioServer = AudioServerT<EthernetClient, EthernetServer>;
287 using AudioServerEthernet = AudioServerT<EthernetClient, EthernetServer>;
- 298 class AudioEncoderServer :
public AudioServer {
-
- 304 AudioEncoderServer(AudioEncoder *encoder,
int port = 80) : AudioServer(port) {
- 305 this->encoder = encoder;
-
-
- 314 AudioEncoderServer(AudioEncoder *encoder,
const char *network,
- 315 const char *password,
int port = 80)
- 316 : AudioServer(network, password, port) {
- 317 this->encoder = encoder;
-
-
- 323 ~AudioEncoderServer() {}
-
- 333 bool begin(Stream &in,
int sample_rate,
int channels,
- 334 int bits_per_sample = 16, BaseConverter *converter =
nullptr) {
-
-
- 337 setConverter(converter);
- 338 audio_info.sample_rate = sample_rate;
- 339 audio_info.channels = channels;
- 340 audio_info.bits_per_sample = bits_per_sample;
- 341 encoder->setAudioInfo(audio_info);
-
- 343 encoded_stream.setOutput(&client_obj);
- 344 encoded_stream.setEncoder(encoder);
- 345 encoded_stream.begin(audio_info);
- 346 return AudioServer::begin(in, encoder->mime());
-
-
- 357 bool begin(Stream &in, AudioInfo info, BaseConverter *converter =
nullptr) {
-
-
- 360 this->audio_info = info;
- 361 setConverter(converter);
- 362 encoder->setAudioInfo(audio_info);
- 363 encoded_stream.setOutput(&client_obj);
- 364 encoded_stream.setEncoder(encoder);
- 365 if (!encoded_stream.begin(audio_info)){
- 366 LOGE(
"encoder begin failed");
-
-
-
- 370 return AudioServer::begin(in, encoder->mime());
-
-
- 380 bool begin(AudioStream &in, BaseConverter *converter =
nullptr) {
-
-
- 383 this->audio_info = in.audioInfo();
- 384 setConverter(converter);
- 385 encoder->setAudioInfo(audio_info);
- 386 encoded_stream.setOutput(&client_obj);
- 387 encoded_stream.setEncoder(encoder);
- 388 encoded_stream.begin(audio_info);
-
- 390 return AudioServer::begin(in, encoder->mime());
-
-
- 400 bool begin(AudioServerDataCallback cb,
int sample_rate,
int channels,
- 401 int bits_per_sample = 16) {
-
- 403 audio_info.sample_rate = sample_rate;
- 404 audio_info.channels = channels;
- 405 audio_info.bits_per_sample = bits_per_sample;
- 406 encoder->setAudioInfo(audio_info);
-
- 408 return AudioServer::begin(cb, encoder->mime());
-
-
-
- 412 AudioEncoder *audioEncoder() {
return encoder; }
-
-
-
- 416 EncodedAudioOutput encoded_stream;
- 417 AudioInfo audio_info;
- 418 AudioEncoder *encoder =
nullptr;
-
-
- 421 void sendReplyHeader()
override {}
-
- 423 void sendReplyContent()
override {
-
-
-
-
-
-
-
- 431 if (callback !=
nullptr) {
-
- 433 encoded_stream.setOutput(out_ptr());
- 434 encoded_stream.setEncoder(encoder);
- 435 encoded_stream.begin();
-
-
- 438 LOGI(
"sendReply - calling callback");
-
- 440 AudioServer::sendReplyHeader();
- 441 callback(&encoded_stream);
-
- 443 }
else if (in !=
nullptr) {
-
- 445 LOGI(
"sendReply - Returning encoded stream...");
-
- 447 encoded_stream.setOutput(out_ptr());
- 448 encoded_stream.setEncoder(encoder);
- 449 encoded_stream.begin();
-
- 451 copier.begin(encoded_stream, *in);
- 452 if (!client_obj.connected()){
- 453 LOGE(
"connection was closed");
-
-
- 456 AudioServer::sendReplyHeader();
-
-
-
-
- 469 class AudioWAVServer :
public AudioEncoderServer {
-
- 475 AudioWAVServer(
int port = 80) : AudioEncoderServer(new WAVEncoder(), port) {}
-
- 483 AudioWAVServer(
const char *network,
const char *password,
int port = 80)
- 484 : AudioEncoderServer(new WAVEncoder(), network, password, port) {}
-
-
- 488 AudioEncoder *encoder = audioEncoder();
- 489 if (encoder !=
nullptr) {
-
-
-
-
-
- 495 WAVEncoder &wavEncoder() {
return *
static_cast<WAVEncoder *
>(encoder); }
-
-
-
-
-
+
+ 299 class AudioEncoderServer :
public AudioServer {
+
+ 305 AudioEncoderServer(AudioEncoder *encoder,
int port = 80) : AudioServer(port) {
+ 306 this->encoder = encoder;
+
+
+ 315 AudioEncoderServer(AudioEncoder *encoder,
const char *network,
+ 316 const char *password,
int port = 80)
+ 317 : AudioServer(network, password, port) {
+ 318 this->encoder = encoder;
+
+
+ 324 ~AudioEncoderServer() {}
+
+ 334 bool begin(Stream &in,
int sample_rate,
int channels,
+ 335 int bits_per_sample = 16, BaseConverter *converter =
nullptr) {
+
+
+ 338 setConverter(converter);
+ 339 audio_info.sample_rate = sample_rate;
+ 340 audio_info.channels = channels;
+ 341 audio_info.bits_per_sample = bits_per_sample;
+ 342 encoder->setAudioInfo(audio_info);
+
+ 344 encoded_stream.setOutput(&client_obj);
+ 345 encoded_stream.setEncoder(encoder);
+ 346 encoded_stream.begin(audio_info);
+ 347 return AudioServer::begin(in, encoder->mime());
+
+
+ 358 bool begin(Stream &in, AudioInfo info, BaseConverter *converter =
nullptr) {
+
+
+ 361 this->audio_info = info;
+ 362 setConverter(converter);
+ 363 encoder->setAudioInfo(audio_info);
+ 364 encoded_stream.setOutput(&client_obj);
+ 365 encoded_stream.setEncoder(encoder);
+ 366 if (!encoded_stream.begin(audio_info)){
+ 367 LOGE(
"encoder begin failed");
+
+
+
+ 371 return AudioServer::begin(in, encoder->mime());
+
+
+ 381 bool begin(AudioStream &in, BaseConverter *converter =
nullptr) {
+
+
+ 384 this->audio_info = in.audioInfo();
+ 385 setConverter(converter);
+ 386 encoder->setAudioInfo(audio_info);
+ 387 encoded_stream.setOutput(&client_obj);
+ 388 encoded_stream.setEncoder(encoder);
+ 389 encoded_stream.begin(audio_info);
+
+ 391 return AudioServer::begin(in, encoder->mime());
+
+
+ 401 bool begin(AudioServerDataCallback cb,
int sample_rate,
int channels,
+ 402 int bits_per_sample = 16) {
+
+ 404 audio_info.sample_rate = sample_rate;
+ 405 audio_info.channels = channels;
+ 406 audio_info.bits_per_sample = bits_per_sample;
+ 407 encoder->setAudioInfo(audio_info);
+
+ 409 return AudioServer::begin(cb, encoder->mime());
+
+
+
+ 413 AudioEncoder *audioEncoder() {
return encoder; }
+
+
+
+ 417 EncodedAudioOutput encoded_stream;
+ 418 AudioInfo audio_info;
+ 419 AudioEncoder *encoder =
nullptr;
+
+
+ 422 void sendReplyHeader()
override {}
+
+ 424 void sendReplyContent()
override {
+
+
+
+
+
+
+
+ 432 if (callback !=
nullptr) {
+
+ 434 encoded_stream.setOutput(out_ptr());
+ 435 encoded_stream.setEncoder(encoder);
+ 436 encoded_stream.begin();
+
+
+ 439 LOGI(
"sendReply - calling callback");
+
+ 441 AudioServer::sendReplyHeader();
+ 442 callback(&encoded_stream);
+
+ 444 }
else if (in !=
nullptr) {
+
+ 446 LOGI(
"sendReply - Returning encoded stream...");
+
+ 448 encoded_stream.setOutput(out_ptr());
+ 449 encoded_stream.setEncoder(encoder);
+ 450 encoded_stream.begin();
+
+ 452 copier.begin(encoded_stream, *in);
+ 453 if (!client_obj.connected()){
+ 454 LOGE(
"connection was closed");
+
+
+ 457 AudioServer::sendReplyHeader();
+
+
+
+
+ 470 class AudioWAVServer :
public AudioEncoderServer {
+
+ 476 AudioWAVServer(
int port = 80) : AudioEncoderServer(new WAVEncoder(), port) {}
+
+ 484 AudioWAVServer(
const char *network,
const char *password,
int port = 80)
+ 485 : AudioEncoderServer(new WAVEncoder(), network, password, port) {}
+
+
+ 489 AudioEncoder *encoder = audioEncoder();
+ 490 if (encoder !=
nullptr) {
+
+
+
+
+
+ 496 WAVEncoder &wavEncoder() {
return *
static_cast<WAVEncoder *
>(encoder); }
+
+
+
+
+
void stop()
Public generic methods.
Definition: AudioRuntime.h:27