Skip to content

Commit

Permalink
webserver example correction
Browse files Browse the repository at this point in the history
  • Loading branch information
pschatzmann committed Sep 12, 2022
1 parent 80659b8 commit 39c2cb6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "AudioCodecs/CodecMP3LAME.h"
#include "AudioLibs/AudioKit.h"

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

void setup(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "AudioLibs/AudioServerEx.h"

// WIFI
const char *ssid = "Phil Schatzmann";
const char *password = "sabrina01";
const char *ssid = "SSID";
const char *password = "password";
const int sample_rate = 10000;
const int channels = 1;

Expand Down Expand Up @@ -44,5 +44,6 @@ void setup() {

// copy the data
void loop() {
copier.copy();
copier.copy(); // copy data to server
server.copy(); // from server to client
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "AudioLibs/AudioServerEx.h"

// WIFI
const char *ssid = "Phil Schatzmann";
const char *password = "sabrina01";
const char *ssid = "SSID";
const char *password = "password";
const int sample_rate = 10000;
const int channels = 1;

Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=audio-tools
version=0.8.0
version=0.9.1
author=Phil Schatzmann
maintainer=Phil Schatzmann <[email protected]>
sentence=Some useful audio processing classes
Expand Down
11 changes: 9 additions & 2 deletions src/AudioTools/AudioCopy.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,20 @@ class StreamCopyT {
LOGD(LOG_METHOD);
// if not initialized we do nothing
if (from==nullptr || to==nullptr) return 0;


// If we try to write to a server we might not have any output destination yet
int to_write = to->availableForWrite();
if (to_write<=0){
delay(500);
return 0;
}


size_t result = 0;
size_t delayCount = 0;
size_t len = available();
size_t bytes_to_read = buffer_size;
size_t bytes_read = 0;
int to_write = to->availableForWrite();

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

0 comments on commit 39c2cb6

Please sign in to comment.