Skip to content

Commit 5887076

Browse files
committed
VS1053 cleanup
1 parent ee87fbe commit 5887076

File tree

2 files changed

+2
-123
lines changed

2 files changed

+2
-123
lines changed

examples/examples-vs1053/player-sd-vs1053/player-sd-vs1053.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
const char *startFilePath="/";
1919
const char* ext="mp3";
20-
SdSpiConfig sdcfg(SD_CARD_CS, SHARED_SPI, SD_SCK_MHZ(5) , &SPI);
20+
SdSpiConfig sdcfg(SD_CARD_CS, SHARED_SPI, SD_SCK_MHZ(2) , &SPI);
2121
AudioSourceSdFat source(startFilePath, ext, sdcfg);
2222
VS1053Stream vs1053; // final output
2323
AudioPlayer player(source, vs1053, *new CopyDecoder());

src/AudioLibs/VS1053Stream.h

Lines changed: 1 addition & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -10,127 +10,6 @@
1010

1111
namespace audio_tools {
1212

13-
// /**
14-
// * @brief VS1053 Output Interface Class based on https://github.com/baldram/ESP_VS1053_Library
15-
// * The write is expecting encoded data.
16-
// * @copyright GPLv3
17-
// */
18-
// class VS1053BaseStream : public AudioStreamX {
19-
// public:
20-
// VS1053BaseStream(uint8_t _cs_pin, uint8_t _dcs_pin, uint8_t _dreq_pin,int16_t _reset_pin=-1, bool startSPI=true){
21-
// LOGD(LOG_METHOD);
22-
// this->_cs_pin = _cs_pin;
23-
// this->_dcs_pin = _dcs_pin;
24-
// this->_dreq_pin = _dreq_pin;
25-
// this->_reset_pin = _reset_pin;
26-
// this->_start_SPI = startSPI;
27-
// }
28-
29-
// bool begin(bool mp3Mode=true) {
30-
// LOGD(LOG_METHOD);
31-
// p_vs1053 = new VS1053(_cs_pin,_dcs_pin,_dreq_pin);
32-
33-
// // initialize SPI
34-
// if (_start_SPI) {
35-
// LOGI("SPI.begin()")
36-
// SPI.begin();
37-
// } else {
38-
// LOGI("SPI not started");
39-
// }
40-
41-
// if (_reset_pin!=-1){
42-
// LOGI("Setting reset pin to high: %d", _reset_pin);
43-
// pinMode(_reset_pin, OUTPUT);
44-
// digitalWrite(_reset_pin, HIGH);
45-
// delay(200);
46-
// }
47-
48-
// p_vs1053->begin();
49-
50-
// if (mp3Mode){
51-
// p_vs1053->startSong();
52-
// p_vs1053->switchToMp3Mode(); // optional, some boards require this
53-
// if (p_vs1053->getChipVersion() == 4) { // Only perform an update if we really are using a VS1053, not. eg. VS1003
54-
// p_vs1053->loadDefaultVs1053Patches();
55-
// }
56-
57-
// delay(100);
58-
// setVolume(VS1053_DEFAULT_VOLUME);
59-
// }
60-
61-
// return true;
62-
// }
63-
64-
// void end(){
65-
// if (p_vs1053!=nullptr){
66-
// LOGD(LOG_METHOD);
67-
// p_vs1053->stopSong();
68-
// delete p_vs1053;
69-
// p_vs1053 = nullptr;
70-
// }
71-
// }
72-
73-
// /// value from 0 to 1.0
74-
// void setVolume(float vol){
75-
// // make sure that value is between 0 and 1
76-
// float volume = vol;
77-
// if (volume>1.0) volume = 1.0;
78-
// if (volume<0.0) volume = 0.0;
79-
// LOGD("setVolume: %f", volume);
80-
// if (p_vs1053!=nullptr){
81-
// // Set the player volume.Level from 0-100, higher is louder
82-
// p_vs1053->setVolume(volume*100.0);
83-
// }
84-
// }
85-
86-
// /// provides the volume
87-
// float volume() {
88-
// LOGD(LOG_METHOD);
89-
// if (p_vs1053==nullptr) return -1.0;
90-
// return p_vs1053->getVolume()/100.0;;
91-
// }
92-
93-
// /// Adjusting the left and right volume balance, higher to enhance the right side, lower to enhance the left side.
94-
// void setBalance(float bal){
95-
// float balance = bal;
96-
// if (balance<-1.0) balance = -1;
97-
// if (balance>1.0) balance = 1;
98-
// LOGD("setBalance: %f", balance);
99-
// if (p_vs1053!=nullptr){
100-
// p_vs1053->setBalance(balance*100.0);
101-
// }
102-
// }
103-
// /// Get the currenet balance setting (-1.0..1.0)
104-
// float balance(){
105-
// LOGD(LOG_METHOD);
106-
// if (p_vs1053==nullptr) return -1.0;
107-
// return static_cast<float>(p_vs1053->getBalance())/100.0;
108-
// }
109-
110-
111-
// /// Write encoded (mp3, aac, wav etc) data
112-
// virtual size_t write(const uint8_t *buffer, size_t size) override{
113-
// if (p_vs1053==nullptr) return 0;
114-
// p_vs1053->playChunk((uint8_t*)buffer, size);
115-
// return size;
116-
// }
117-
118-
// VS1053 &getVS1053() {
119-
// LOGD(LOG_METHOD);
120-
// if (p_vs1053==nullptr) {
121-
// begin(false);
122-
// };
123-
// return *p_vs1053;
124-
// }
125-
126-
127-
// protected:
128-
// VS1053 *p_vs1053 = nullptr;
129-
// uint8_t _cs_pin, _dcs_pin, _dreq_pin;
130-
// int16_t _reset_pin=-1;
131-
// bool _start_SPI;
132-
// };
133-
13413
enum VS1053Mode {ENCODED_MODE, PCM_MODE, MIDI_MODE };
13514

13615
/**
@@ -246,7 +125,7 @@ class VS1053Stream : public AudioStreamX {
246125
LOGI("Setting reset pin to high: %d", cfg.reset_pin);
247126
pinMode(cfg.reset_pin, OUTPUT);
248127
digitalWrite(cfg.reset_pin, HIGH);
249-
delay(200);
128+
delay(800);
250129
}
251130
}
252131

0 commit comments

Comments
 (0)