Skip to content

Commit 15a7b5e

Browse files
committed
Correct compile errors for tests
1 parent 20e6904 commit 15a7b5e

35 files changed

+159
-147
lines changed

src/AudioCodecs/CodecHelix.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class DecoderHelix : public AudioDecoder {
5959
size_t write(const void *data, size_t len) {
6060
LOGD("%s: %zu", LOG_METHOD, len);
6161
if (p_decoder == nullptr) {
62-
setupDecoder((const char *)data);
62+
setupDecoder((const byte *)data);
6363
p_decoder->begin();
6464
}
6565
return p_decoder->write(data, len);
@@ -79,14 +79,14 @@ class DecoderHelix : public AudioDecoder {
7979
AudioBaseInfo noInfo;
8080

8181
/// Defines the decoder based on the audio format
82-
void setupDecoder(const char *start) {
82+
void setupDecoder(const byte *start) {
8383
if (start[0] == 0xFF && start[1] == 0xF1) {
8484
p_decoder = new AACDecoderHelix();
8585
LOGI("using AACDecoderHelix");
86-
} else if (start[0] == 0xFF || start[0] == 0xFE || strncmp("ID3", start, 3)==0) {
86+
} else if (start[0] == 0xFF || start[0] == 0xFE || strncmp("ID3", (const char*)start, 3)==0) {
8787
p_decoder = new MP3DecoderHelix();
8888
LOGI("using MP3DecoderHelix");
89-
} else if (strncmp("RIFF", start, 4)==0) {
89+
} else if (strncmp("RIFF", (const char*)start, 4)==0) {
9090
p_decoder = new WAVDecoder();
9191
LOGI("using WAVDecoder");
9292
}

src/AudioCodecs/CodecMP3LAME.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class MP3EncoderLAME : public AudioEncoder {
3131
enc = new liblame::MP3EncoderLAME();
3232
}
3333

34-
MP3EncoderLAME(Stream &out_stream){
34+
MP3EncoderLAME(Print &out_stream){
3535
LOGD(LOG_METHOD);
3636
enc = new liblame::MP3EncoderLAME(out_stream);
3737
}

src/AudioCodecs/CodecWAV.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class WAVHeader {
5252
this->len = len;
5353
this->data_pos = 0l;
5454

55-
memset(&headerInfo, 0, sizeof(WAVAudioInfo));
55+
memset((void*)&headerInfo, 0, sizeof(WAVAudioInfo));
5656
while (!eof()) {
5757
uint32_t tag, tag2, length;
5858
tag = read_tag();

src/AudioConfig.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,6 @@ typedef uint32_t eps32_i2s_sample_rate_type;
270270

271271

272272
//----------------
273-
#if defined(__linux__) || defined(_WIN32) || defined(__APPLE__)
274-
#define USE_URL_ARDUINO
275-
#define IS_DESKTOP
276-
#endif
277-
278273

279274
#ifdef IS_DESKTOP
280275
#define USE_URL_ARDUINO

src/AudioEffects/AudioEffect.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ typedef int16_t effect_t;
1616

1717
class AudioEffect {
1818
public:
19+
AudioEffect() = default;
20+
virtual ~AudioEffect() = default;
21+
1922
/// calculates the effect output from the input
2023
virtual effect_t process(effect_t in) = 0;
2124

src/AudioEffects/AudioEffects.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class AudioEffects : public SoundGenerator<effect_t> {
4646
}
4747

4848
/// Destructor
49-
~AudioEffects(){
49+
virtual ~AudioEffects(){
5050
LOGD(LOG_METHOD);
5151
for (int j=0;j<effects.size();j++){
5252
delete effects[j];
@@ -58,7 +58,10 @@ class AudioEffects : public SoundGenerator<effect_t> {
5858
LOGD(LOG_METHOD);
5959
generator_obj = in;
6060
// automatically activate this object
61-
begin();
61+
AudioBaseInfo info;
62+
info.channels = 1;
63+
info.bits_per_sample = sizeof(effect_t)*8;
64+
begin(info);
6265
}
6366

6467
/// Adds an effect object (by reference)

src/AudioEffects/AudioEffectsSuite.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ class FilterEffectBase : public EffectSuiteBase {
616616
return outSample;
617617
}
618618

619-
virtual effectsuite_t processDouble(effectsuite_t inputSample) {
619+
virtual effectsuite_t processDouble(effectsuite_t inputSample) override {
620620
return applyFilter(inputSample);
621621
}
622622

@@ -1162,7 +1162,7 @@ class FilteredDelay : public DelayEffectBase, public FilterEffectBase {
11621162
return out;
11631163
}
11641164

1165-
FilteredDelay *clone(){
1165+
FilteredDelay *clone() override {
11661166
return new FilteredDelay(*this);
11671167
}
11681168

@@ -1295,7 +1295,7 @@ class SimpleDelay : public DelayEffectBase, public EffectSuiteBase {
12951295
delayTransitionTimeInSamples = seconds * sampleRate;
12961296
}
12971297

1298-
SimpleDelay* clone(){
1298+
SimpleDelay* clone() override {
12991299
return new SimpleDelay(*this);
13001300
}
13011301

@@ -1434,7 +1434,7 @@ class SimpleFlanger : public DelayEffectBase, public EffectSuiteBase {
14341434
setEffectParams(.707, extSampleRate * .02, .1);
14351435
}
14361436

1437-
SimpleFlanger* clone(){
1437+
SimpleFlanger* clone() override {
14381438
return new SimpleFlanger(*this);
14391439
}
14401440

src/AudioEffects/SoundGenerator.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class SoundGenerator {
3535
LOGD(LOG_METHOD);
3636
active = true;
3737
activeWarningIssued = false;
38-
info.bits_per_sample = sizeof(T)*8;
38+
//info.bits_per_sample = sizeof(T)*8;
3939
}
4040

4141
/// ends the processing
@@ -75,6 +75,10 @@ class SoundGenerator {
7575
//LOGD("readBytes: %d", (int)lengthBytes);
7676
size_t result = 0;
7777
int ch = audioInfo().channels;
78+
if (ch==0){
79+
LOGE("Undefine number of channels: %d",ch);
80+
ch = 1;
81+
}
7882
int frame_size = sizeof(T) * ch;
7983
if (active){
8084
int len = lengthBytes / frame_size;

src/AudioHttp/ICYStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class ICYStreamDefault : public AbstractURLStream {
136136
}
137137

138138
/// not implemented
139-
virtual size_t write(const uint8_t *buffer, size_t size) {
139+
virtual size_t write(const uint8_t *buffer, size_t size) override {
140140
LOGE("N/A");
141141
return 0;
142142
}

src/AudioHttp/URLStream.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
#ifdef ESP8266
77
#include <ESP8266WiFi.h>
8+
#elif defined(IS_DESKTOP)
9+
#include <Client.h>
10+
#include <WiFiClient.h>
11+
typedef WiFiClient WiFiClientSecure;
812
#else
913
#include <Client.h>
1014
#include <WiFiClientSecure.h>
@@ -188,8 +192,12 @@ class URLStreamDefault : public AbstractURLStream {
188192
if (client!=nullptr) return *client;
189193
if (isSecure){
190194
if (clientSecure==nullptr){
195+
#ifndef IS_DESKTOP
191196
clientSecure = new WiFiClientSecure();
192197
clientSecure->setInsecure();
198+
#else
199+
clientSecure = new WiFiClient();
200+
#endif
193201
}
194202
LOGI("WiFiClientSecure");
195203
return *clientSecure;
@@ -214,6 +222,7 @@ class URLStreamDefault : public AbstractURLStream {
214222
}
215223

216224
void login(){
225+
#ifndef IS_DESKTOP
217226
LOGD("connectWiFi");
218227
if (WiFi.status() != WL_CONNECTED && network!=nullptr && password != nullptr){
219228
WiFi.begin(network, password);
@@ -223,7 +232,8 @@ class URLStreamDefault : public AbstractURLStream {
223232
}
224233
Serial.println();
225234
}
226-
delay(500);
235+
delay(500);
236+
#endif
227237
}
228238

229239
/// waits for some data - returns fals if the request has failed

0 commit comments

Comments
 (0)