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:
- 16:82a1bdc3320f
- Parent:
- 14:79b3fd23c7b5
--- a/main.cpp Thu Jun 20 04:10:34 2013 +0000
+++ b/main.cpp Thu Jun 20 15:03:54 2013 +0000
@@ -68,26 +68,28 @@
fprintf(stderr, "*** REBOOT ***\r\n");
- // read the directory
- DIR *bassDir = 0;
- while (!bassDir) {
- if ((bassDir = opendir(BASS_DIRECTORY)) != 0)
- break;
- pc.printf("Error opening " BASS_DIRECTORY "\r\n");
- wait(1.0);
- }
+ for (;;) {
+ // read the directory
+ DIR *bassDir = 0;
+ while (!bassDir) {
+ if ((bassDir = opendir(BASS_DIRECTORY)) != 0)
+ break;
+ pc.printf("Error opening " BASS_DIRECTORY "\r\n");
+ wait(1.0);
+ }
- while (dirent *d = readdir(bassDir)) {
- Song *song = Song::newSong(d->d_name);
- if (song) {
- fprintf(stderr, "Waiting to play %s\r\n", song->getSampleFileName());
- while (!(!button1 || !button2))
- wait(0.1);
- player.playEntireSong(song);
- fprintf(stderr, "total length: %f done: %u\r\n", player.timeInSong, player.actionsDone);
+ while (dirent *d = readdir(bassDir)) {
+ Song *song = Song::newSong(d->d_name);
+ if (song) {
+ fprintf(stderr, "Waiting to play %s\r\n", song->getSampleFileName());
+ while (!(!button1 || !button2))
+ wait(0.1);
+ player.playEntireSong(song);
+ fprintf(stderr, "total length: %f done: %u\r\n", player.timeInSong, player.actionsDone);
+ }
}
+ closedir(bassDir);
+ fprintf(stderr, "Done.\r\n");
}
- closedir(bassDir);
- fprintf(stderr, "Done.\r\n");
}
Ned Konz