Kevin Rhyne
/
Solenocarina
Self-playing Ocarina!
Fork of Solenoc by
Diff: Song.cpp
- Revision:
- 0:a50960b2f6bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Song.cpp Tue Dec 08 12:23:46 2015 +0000 @@ -0,0 +1,60 @@ +#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; +} \ No newline at end of file