mp3
Fork of VS1053 by
Revision 2:a59255e80c0d, committed 2017-12-09
- Comitter:
- csggreen
- Date:
- Sat Dec 09 15:07:27 2017 +0000
- Parent:
- 1:17913cff05a2
- Commit message:
- green_mp3;
Changed in this revision
player.cpp | Show annotated file Show diff for this revision Revisions of this file |
player.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/player.cpp Sat Dec 09 14:21:59 2017 +0000 +++ b/player.cpp Sat Dec 09 15:07:27 2017 +0000 @@ -8,10 +8,10 @@ ctrlStatetype ctrlState; static unsigned char fileBuf[32768]; unsigned char *bufptr; +char green; -char list[20][14]; //song list -char index; //song play index -char index_MAX; //how many song in all +char list[20][50]; //song list + char data ; DigitalIn sw_in(USER_BUTTON); @@ -36,28 +36,22 @@ j=0; while(*byte){ list[i][j++] = *byte++; + green=i; } pc.printf("%2d . %s\r\n", i,list[i++]); //fp->close(); } } } - index_MAX = i-1; dir->closedir(); - printf("\r\n"); } void Player::stop(void){ playerState =PS_STOP; } -void Player::playfile(char n){ - playerState =PS_STOP; - index = n; - } + -void Player::getsong(void){ - playfile(2); - } + /* This function plays back an audio file. */ void Player::playFile(char *file) { @@ -68,7 +62,7 @@ vs1053.setFreq(24000000); //hight speed - FileHandle *fp =sd.open(file, index); + FileHandle *fp =sd.open(file, O_RDONLY); if(fp == NULL) { printf("Could not open %s\r\n",file); @@ -94,6 +88,7 @@ } uint8_t vol = 0x00;//set vlume vs1053.setVolume(vol); //set vlume + if(playerState != PS_PLAY) //stop { fp->close();
--- a/player.h Sat Dec 09 14:21:59 2017 +0000 +++ b/player.h Sat Dec 09 15:07:27 2017 +0000 @@ -25,9 +25,6 @@ public: void begin(void); void playFile(char *file); - void playfile(char n); - void getsong(void); - void readswitch(void); void stop(void); private: