diff options
-rw-r--r-- | chordNote.h | 4 | ||||
-rw-r--r-- | song.cpp | 54 | ||||
-rw-r--r-- | song.h | 32 |
3 files changed, 0 insertions, 90 deletions
diff --git a/chordNote.h b/chordNote.h index 33a7010..c6b833a 100644 --- a/chordNote.h +++ b/chordNote.h @@ -1,8 +1,6 @@ #ifndef __CHORDNOTE_H__ #define __CHORDNOTE_H__ -#include <regex> - // Chords are used to represent a set of notes that are played together. // For this guitar hero implementation, a single note is technically a chord. // This analogy is used to make sure that simultaneous notes are always grouped @@ -30,13 +28,11 @@ class ChordNote { ChordNote(int btn, int startTime, int endTime); ~ChordNote(); void change(int button); // change note in existing chord - void setEnd(int endTime); // set the end time of the chord void setRenderStart(int renderTime); // sets when to start rendering bool* getNotes(); // get the notes in the chord int getStart(); // get the start time of the chord int getEnd(); // get the end time of the chord int getRenderStart(); // get the render time of the chord - std::regex getRegex(); // regex for this chord // compares the player's input to // the expected chord }; diff --git a/song.cpp b/song.cpp deleted file mode 100644 index 24d0b67..0000000 --- a/song.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "song.h" - -Song::Song(std::string chartFile) { - // TODO: import and parse chartFile -} - -Song::~Song() {}; - -void Song::consolidate() { - int totalSize = chords.size(); - // Check each chord against every other chord - for (int i=0; i<totalSize; i++) { - // Get the start and end times of the current chord - int start = chords[i].getStart(); - int end = chords[i].getEnd(); - // Check the current chord against every following chord - for (int j=i+1; j<totalSize; j++) { - // If the start and end times match: - if (chords[j].getStart() == start && chords[j].getEnd() == end) { - // Append those notes to the first encountered chord (i) - for (int k=0; k<5; k++) { - // If this note is set in the second chord, change it in the first - if (chords[j].getNotes()[k]) { - chords[i].change(k); - } - } - // Remove the second chord from the vector - chords.erase(chords.begin()+j); - // Decrement the total size of the vector - totalSize--; - } - } - } -} - -std::string Song::getTitle() { - return title; -} - -std::string Song::getArtist() { - return artist; -} - -int Song::getDuration() { - return duration; -} - -std::string Song::getAudioFile() { - return audioFile; -} - -std::vector<ChordNote> Song::getChords() { - return chords; -} @@ -1,32 +0,0 @@ -#ifndef __SONG_H__ -#define __SONG_H__ - -#include "chordNote.h" -#include <vector> - -// Contains a song for a guitar hero clone -class Song { - private: - std::string title; - std::string artist; - int duration; // in ms - std::string audioFile; // path to audio file - std::vector<ChordNote> chords; - public: - Song(std::string chartFile); - ~Song(); - void consolidate(); // merges chords with the same start/end times - // into a single chord - ChordNote operator[](int index); - int size(); - - std::string getTitle(); - std::string getArtist(); - int getDuration(); - std::string getAudioFile(); - std::vector<ChordNote> getChords(); -}; - -//#include "song.cpp" -#endif // __SONG_H__ - |