Skip to content

Commit 39c2cb6

Browse files
committed
webserver example correction
1 parent 80659b8 commit 39c2cb6

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

examples/examples-audiokit/streams-audiokit-webserver_mp3/streams-audiokit-webserver_mp3.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "AudioCodecs/CodecMP3LAME.h"
1212
#include "AudioLibs/AudioKit.h"
1313

14-
AudioEncoderServer server(new MP3EncoderLAME(),"Phil Schatzmann","sabrina01");
14+
AudioEncoderServer server(new MP3EncoderLAME(),"SSID","password");
1515
AudioKitStream i2sStream; // Access I2S as stream
1616

1717
void setup(){

examples/examples-webserver/streams-generator-webserverex_wav/streams-generator-webserverex_wav.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "AudioLibs/AudioServerEx.h"
1313

1414
// WIFI
15-
const char *ssid = "Phil Schatzmann";
16-
const char *password = "sabrina01";
15+
const char *ssid = "SSID";
16+
const char *password = "password";
1717
const int sample_rate = 10000;
1818
const int channels = 1;
1919

@@ -44,5 +44,6 @@ void setup() {
4444

4545
// copy the data
4646
void loop() {
47-
copier.copy();
47+
copier.copy(); // copy data to server
48+
server.copy(); // from server to client
4849
}

examples/examples-webserver/streams-generator-webserverex_wav1/streams-generator-webserverex_wav1.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "AudioLibs/AudioServerEx.h"
1313

1414
// WIFI
15-
const char *ssid = "Phil Schatzmann";
16-
const char *password = "sabrina01";
15+
const char *ssid = "SSID";
16+
const char *password = "password";
1717
const int sample_rate = 10000;
1818
const int channels = 1;
1919

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=audio-tools
2-
version=0.8.0
2+
version=0.9.1
33
author=Phil Schatzmann
44
maintainer=Phil Schatzmann <[email protected]>
55
sentence=Some useful audio processing classes

src/AudioTools/AudioCopy.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,20 @@ class StreamCopyT {
9191
LOGD(LOG_METHOD);
9292
// if not initialized we do nothing
9393
if (from==nullptr || to==nullptr) return 0;
94-
94+
95+
// If we try to write to a server we might not have any output destination yet
96+
int to_write = to->availableForWrite();
97+
if (to_write<=0){
98+
delay(500);
99+
return 0;
100+
}
101+
102+
95103
size_t result = 0;
96104
size_t delayCount = 0;
97105
size_t len = available();
98106
size_t bytes_to_read = buffer_size;
99107
size_t bytes_read = 0;
100-
int to_write = to->availableForWrite();
101108

102109
if (len>0){
103110
bytes_to_read = min(len, static_cast<size_t>(buffer_size));

0 commit comments

Comments
 (0)