ID of album to play now comes from a file ids.txt within the folder. This is as of yet untested.

This commit is contained in:
2019-11-12 19:29:55 +01:00
parent 46fb4c7615
commit 6d00474315
3 changed files with 81 additions and 13 deletions

View File

@ -31,6 +31,11 @@
#define SM_ADPCM 0x1000
#define SS_DO_NOT_JUMP 0x8000
struct ID_to_Folder_Map {
const char* id;
const char* folder;
};
class Player {
private:
enum state { uninitialized, idle, playing, stopping,
@ -70,6 +75,8 @@ private:
void _patch_adpcm();
void _speaker_off();
void _speaker_on();
void _fill_id_to_folder_map();
String _foldername_for_id(String id);
SPISettings _spi_settings_slow = SPISettings(250000, MSBFIRST, SPI_MODE0);
SPISettings _spi_settings_fast = SPISettings(4000000, MSBFIRST, SPI_MODE0);
@ -89,6 +96,7 @@ private:
uint32_t _skip_to;
SPIMaster* _spi;
unsigned long _stopped_at;
std::list<ID_to_Folder_Map> _id_to_folder_map;
public:
Player(SPIMaster* s);
void vol_up();
@ -97,6 +105,7 @@ public:
void track_prev();
bool is_playing();
bool play_id(String id);
bool play_album(String album);
void play_random_album();
bool play_song(String album, uint8_t song_index, uint32_t offset=0);