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

Dependencies:   SDFileSystem mbed BillyBass

Revision:
7:ce27f959813b
Parent:
6:e90a12ca056f
Child:
8:1dd2bb31dec6
--- a/song.hpp	Sat Jun 15 04:08:25 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-#ifndef __included_song_hpp
-#define __included_song_hpp
-
-#include "billybass.hpp"
-#include "action.hpp"
-
-struct Song
-{
-    char basename[ MAX_BASENAME_LENGTH + 1 ];
-    unsigned sequenceNumber;
-    unsigned whichFish;
-    std::list<Action> actions;
-
-    Song() : sequenceNumber(0)
-        , whichFish(3) {
-        basename[0] = 0;
-    }
-
-    bool readWaveFile(char const *_waveFileName)
-    {
-        if (!parseFilename(_waveFileName, sequenceNumber, whichFish, basename)) return false;
-
-        char txtFileName[ FILENAME_MAX ];
-        sprintf(txtFileName, "%u_%u_%s.txt", sequenceNumber, whichFish, basename);
-        FILE *txtfile = fopen(txtFileName, "rt");
-        if (!txtfile) return false;    // TODO
-
-        // read actions from file
-        char actionLine[ MAX_ACTION_LINE_LENGTH + 1 ];
-        while (fgets(actionLine, sizeof(actionLine), txtfile))
-        {
-            Action action;
-            if (action.parseLine(actionLine))
-            {
-                actions.push_back(action);
-            }
-        }
-        return true;
-    }
-
-    static bool parseFilename(char const *_name, unsigned &_num1, unsigned &_num2, char *_basename)
-    {
-        char basename[ MAX_BASENAME_LENGTH + 1 ];
-        unsigned num1, num2;
-        char extension[ 4 ];
-        int nItems = sscanf(_name, BASS_DIRECTORY "/%u_%u_%s", &num1, &num2, basename);
-        if (nItems != 3)
-        {
-            return false;
-        }
-        char *p = strrchr(basename, '.');
-        if (!p)
-        {
-            return false;
-        }
-        strcpy(extension, p+1);
-        *p = 0;
-        if (num2 > 2)
-        {
-            return false;
-        }
-        if (strcasecmp("raw", extension))
-        {
-            return false;
-        }
-        _num1 = num1;
-        _num2 = num2;
-        strcpy(_basename, basename);
-        return true;
-    }
-
-    // return true if filename is of proper format
-    // <num>_<num>_<name>.raw
-    // and there is a corresponding .txt file
-    static bool isValidWaveFileName(char const *_name)
-    {
-        unsigned int num1, num2;
-        char basename[ 31 ];
-        return parseFilename(_name, num1, num2, basename);
-    }
-};
-
-#endif                                 // __included_song_hpp