Big Mouth Billy Bass player that takes raw wavefiles and decision list text files from an SD card

Dependencies:   SDFileSystem mbed BillyBass

Files at this revision

API Documentation at this revision

Comitter:
bikeNomad
Date:
Thu Jun 20 15:03:54 2013 +0000
Parent:
15:03105423bc3b
Commit message:
Made main loop repeat forever; eliminated time shifting

Changed in this revision

BillyBass.lib Show annotated file Show diff for this revision Revisions of this file
config.hpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/BillyBass.lib	Thu Jun 20 04:10:34 2013 +0000
+++ b/BillyBass.lib	Thu Jun 20 15:03:54 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/bikeNomad/code/BillyBass/#dba9221acf48
+http://mbed.org/users/bikeNomad/code/BillyBass/#ad0c038ebfc1
--- a/config.hpp	Thu Jun 20 04:10:34 2013 +0000
+++ b/config.hpp	Thu Jun 20 15:03:54 2013 +0000
@@ -27,6 +27,10 @@
 #define MAX_ACTIONS_PER_SONG MAX_ACTIONS_LINES_PER_SONG*2
 #define MAX_TEXT_FILE_LENGTH 2048
 
+// define this to 1 to make start times earlier and
+// enforce minimum on times
+#define FIX_TIMES 0
+
 // Sample configuration
 typedef int16_t Sample_t;   // 16-bit raw, LE samples
 const float SAMPLE_RATE_HZ = 8000.0;
@@ -42,8 +46,10 @@
 
 #define BODY_ON_DELAY 0.65
 #define BODY_OFF_DELAY 0.65
+
 #define TAIL_ON_DELAY 0.40
 #define TAIL_OFF_DELAY 0.40
+
 #define MOUTH_ON_DELAY 0.10
 #define MOUTH_OFF_DELAY 0.10
 #define MOUTH_MIN_ON_TIME 0.05
--- 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");
 }