Big Mouth Billy Bass player that takes raw wavefiles and decision list text files from an SD card
Dependencies: SDFileSystem mbed BillyBass
Diff: main.cpp
- Revision:
- 9:99213347474f
- Parent:
- 8:1dd2bb31dec6
- Child:
- 11:bc25840eca44
--- a/main.cpp Tue Jun 18 00:07:56 2013 +0000 +++ b/main.cpp Tue Jun 18 06:13:02 2013 +0000 @@ -64,27 +64,6 @@ pc.baud(SERIAL_BAUD); fprintf(stderr, "*** REBOOT ***\r\n"); - fprintf(stderr, "sizeof Action=%u, Song=%u\r\n", sizeof(Action), sizeof(Song)); - dumpHeap(); - Song *song = Song::newSong("6_1_sciencefish.raw"); - delete song; - dumpHeap(); - song = Song::newSong("2_1_i_hardly_slept.raw"); - dumpHeap(); - delete song; - dumpHeap(); - song = Song::newSong("1_1_a_sound.raw"); - dumpHeap(); - delete song; - song = Song::newSong("4_1_GoodEvening.raw"); - dumpHeap(); - delete song; - song = Song::newSong("5_1_listen_kid_THISONE.raw"); - dumpHeap(); - delete song; - Song::newSong("3_1_BoatingThemeSong.raw"); - dumpHeap(); - delete song; // read the directory DIR *bassDir = 0; @@ -95,6 +74,17 @@ wait(1.0); } + while (dirent *d = readdir(bassDir)) { + Song *song = Song::newSong(d->d_name); + if (song) { + pc.printf("Playing %s\r\n", song->getSampleFileName()); + player.playEntireSong(song); + pc.printf("total length: %f done: %u\r\n", player.timeInSong, player.actionsDone); + delete song; + } + } + closedir(bassDir); + pc.printf("Done.\r\n"); }