Merge branch 'development' into teleinfo

This commit is contained in:
Charles 2020-08-16 10:30:45 +02:00 committed by GitHub
commit ed08c29ef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
568 changed files with 252 additions and 63 deletions

View File

@ -1,7 +1,7 @@
/* /*
AudioFileSourceHTTPStream AudioFileSourceHTTPStream
Connect to a HTTP based streaming service Connect to a HTTP based streaming service
Copyright (C) 2017 Earle F. Philhower, III Copyright (C) 2017 Earle F. Philhower, III
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@ -25,6 +25,7 @@
#ifdef ESP32 #ifdef ESP32
#include <HTTPClient.h> #include <HTTPClient.h>
#else #else
#include <WiFiClient.h>
#include <ESP8266HTTPClient.h> #include <ESP8266HTTPClient.h>
#endif #endif
#include "AudioFileSource.h" #include "AudioFileSource.h"
@ -37,7 +38,7 @@ class AudioFileSourceHTTPStream : public AudioFileSource
AudioFileSourceHTTPStream(); AudioFileSourceHTTPStream();
AudioFileSourceHTTPStream(const char *url); AudioFileSourceHTTPStream(const char *url);
virtual ~AudioFileSourceHTTPStream() override; virtual ~AudioFileSourceHTTPStream() override;
virtual bool open(const char *url) override; virtual bool open(const char *url) override;
virtual uint32_t read(void *data, uint32_t len) override; virtual uint32_t read(void *data, uint32_t len) override;
virtual uint32_t readNonBlock(void *data, uint32_t len) override; virtual uint32_t readNonBlock(void *data, uint32_t len) override;
@ -63,4 +64,3 @@ class AudioFileSourceHTTPStream : public AudioFileSource
#endif #endif

View File

@ -1,7 +1,7 @@
/* /*
AudioFileSourceHTTPStream AudioFileSourceHTTPStream
Connect to a HTTP based streaming service Connect to a HTTP based streaming service
Copyright (C) 2017 Earle F. Philhower, III Copyright (C) 2017 Earle F. Philhower, III
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@ -36,7 +36,7 @@ class AudioFileSourceICYStream : public AudioFileSourceHTTPStream
AudioFileSourceICYStream(); AudioFileSourceICYStream();
AudioFileSourceICYStream(const char *url); AudioFileSourceICYStream(const char *url);
virtual ~AudioFileSourceICYStream() override; virtual ~AudioFileSourceICYStream() override;
virtual bool open(const char *url) override; virtual bool open(const char *url) override;
private: private:
@ -47,4 +47,3 @@ class AudioFileSourceICYStream : public AudioFileSourceHTTPStream
#endif #endif

View File

@ -1,7 +1,7 @@
/* /*
AudioFileSourceSPIFFS AudioFileSourceSPIFFS
Input SD card "file" to be used by AudioGenerator Input SD card "file" to be used by AudioGenerator
Copyright (C) 2017 Earle F. Philhower, III Copyright (C) 2017 Earle F. Philhower, III
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@ -22,6 +22,10 @@
#define _AUDIOFILESOURCESD_H #define _AUDIOFILESOURCESD_H
#include "AudioFileSource.h" #include "AudioFileSource.h"
#ifdef ESP8266
#include <SdFat.h>
#include <SDFS.h>
#endif
#include <SD.h> #include <SD.h>
@ -31,7 +35,7 @@ class AudioFileSourceSD : public AudioFileSource
AudioFileSourceSD(); AudioFileSourceSD();
AudioFileSourceSD(const char *filename); AudioFileSourceSD(const char *filename);
virtual ~AudioFileSourceSD() override; virtual ~AudioFileSourceSD() override;
virtual bool open(const char *filename) override; virtual bool open(const char *filename) override;
virtual uint32_t read(void *data, uint32_t len) override; virtual uint32_t read(void *data, uint32_t len) override;
virtual bool seek(int32_t pos, int dir) override; virtual bool seek(int32_t pos, int dir) override;
@ -46,4 +50,3 @@ class AudioFileSourceSD : public AudioFileSource
#endif #endif

View File

@ -1,7 +1,7 @@
/* /*
AudioGeneratorMP3 AudioGeneratorMP3
Wrap libmad MP3 library to play audio Wrap libmad MP3 library to play audio
Copyright (C) 2017 Earle F. Philhower, III Copyright (C) 2017 Earle F. Philhower, III
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@ -52,7 +52,7 @@ AudioGeneratorMP3::~AudioGeneratorMP3()
free(synth); free(synth);
free(frame); free(frame);
free(stream); free(stream);
} }
} }
@ -153,7 +153,7 @@ bool AudioGeneratorMP3::GetOneSample(int16_t sample[2])
output->SetChannels(synth->pcm.channels); output->SetChannels(synth->pcm.channels);
lastChannels = synth->pcm.channels; lastChannels = synth->pcm.channels;
} }
// If we're here, we have one decoded frame and sent 0 or more samples out // If we're here, we have one decoded frame and sent 0 or more samples out
if (samplePtr < synth->pcm.length) { if (samplePtr < synth->pcm.length) {
sample[AudioOutput::LEFTCHANNEL ] = synth->pcm.samples[0][samplePtr]; sample[AudioOutput::LEFTCHANNEL ] = synth->pcm.samples[0][samplePtr];
@ -161,7 +161,7 @@ bool AudioGeneratorMP3::GetOneSample(int16_t sample[2])
samplePtr++; samplePtr++;
} else { } else {
samplePtr = 0; samplePtr = 0;
switch ( mad_synth_frame_onens(synth, frame, nsCount++) ) { switch ( mad_synth_frame_onens(synth, frame, nsCount++) ) {
case MAD_FLOW_STOP: case MAD_FLOW_STOP:
case MAD_FLOW_BREAK: audioLogger->printf_P(PSTR("msf1ns failed\n")); case MAD_FLOW_BREAK: audioLogger->printf_P(PSTR("msf1ns failed\n"));
@ -272,17 +272,19 @@ bool AudioGeneratorMP3::begin(AudioFileSource *source, AudioOutput *output)
stream = NULL; stream = NULL;
frame = NULL; frame = NULL;
synth = NULL; synth = NULL;
uint32_t size = buffLen + sizeof(struct mad_stream) + sizeof(struct mad_frame) + sizeof(struct mad_synth);
audioLogger->printf_P("OOM error in MP3: Want %d bytes\n", size);
return false; return false;
} }
} }
mad_stream_init(stream); mad_stream_init(stream);
mad_frame_init(frame); mad_frame_init(frame);
mad_synth_init(synth); mad_synth_init(synth);
synth->pcm.length = 0; synth->pcm.length = 0;
mad_stream_options(stream, 0); // TODO - add options support mad_stream_options(stream, 0); // TODO - add options support
madInitted = true; madInitted = true;
running = true; running = true;
return true; return true;
} }
@ -349,4 +351,3 @@ extern "C" {
} }
#endif #endif
} }

Some files were not shown because too many files have changed in this diff Show More