Skip to content

Commit 52a7244

Browse files
committed
VS1053 compile errors
1 parent de41719 commit 52a7244

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/AudioConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ typedef uint32_t eps32_i2s_sample_rate_type;
439439

440440
// use 0 for https://github.com/baldram/ESP_VS1053_Library
441441
// use 1 for https://github.com/pschatzmann/arduino-vs1053
442-
#define VS1053_EXT 0
442+
#define VS1053_EXT 1
443443
#define VS1053_DEFAULT_VOLUME 0.5
444444

445445

src/AudioLibs/VS1053Stream.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class VS1053BaseStream : public AudioStreamX {
3131
LOGI("Setting reset pin to high: %d", _reset_pin);
3232
pinMode(_reset_pin, OUTPUT);
3333
digitalWrite(_reset_pin, HIGH);
34+
delay(200);
3435
}
3536
p_vs1053 = new VS1053(_cs_pin,_dcs_pin,_dreq_pin);
3637
// initialize SPI
@@ -56,11 +57,11 @@ class VS1053BaseStream : public AudioStreamX {
5657

5758
/// value from 0 to 1.0
5859
void setVolume(float vol){
59-
LOGD("setVolume: %f", vol);
6060
// make sure that value is between 0 and 1
6161
float volume = vol;
6262
if (volume>1.0) volume = 1.0;
6363
if (volume<0.0) volume = 0.0;
64+
LOGD("setVolume: %f", volume);
6465
if (p_vs1053!=nullptr){
6566
// Set the player volume.Level from 0-100, higher is louder
6667
p_vs1053->setVolume(volume*100.0);
@@ -76,10 +77,10 @@ class VS1053BaseStream : public AudioStreamX {
7677

7778
/// Adjusting the left and right volume balance, higher to enhance the right side, lower to enhance the left side.
7879
void setBalance(float bal){
79-
LOGD("setBalance: %f", vol);
8080
float balance = bal;
8181
if (balance<-1.0) balance = -1;
8282
if (balance>1.0) balance = 1;
83+
LOGD("setBalance: %f", balance);
8384
if (p_vs1053!=nullptr){
8485
p_vs1053->setBalance(balance*100.0);
8586
}
@@ -115,10 +116,10 @@ class VS1053BaseStream : public AudioStreamX {
115116

116117
/// Sets the treble amplitude value (range 0 to 1.0)
117118
void setTreble(float val){
118-
LOGD("setTreble: %f", vol);
119119
float value = val;
120120
if (value<0.0) value = 0.0;
121121
if (value>1.0) value = 1.0;
122+
LOGD("setTreble: %f", value);
122123
if (p_vs1053!=nullptr){
123124
p_vs1053->setTreble(value*100);
124125
}
@@ -132,23 +133,26 @@ class VS1053BaseStream : public AudioStreamX {
132133
}
133134

134135
/// Sets the bass amplitude value (range 0 to 1.0)
135-
void setBass(float value){
136-
LOGD("setBass: %f", vol);
136+
void setBass(float val){
137+
float value = val;
138+
if (value<0.0) value = 0.0;
139+
if (value>1.0) value = 1.0;
140+
LOGD("setBass: %f", value);
137141
if (p_vs1053!=nullptr){
138142
p_vs1053->setBass(value*100.0);
139143
}
140144
}
141145

142146
/// Sets the treble frequency limit in hz (range 0 to 15000)
143147
void setTrebleFrequencyLimit(uint16_t value){
144-
LOGD("setTrebleFrequencyLimit: %u", vol);
148+
LOGD("setTrebleFrequencyLimit: %u", value);
145149
if (p_vs1053!=nullptr){
146150
p_vs1053->setTrebleFrequencyLimit(value);
147151
}
148152
}
149153
/// Sets the bass frequency limit in hz (range 0 to 15000)
150154
void setBassFrequencyLimit(uint16_t value){
151-
LOGD("setBassFrequencyLimit: %u", vol);
155+
LOGD("setBassFrequencyLimit: %u", value);
152156
if (p_vs1053!=nullptr){
153157
p_vs1053->setBassFrequencyLimit(value);
154158
}
@@ -246,12 +250,14 @@ class VS1053Stream : public AudioStreamX {
246250
case TX_MODE:
247251
p_out->begin(cfg);
248252
p_driver->begin();
253+
delay(100);
249254
setVolume(VS1053_DEFAULT_VOLUME);
250255
result = true;
251256
break;
252257
#if VS1053_EXT
253258
case MIDI_MODE:
254259
getVS1053().beginMIDI();
260+
delay(100);
255261
setVolume(VS1053_DEFAULT_VOLUME);
256262
result = true;
257263
break;
@@ -262,7 +268,7 @@ class VS1053Stream : public AudioStreamX {
262268
break;
263269
#endif
264270
default:
265-
LOGE("Mode not supported");
271+
LOGD("Mode not supported");
266272
result = false;
267273
break;
268274
}

0 commit comments

Comments
 (0)