@@ -31,6 +31,7 @@ class VS1053BaseStream : public AudioStreamX {
31
31
LOGI (" Setting reset pin to high: %d" , _reset_pin);
32
32
pinMode (_reset_pin, OUTPUT);
33
33
digitalWrite (_reset_pin, HIGH);
34
+ delay (200 );
34
35
}
35
36
p_vs1053 = new VS1053 (_cs_pin,_dcs_pin,_dreq_pin);
36
37
// initialize SPI
@@ -56,11 +57,11 @@ class VS1053BaseStream : public AudioStreamX {
56
57
57
58
// / value from 0 to 1.0
58
59
void setVolume (float vol){
59
- LOGD (" setVolume: %f" , vol);
60
60
// make sure that value is between 0 and 1
61
61
float volume = vol;
62
62
if (volume>1.0 ) volume = 1.0 ;
63
63
if (volume<0.0 ) volume = 0.0 ;
64
+ LOGD (" setVolume: %f" , volume);
64
65
if (p_vs1053!=nullptr ){
65
66
// Set the player volume.Level from 0-100, higher is louder
66
67
p_vs1053->setVolume (volume*100.0 );
@@ -76,10 +77,10 @@ class VS1053BaseStream : public AudioStreamX {
76
77
77
78
// / Adjusting the left and right volume balance, higher to enhance the right side, lower to enhance the left side.
78
79
void setBalance (float bal){
79
- LOGD (" setBalance: %f" , vol);
80
80
float balance = bal;
81
81
if (balance<-1.0 ) balance = -1 ;
82
82
if (balance>1.0 ) balance = 1 ;
83
+ LOGD (" setBalance: %f" , balance);
83
84
if (p_vs1053!=nullptr ){
84
85
p_vs1053->setBalance (balance*100.0 );
85
86
}
@@ -115,10 +116,10 @@ class VS1053BaseStream : public AudioStreamX {
115
116
116
117
// / Sets the treble amplitude value (range 0 to 1.0)
117
118
void setTreble (float val){
118
- LOGD (" setTreble: %f" , vol);
119
119
float value = val;
120
120
if (value<0.0 ) value = 0.0 ;
121
121
if (value>1.0 ) value = 1.0 ;
122
+ LOGD (" setTreble: %f" , value);
122
123
if (p_vs1053!=nullptr ){
123
124
p_vs1053->setTreble (value*100 );
124
125
}
@@ -132,23 +133,26 @@ class VS1053BaseStream : public AudioStreamX {
132
133
}
133
134
134
135
// / 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);
137
141
if (p_vs1053!=nullptr ){
138
142
p_vs1053->setBass (value*100.0 );
139
143
}
140
144
}
141
145
142
146
// / Sets the treble frequency limit in hz (range 0 to 15000)
143
147
void setTrebleFrequencyLimit (uint16_t value){
144
- LOGD (" setTrebleFrequencyLimit: %u" , vol );
148
+ LOGD (" setTrebleFrequencyLimit: %u" , value );
145
149
if (p_vs1053!=nullptr ){
146
150
p_vs1053->setTrebleFrequencyLimit (value);
147
151
}
148
152
}
149
153
// / Sets the bass frequency limit in hz (range 0 to 15000)
150
154
void setBassFrequencyLimit (uint16_t value){
151
- LOGD (" setBassFrequencyLimit: %u" , vol );
155
+ LOGD (" setBassFrequencyLimit: %u" , value );
152
156
if (p_vs1053!=nullptr ){
153
157
p_vs1053->setBassFrequencyLimit (value);
154
158
}
@@ -246,12 +250,14 @@ class VS1053Stream : public AudioStreamX {
246
250
case TX_MODE:
247
251
p_out->begin (cfg);
248
252
p_driver->begin ();
253
+ delay (100 );
249
254
setVolume (VS1053_DEFAULT_VOLUME);
250
255
result = true ;
251
256
break ;
252
257
#if VS1053_EXT
253
258
case MIDI_MODE:
254
259
getVS1053 ().beginMIDI ();
260
+ delay (100 );
255
261
setVolume (VS1053_DEFAULT_VOLUME);
256
262
result = true ;
257
263
break ;
@@ -262,7 +268,7 @@ class VS1053Stream : public AudioStreamX {
262
268
break ;
263
269
#endif
264
270
default :
265
- LOGE (" Mode not supported" );
271
+ LOGD (" Mode not supported" );
266
272
result = false ;
267
273
break ;
268
274
}
0 commit comments