webserver example correction

This commit is contained in:
Phil Schatzmann 2022-09-12 10:13:24 +02:00
parent 80659b8409
commit 39c2cb6332
5 changed files with 17 additions and 9 deletions

View File

@ -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(){

View File

@ -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;
@ -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
}

View File

@ -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;

View File

@ -1,5 +1,5 @@
name=audio-tools
version=0.8.0
version=0.9.1
author=Phil Schatzmann
maintainer=Phil Schatzmann <phil.schatzmann@gmail.com>
sentence=Some useful audio processing classes

View File

@ -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));