Skip to content

Commit 0c46678

Browse files
committed
Compile issues for non ESP32 processors
1 parent 23ee309 commit 0c46678

File tree

13 files changed

+64
-19
lines changed

13 files changed

+64
-19
lines changed

examples/examples-maximilian/11-Mixing/11-Mixing.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Maximilian maximilian(out);
77

88
// Maximilian
99
maxiOsc myOsc,myAutoPanner;//
10-
vector<double> myStereoOutput(2,0);
10+
vector<float> myStereoOutput(2,0);
1111
maxiMix myOutputs;//this is the stereo mixer channel.
1212

1313
void setup() {//some inits

src/AudioConfig.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@
146146
#define USE_I2S
147147
#define USE_AUDIO_SERVER
148148
#define USE_URLSTREAM_TASK
149+
#define USE_TYPETRAITS
150+
#define USE_EFFECTS_SUITE
149151

150152
#define PWM_FREQENCY 30000
151153
#define PIN_PWM_START 12
@@ -190,10 +192,12 @@ typedef uint32_t eps32_i2s_sample_rate_type;
190192

191193
//----------------
192194
#ifdef ESP8266
193-
#define USE_URL_ARDUINO
195+
//#define USE_URL_ARDUINO // commented out because of compile errors
194196
#define USE_I2S
195197
#define USE_PWM
196198
#define USE_AUDIO_SERVER
199+
#define USE_TYPETRAITS
200+
#define USE_EFFECTS_SUITE
197201
//#define USE_ESP8266_AUDIO
198202

199203
#define PIN_PWM_START 12
@@ -211,6 +215,8 @@ typedef uint32_t eps32_i2s_sample_rate_type;
211215
#ifdef ARDUINO_ARDUINO_NANO33BLE
212216
#define USE_I2S
213217
#define USE_PWM
218+
#define USE_TYPETRAITS
219+
#define USE_EFFECTS_SUITE
214220

215221
#define PIN_PWM_START 6
216222
#define PIN_I2S_BCK 2
@@ -227,6 +233,8 @@ typedef uint32_t eps32_i2s_sample_rate_type;
227233
//#define USE_I2S 1
228234
#define USE_PWM
229235
#define USE_ADC_ARDUINO
236+
#define USE_TYPETRAITS
237+
#define USE_EFFECTS_SUITE
230238

231239
#define PIN_ADC_START 26
232240
#define PIN_PWM_START 6
@@ -256,6 +264,8 @@ typedef uint32_t eps32_i2s_sample_rate_type;
256264
#define USE_I2S 1
257265
#define USE_PWM
258266
#define USE_ADC_ARDUINO
267+
#define USE_TYPETRAITS
268+
#define USE_EFFECTS_SUITE
259269

260270
#define PIN_ADC_START 26
261271
#define PIN_PWM_START 6
@@ -315,5 +325,9 @@ typedef uint32_t eps32_i2s_sample_rate_type;
315325

316326
#ifdef IS_DESKTOP
317327
#define USE_URL_ARDUINO
328+
#define FLUSH_OVERRIDE override
318329
#endif
319330

331+
#ifndef OVERRIDE
332+
#define FLUSH_OVERRIDE
333+
#endif

src/AudioEffects/AudioEffects.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
#include "AudioBasic/Vector.h"
44
#include "AudioEffects/SoundGenerator.h"
55
#include "AudioEffects/AudioEffect.h"
6+
#ifdef USE_EFFECTS_SUITE
67
#include "AudioEffects/AudioEffectsSuite.h"
8+
#endif
79
#ifdef USE_STK
810
#include "AudioEffects/STKEffects.h"
911
#endif

src/AudioI2S/I2SESP8266.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,36 @@ class I2SBase {
2424
}
2525

2626
/// starts the DAC with the default config
27-
void begin(RxTxMode mode = TX_MODE) {
28-
begin(defaultConfig(mode));
27+
bool begin(RxTxMode mode = TX_MODE) {
28+
return begin(defaultConfig(mode));
2929
}
3030

3131
/// starts the DAC
32-
void begin(I2SConfig cfg) {
32+
bool begin(I2SConfig cfg) {
3333
i2s_set_rate(cfg.sample_rate);
3434
cfg.bits_per_sample = 16;
3535
if(!i2s_rxtx_begin(cfg.rx_tx_mode == RX_MODE, cfg.rx_tx_mode == TX_MODE)){
3636
LOGE("i2s_rxtx_begin failed");
37+
return false;
3738
}
39+
return true;
3840
}
3941

4042
/// stops the I2C and unistalls the driver
4143
void end(){
4244
i2s_end();
4345
}
4446

47+
/// we assume the data is already available in the buffer
48+
int available() {
49+
return I2S_BUFFER_COUNT*I2S_BUFFER_SIZE;
50+
}
51+
52+
/// We limit the write size to the buffer size
53+
int availableForWrite() {
54+
return I2S_BUFFER_COUNT*I2S_BUFFER_SIZE;
55+
}
56+
4557
/// provides the actual configuration
4658
I2SConfig config() {
4759
return cfg;

src/AudioMetaData/MetaDataICY.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class MetaDataICY : public AbstractMetaData {
181181
LOGD(LOG_METHOD);
182182
if (meta_size>0){
183183
if (metaData==nullptr){
184-
metaData = new prog_char[meta_size+1];
184+
metaData = new char[meta_size+1];
185185
metaDataMaxLen = meta_size;
186186
LOGD("metaDataMaxLen: %d", metaDataMaxLen);
187187
} else {

src/AudioPWM/PWMAudioBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct PWMConfig : public AudioBaseInfo {
6969
LOGI("channels: %d", channels);
7070
LOGI("bits_per_sample: %d", bits_per_sample);
7171
LOGI("buffer_size: %u", buffer_size);
72-
LOGI("pwm_frequency: %lu", pwm_frequency);
72+
LOGI("pwm_frequency: %u", (unsigned int)pwm_frequency);
7373
LOGI("resolution: %d", resolution);
7474
//LOGI("timer_id: %d", timer_id);
7575
}

src/AudioTimer/AudioTimerDef.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class AudioUtils {
4444
result++;
4545
}
4646
if (result <= limit){
47-
LOGW("Time for samplingRate %u -> %lu is < %u μs - we rounded up", (unsigned int)samplingRate, result, limit);
47+
LOGW("Time for samplingRate %u -> %u is < %u μs - we rounded up", (unsigned int)samplingRate, (unsigned int)result, (unsigned int)limit);
4848
result = limit;
4949
}
5050
return result;
@@ -56,7 +56,7 @@ class AudioUtils {
5656
result++;
5757
}
5858
if (result <= limit){
59-
LOGW("Time for samplingRate %u -> %lu is < %u μs - we rounded up", (unsigned int)samplingRate, result, limit);
59+
LOGW("Time for samplingRate %u -> %u is < %u μs - we rounded up", (unsigned int)samplingRate, (unsigned int)result, (unsigned int)limit);
6060
result = limit;
6161
}
6262
return result;

src/AudioTimer/AudioTimerESP8266.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ TimerAlarmRepeatingESP8266 *self;
2020
*/
2121
class TimerAlarmRepeatingESP8266 : public TimerAlarmRepeatingDef {
2222
public:
23-
23+
2424
TimerAlarmRepeatingESP8266(){
2525
self = this;
2626
}
2727

28+
TimerAlarmRepeatingESP8266(TimerFunction function=DirectTimerCallback, int id=0){
29+
self = this;
30+
}
31+
2832
~TimerAlarmRepeatingESP8266(){
2933
end();
3034
}

src/AudioTimer/AudioTimerSTM32.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ typedef void (* repeating_timer_callback_t )(void* obj);
1818
*/
1919
class TimerAlarmRepeatingSTM32 : public TimerAlarmRepeatingDef {
2020
public:
21-
22-
TimerAlarmRepeatingSTM32(int timerIdx=1){
21+
22+
TimerAlarmRepeatingSTM32(TimerFunction function=DirectTimerCallback, int timerIdx=1){
2323
this->timer = new HardwareTimer(timers[timerIdx]);
2424
timer->pause();
2525
}

src/AudioTools/AudioOutput.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class AudioPrint : public Print {
2828
return 1;
2929
}
3030

31-
void flush() {
31+
void flush() FLUSH_OVERRIDE {
3232
write((const uint8_t*)tmp, tmpPos-1);
3333
tmpPos=0;
3434
}

0 commit comments

Comments
 (0)