fix name sclashes in esp8266 SAM

This commit is contained in:
gemu2015 2020-08-15 17:17:13 +02:00
parent 34a0650b00
commit 45a464082a
11 changed files with 27 additions and 24 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
@ -23,9 +23,9 @@
#include <Arduino.h> #include <Arduino.h>
#ifdef ESP32 #ifdef ESP32
#include <HTTPClient.h> // #include <HTTPClient.h>
#else #else
#include <ESP8266HTTPClient.h> // #include <ESP8266HTTPClient.h>
#endif #endif
#include "AudioFileSourceHTTPStream.h" #include "AudioFileSourceHTTPStream.h"
@ -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
} }

View File

@ -2,7 +2,7 @@
#define RENDERTABS_H #define RENDERTABS_H
#include <pgmspace.h> #include <pgmspace.h>
#include "debug.h" #include "samdebug.h"
#if debug #if debug
#define PROGMEM #define PROGMEM
#endif #endif
@ -196,7 +196,7 @@ const unsigned char ampl3data[] PROGMEM =
//tab42240 //tab42240
const signed char sinus[256] PROGMEM = {0,3,6,9,12,16,19,22,25,28,31,34,37,40,43,46,49,51,54,57,60,63,65,68,71,73,76,78,81,83,85,88,90,92,94,96,98,100,102,104,106,107,109,111,112,113,115,116,117,118,120,121,122,122,123,124,125,125,126,126,126,127,127,127,127,127,127,127,126,126,126,125,125,124,123,122,122,121,120,118,117,116,115,113,112,111,109,107,106,104,102,100,98,96,94,92,90,88,85,83,81,78,76,73,71,68,65,63,60,57,54,51,49,46,43,40,37,34,31,28,25,22,19,16,12,9,6,3,0,-3,-6,-9,-12,-16,-19,-22,-25,-28,-31,-34,-37,-40,-43,-46,-49,-51,-54,-57,-60,-63,-65,-68,-71,-73,-76,-78,-81,-83,-85,-88,-90,-92,-94,-96,-98,-100,-102,-104,-106,-107,-109,-111,-112,-113,-115,-116,-117,-118,-120,-121,-122,-122,-123,-124,-125,-125,-126,-126,-126,-127,-127,-127,-127,-127,-127,-127,-126,-126,-126,-125,-125,-124,-123,-122,-122,-121,-120,-118,-117,-116,-115,-113,-112,-111,-109,-107,-106,-104,-102,-100,-98,-96,-94,-92,-90,-88,-85,-83,-81,-78,-76,-73,-71,-68,-65,-63,-60,-57,-54,-51,-49,-46,-43,-40,-37,-34,-31,-28,-25,-22,-19,-16,-12,-9,-6,-3}; const signed char sinus[256] PROGMEM = {0,3,6,9,12,16,19,22,25,28,31,34,37,40,43,46,49,51,54,57,60,63,65,68,71,73,76,78,81,83,85,88,90,92,94,96,98,100,102,104,106,107,109,111,112,113,115,116,117,118,120,121,122,122,123,124,125,125,126,126,126,127,127,127,127,127,127,127,126,126,126,125,125,124,123,122,122,121,120,118,117,116,115,113,112,111,109,107,106,104,102,100,98,96,94,92,90,88,85,83,81,78,76,73,71,68,65,63,60,57,54,51,49,46,43,40,37,34,31,28,25,22,19,16,12,9,6,3,0,-3,-6,-9,-12,-16,-19,-22,-25,-28,-31,-34,-37,-40,-43,-46,-49,-51,-54,-57,-60,-63,-65,-68,-71,-73,-76,-78,-81,-83,-85,-88,-90,-92,-94,-96,-98,-100,-102,-104,-106,-107,-109,-111,-112,-113,-115,-116,-117,-118,-120,-121,-122,-122,-123,-124,-125,-125,-126,-126,-126,-127,-127,-127,-127,-127,-127,-127,-126,-126,-126,-125,-125,-124,-123,-122,-122,-121,-120,-118,-117,-116,-115,-113,-112,-111,-109,-107,-106,-104,-102,-100,-98,-96,-94,-92,-90,-88,-85,-83,-81,-78,-76,-73,-71,-68,-65,-63,-60,-57,-54,-51,-49,-46,-43,-40,-37,-34,-31,-28,-25,-22,-19,-16,-12,-9,-6,-3};
//tab42496 //tab42496
const unsigned char rectangle[] PROGMEM = const unsigned char rectangle[] PROGMEM =

View File

@ -2,7 +2,7 @@
#define SAMTABS_H #define SAMTABS_H
#include <pgmspace.h> #include <pgmspace.h>
#include "debug.h" #include "samdebug.h"
#if debug #if debug
#define PROGMEM #define PROGMEM
#endif #endif

View File

@ -2,7 +2,7 @@
#include <string.h> #include <string.h>
#include "reciter.h" #include "reciter.h"
#include "ReciterTabs.h" #include "ReciterTabs.h"
#include "debug.h" #include "samdebug.h"
#include "SamData.h" #include "SamData.h"
unsigned char A, X, Y; unsigned char A, X, Y;

View File

@ -5,7 +5,7 @@
#include "render.h" #include "render.h"
#include "RenderTabs.h" #include "RenderTabs.h"
#include "debug.h" #include "samdebug.h"
//extern int debug; //extern int debug;
#include <pgmspace.h> #include <pgmspace.h>
#include "SamData.h" #include "SamData.h"

View File

@ -32,7 +32,7 @@ default_envs =
; tasmota-BR ; tasmota-BR
; tasmota-CN ; tasmota-CN
; tasmota-CZ ; tasmota-CZ
tasmota-DE ; tasmota-DE
; tasmota-ES ; tasmota-ES
; tasmota-FR ; tasmota-FR
; tasmota-GR ; tasmota-GR