Advertisement
Guest User

Untitled

a guest
May 26th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. void makeList(){
  2. if(sd.exists("TEMP_NFO.DAT")){
  3. sd.remove("TEMP_NFO.DAT");
  4. }
  5.  
  6. f.open("TEMP_NFO.DAT", O_CREAT);
  7. f.close();
  8. char lfn[256];
  9. char sfn[13];
  10. char title[30];
  11. char artist[30];
  12. char album[30];
  13. bool haveLfn;
  14. int duration(0);
  15. uint32_t pos(0);
  16. uint16_t fileIndex;
  17. while(f.openNext(sd.vwd(), O_READ)){
  18. checkForClient(5);
  19. String TSTR("LOADING");
  20. for(int d(0); d < dots; ++d){
  21. TSTR += ".";
  22. }
  23. scroll.fix(true);
  24. scroll.setText(TSTR.c_str(), true);
  25. scroll.setPos(55);
  26. scroll.tick();
  27. ++dots;
  28. if(dots > 3){dots = 0;};
  29. f.getName(lfn, 256);
  30. Serial.println(lfn);
  31. f.getSFN(sfn);
  32. Serial.println(sfn);
  33. uint32_t trackSize(f.fileSize());
  34. fileIndex = f.dirIndex();
  35. f.close();
  36. if(strstr(lfn, ".mp3")){
  37. ++musicNbr;
  38. Serial.println(trackSize);
  39. MP3player.playMP3(sfn);
  40. MP3player.trackArtist(artist);
  41. MP3player.trackTitle(title);
  42. MP3player.trackAlbum(album);
  43. Serial.println(MP3player.getBitrate()*8);
  44. if(MP3player.getBitrate() != 0){
  45. duration = (trackSize/1000)/(MP3player.getBitrate());
  46. }
  47. MP3player.stopTrack();
  48. tempFile.open("TEMP_NFO.DAT", O_CREAT | O_WRITE);
  49. tempFile.seekSet(pos);
  50. writeInfos(lfn, 256);
  51. writeInfos(title, 30);
  52. writeInfos(artist, 30);
  53. writeInfos(album, 30);
  54. tempFile.write(&duration, 2);
  55. tempFile.write('\n');
  56. pos = tempFile.curPosition();
  57. }
  58. tempFile.close();
  59. f.open(sd.vwd(), fileIndex, O_READ);
  60. f.close();
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement