diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2023-03-23 10:59:50 -0400 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2023-03-23 10:59:50 -0400 |
commit | 146ce7bcb0d1dd66f7899435430ef83f4fd22c3b (patch) | |
tree | b909cb905cd906e8ff0fe6e6c1d4fecda27412fb /song.cpp | |
parent | 8027896bb9b746ef0ee659cfcb9eba1959a22325 (diff) | |
parent | d14d5abf66098c13440a6d035c4b503a00086ce5 (diff) |
Merge branch 'console-ui' of github.com:ChausseBenjamin/fdr into console-ui
Diffstat (limited to 'song.cpp')
-rw-r--r-- | song.cpp | 41 |
1 files changed, 30 insertions, 11 deletions
@@ -10,7 +10,7 @@ Song::Song(std::string chartFile): chartFile(chartFile){ // substitute "notes.chart" for "song.wav" - string audioFile = chartFile; + std::string audioFile = chartFile; audioFile.replace(audioFile.find("notes.chart"), 12, "song.wav"); parseInfo(); parseSync(); @@ -166,19 +166,19 @@ bool Song::parseChords(int difficulty){ switch (difficulty){ case DIFFICULTY_EASY: stringPattern = "EasySingle"; - std::vector<ChordNote>*chords = &easy; + chords = &easy; break; case DIFFICULTY_MEDIUM: stringPattern = "MediumSingle"; - std::vector<ChordNote>*chords = &medium; + chords = &medium; break; case DIFFICULTY_HARD: stringPattern = "HardSingle"; - std::vector<ChordNote>*chords = &hard; + chords = &hard; break; case DIFFICULTY_EXPERT: stringPattern = "ExpertSingle"; - std::vector<ChordNote>*chords = &expert; + chords = &expert; break; default: std::cerr << "Invalid difficulty" << std::endl; @@ -277,16 +277,16 @@ void Song::consolidateChords(int difficulty){ std::vector<ChordNote>*chords; switch (difficulty){ case DIFFICULTY_EASY: - std::vector<ChordNote>*chords = &easy; + chords = &easy; break; case DIFFICULTY_MEDIUM: - std::vector<ChordNote>*chords = &medium; + chords = &medium; break; case DIFFICULTY_HARD: - std::vector<ChordNote>*chords = &hard; + chords = &hard; break; case DIFFICULTY_EXPERT: - std::vector<ChordNote>*chords = &expert; + chords = &expert; break; default: std::cerr << "Invalid difficulty" << std::endl; @@ -374,9 +374,28 @@ std::string Song::getAudioFile(){ void Song::trim(int difficulty){ // TODO: make this fuction use the difficulty parameter //std::vector<ChordNote> *chords = &expert; - for (int i = 0; i < expert.size(); i++) + std::vector<ChordNote>* chords; + switch (difficulty) { + case DIFFICULTY_EASY: + chords = &easy; + break; + case DIFFICULTY_MEDIUM: + chords = &medium; + break; + case DIFFICULTY_HARD: + chords = &hard; + break; + case DIFFICULTY_EXPERT: + chords = &expert; + break; + default: + std::cerr << "Invalid difficulty" << std::endl; + return; + } + + for (int i = 0; i < chords->size(); i++) { - expert[i].trim(); + chords->at(i).trim(); } } |