rger

Dependencies:   mbed

Song.cpp

Committer:
kevinrhyne
Date:
2015-12-08
Revision:
0:a50960b2f6bd

File content as of revision 0:a50960b2f6bd:

#include "Song.h"

Song::Song(string filepath){
    
    Serial pc(USBTX, USBRX);
    pc.baud(115200);

    
}

using namespace std;

int Song::getBinaryNote(string currentNote){
        if (currentNote == "A") return 1;
        if (currentNote == "D") return 129;
        if (currentNote == "E") return 193;
        if (currentNote == "F") return 225;
        if (currentNote == "Fs") return 177;
        if (currentNote == "G") return 241;
        if (currentNote == "Gs") return 185;
        if (currentNote == "A") return 249;
        if (currentNote == "As") return 289;
        if (currentNote == "B") return 254;
        
        return 1;
}

void Song::buildSong(){
        
    //Example Song
    
    noteChart.push_back(make_pair(string("A"), 75));
    noteChart.push_back(make_pair(string("A"), 75));
    noteChart.push_back(make_pair(string("B"), 75));
    noteChart.push_back(make_pair(string("C"), 75));
    noteChart.push_back(make_pair(string("D"), 75));
    noteChart.push_back(make_pair(string("E"), 75));
    noteChart.push_back(make_pair(string("F"), 75));
    noteChart.push_back(make_pair(string("Fs"), 75));
    noteChart.push_back(make_pair(string("G"), 75));
    noteChart.push_back(make_pair(string("Gs"), 75));
    noteChart.push_back(make_pair(string("Gs"), 75));
    noteChart.push_back(make_pair(string("G"), 75));
    noteChart.push_back(make_pair(string("Fs"), 75));
    noteChart.push_back(make_pair(string("G"), 75));
    noteChart.push_back(make_pair(string("E"), 75));
    noteChart.push_back(make_pair(string("F"), 75));
    noteChart.push_back(make_pair(string("D"), 75));
    noteChart.push_back(make_pair(string("C"), 75));
    noteChart.push_back(make_pair(string("A"), 75));
    
}

string Song::getNote(int index){
    return noteChart[index].first;    
}
    
int Song::getLength(int index) {
    return noteChart[index].second;        
}