![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
v
Dependencies: SDFileSystem VS1053 mbed
Fork of mp3final by
main.cpp@1:3cde58b32c23, 2016-12-05 (annotated)
- Committer:
- PloyLL
- Date:
- Mon Dec 05 21:02:07 2016 +0000
- Revision:
- 1:3cde58b32c23
- Parent:
- 0:f6ba8cc58bf6
v;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
PloyLL | 1:3cde58b32c23 | 1 | #include"mbed.h" |
PloyLL | 1:3cde58b32c23 | 2 | #include"player.h" |
PloyLL | 1:3cde58b32c23 | 3 | #include<time.h> |
PloyLL | 1:3cde58b32c23 | 4 | #include<stdlib.h> |
PloyLL | 1:3cde58b32c23 | 5 | |
cha45689 | 0:f6ba8cc58bf6 | 6 | Player player; |
cha45689 | 0:f6ba8cc58bf6 | 7 | Ticker t; |
cha45689 | 0:f6ba8cc58bf6 | 8 | Timer timer; |
PloyLL | 1:3cde58b32c23 | 9 | extern Serial pc; |
cha45689 | 0:f6ba8cc58bf6 | 10 | extern playerStatetype playerState; |
PloyLL | 1:3cde58b32c23 | 11 | |
PloyLL | 1:3cde58b32c23 | 12 | extern char listName[50][100]; //song name list |
PloyLL | 1:3cde58b32c23 | 13 | char listData[50][3]; //song data [0->like, 1->dislike, 2->skip] |
PloyLL | 1:3cde58b32c23 | 14 | char flag = 0; |
PloyLL | 1:3cde58b32c23 | 15 | |
PloyLL | 1:3cde58b32c23 | 16 | char playListName[][50] = { |
PloyLL | 1:3cde58b32c23 | 17 | "Sad/Gravity.mp3", "Sad/TaTerMaiRuseuk.mp3", "Sad/NumTaTeHai.mp3", "Sad/MaTanWeLaPord.mp3", "Sad/YaSaeJaiKonDrew.mp3", |
PloyLL | 1:3cde58b32c23 | 18 | "Stress/PerJer.mp3", "Stress/YenDTMaiRuJak.mp3", "Stress/Y_Rai.mp3", "Stress/LorLey.mp3", "Stress/NuaGenPaiRuePow.mp3", |
PloyLL | 1:3cde58b32c23 | 19 | "Angry/9_Nariga.mp3", "Angry/GluptuaGlupJai.mp3", "Angry/MaiTumMaDa.mp3", "Angry/LaugPee4G.mp3", "Angry/CeakWeeSert.mp3", |
PloyLL | 1:3cde58b32c23 | 20 | "Happy/PerJer.mp3", "Happy/Jeep.mp3", "Happy/PoodTumMai.mp3", "Happy/RumSeTow.mp3", "Happy/AO.mp3" |
PloyLL | 1:3cde58b32c23 | 21 | }; |
PloyLL | 1:3cde58b32c23 | 22 | |
PloyLL | 1:3cde58b32c23 | 23 | //interrupt |
PloyLL | 1:3cde58b32c23 | 24 | /* |
PloyLL | 1:3cde58b32c23 | 25 | void buttonFunction(){ |
PloyLL | 1:3cde58b32c23 | 26 | //input main function in keypad and change something that resonable. |
PloyLL | 1:3cde58b32c23 | 27 | } |
PloyLL | 1:3cde58b32c23 | 28 | |
PloyLL | 1:3cde58b32c23 | 29 | uint32_t interruptButton(uint32_t index) { // swap with cbAfterInput() function from keypad. |
PloyLL | 1:3cde58b32c23 | 30 | buttonIndex = index; |
PloyLL | 1:3cde58b32c23 | 31 | flag = 1; |
PloyLL | 1:3cde58b32c23 | 32 | if(buttonIndex == ...) playerState = PS_STOP; //skip music button |
PloyLL | 1:3cde58b32c23 | 33 | return 0; |
PloyLL | 1:3cde58b32c23 | 34 | } |
PloyLL | 1:3cde58b32c23 | 35 | |
PloyLL | 1:3cde58b32c23 | 36 | */ |
cha45689 | 0:f6ba8cc58bf6 | 37 | |
cha45689 | 0:f6ba8cc58bf6 | 38 | int main() { |
PloyLL | 1:3cde58b32c23 | 39 | //player.begin(); |
cha45689 | 0:f6ba8cc58bf6 | 40 | while(1) |
cha45689 | 0:f6ba8cc58bf6 | 41 | { |
PloyLL | 1:3cde58b32c23 | 42 | //ploy song |
PloyLL | 1:3cde58b32c23 | 43 | //player.playFile("testMusic.mp3"); |
PloyLL | 1:3cde58b32c23 | 44 | //player.playFile("testMusic2.mp3"); |
PloyLL | 1:3cde58b32c23 | 45 | //player.playFile("test/testMusic2.mp3"); |
PloyLL | 1:3cde58b32c23 | 46 | //player.playFile("test2/13 Too Young to Go Steady.mp3"); |
PloyLL | 1:3cde58b32c23 | 47 | |
PloyLL | 1:3cde58b32c23 | 48 | //big song |
PloyLL | 1:3cde58b32c23 | 49 | /* |
PloyLL | 1:3cde58b32c23 | 50 | player.playFile("Sad/Gravity.mp3"); |
PloyLL | 1:3cde58b32c23 | 51 | player.playFile("Sad/TaTerMaiRuseuk.mp3"); |
PloyLL | 1:3cde58b32c23 | 52 | player.playFile("Sad/NumTaTeHai.mp3"); |
PloyLL | 1:3cde58b32c23 | 53 | player.playFile("Sad/MaTanWeLaPord.mp3"); |
PloyLL | 1:3cde58b32c23 | 54 | player.playFile("Sad/YaSaeJaiKonDrew.mp3"); |
PloyLL | 1:3cde58b32c23 | 55 | player.playFile("Stress/PerJer.mp3"); |
PloyLL | 1:3cde58b32c23 | 56 | player.playFile("Stress/YenDTMaiRuJak.mp3"); |
PloyLL | 1:3cde58b32c23 | 57 | player.playFile("Stress/Y_Rai.mp3"); |
PloyLL | 1:3cde58b32c23 | 58 | player.playFile("Stress/LorLey.mp3"); |
PloyLL | 1:3cde58b32c23 | 59 | player.playFile("Stress/NuaGenPaiRuePow.mp3"); |
PloyLL | 1:3cde58b32c23 | 60 | player.playFile("Angry/9_Nariga.mp3"); |
PloyLL | 1:3cde58b32c23 | 61 | player.playFile("Angry/GluptuaGlupJai.mp3"); |
PloyLL | 1:3cde58b32c23 | 62 | player.playFile("Angry/MaiTumMaDa.mp3"); |
PloyLL | 1:3cde58b32c23 | 63 | player.playFile("Angry/LaugPee4G.mp3"); |
PloyLL | 1:3cde58b32c23 | 64 | player.playFile("Angry/CeakWeeSert.mp3"); |
PloyLL | 1:3cde58b32c23 | 65 | player.playFile("Happy/PerJer.mp3"); |
PloyLL | 1:3cde58b32c23 | 66 | player.playFile("Happy/Jeep.mp3"); |
PloyLL | 1:3cde58b32c23 | 67 | player.playFile("Happy/PoodTumMai.mp3"); |
PloyLL | 1:3cde58b32c23 | 68 | player.playFile("Happy/RumSeTow.mp3"); |
PloyLL | 1:3cde58b32c23 | 69 | player.playFile("Happy/AO.mp3"); |
PloyLL | 1:3cde58b32c23 | 70 | */ |
PloyLL | 1:3cde58b32c23 | 71 | // player.playFile("test/NumTaTeHai.mp3"); |
PloyLL | 1:3cde58b32c23 | 72 | //player.playFile("Sad/Gravity.mp3"); |
PloyLL | 1:3cde58b32c23 | 73 | //player.playFile("Sad/TaTerMaiRuseuk.mp3"); |
PloyLL | 1:3cde58b32c23 | 74 | player.playFile("Sad/NumTaTeHai.mp3"); |
PloyLL | 1:3cde58b32c23 | 75 | player.playFile("Sad/MaTanWeLaPord.mp3"); |
PloyLL | 1:3cde58b32c23 | 76 | player.playFile("Sad/YaSaeJaiKonDrew.mp3"); |
PloyLL | 1:3cde58b32c23 | 77 | player.playFile("Stress/PerJer.mp3"); |
PloyLL | 1:3cde58b32c23 | 78 | player.playFile("Stress/YenDTMaiRuJak.mp3"); |
PloyLL | 1:3cde58b32c23 | 79 | player.playFile("Stress/Y_Rai.mp3"); |
PloyLL | 1:3cde58b32c23 | 80 | player.playFile("Stress/LorLey.mp3"); |
PloyLL | 1:3cde58b32c23 | 81 | player.playFile("Stress/NuaGenPaiRuePow.mp3"); |
PloyLL | 1:3cde58b32c23 | 82 | player.playFile("Angry/9_Nariga.mp3"); |
PloyLL | 1:3cde58b32c23 | 83 | player.playFile("Angry/GluptuaGlupJai.mp3"); |
PloyLL | 1:3cde58b32c23 | 84 | player.playFile("Angry/MaiTumMaDa.mp3"); |
PloyLL | 1:3cde58b32c23 | 85 | player.playFile("Angry/LaugPee4G.mp3"); |
PloyLL | 1:3cde58b32c23 | 86 | player.playFile("Angry/CeakWeeSert.mp3"); |
PloyLL | 1:3cde58b32c23 | 87 | player.playFile("Happy/PerJer.mp3"); |
PloyLL | 1:3cde58b32c23 | 88 | player.playFile("Happy/Jeep.mp3"); |
PloyLL | 1:3cde58b32c23 | 89 | player.playFile("Happy/PoodTumMai.mp3"); |
PloyLL | 1:3cde58b32c23 | 90 | player.playFile("Happy/RumSeTow.mp3"); |
PloyLL | 1:3cde58b32c23 | 91 | player.playFile("Happy/AO.mp3"); |
PloyLL | 1:3cde58b32c23 | 92 | |
PloyLL | 1:3cde58b32c23 | 93 | |
PloyLL | 1:3cde58b32c23 | 94 | /* |
PloyLL | 1:3cde58b32c23 | 95 | if(flag){ |
PloyLL | 1:3cde58b32c23 | 96 | buttonFunction(buttonIndex); |
PloyLL | 1:3cde58b32c23 | 97 | flag = 0; |
PloyLL | 1:3cde58b32c23 | 98 | } |
PloyLL | 1:3cde58b32c23 | 99 | */ |
cha45689 | 0:f6ba8cc58bf6 | 100 | } |
cha45689 | 0:f6ba8cc58bf6 | 101 | } |