From d14d5abf66098c13440a6d035c4b503a00086ce5 Mon Sep 17 00:00:00 2001 From: Simon Gagne Date: Wed, 22 Mar 2023 23:03:32 -0400 Subject: Synchro Strumming + ajout menu Keyboard --- song.cpp | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'song.cpp') diff --git a/song.cpp b/song.cpp index 14ac92d..6fc03a2 100644 --- a/song.cpp +++ b/song.cpp @@ -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*chords = &easy; + chords = &easy; break; case DIFFICULTY_MEDIUM: stringPattern = "MediumSingle"; - std::vector*chords = &medium; + chords = &medium; break; case DIFFICULTY_HARD: stringPattern = "HardSingle"; - std::vector*chords = &hard; + chords = &hard; break; case DIFFICULTY_EXPERT: stringPattern = "ExpertSingle"; - std::vector*chords = &expert; + chords = &expert; break; default: std::cerr << "Invalid difficulty" << std::endl; @@ -277,16 +277,16 @@ void Song::consolidateChords(int difficulty){ std::vector*chords; switch (difficulty){ case DIFFICULTY_EASY: - std::vector*chords = &easy; + chords = &easy; break; case DIFFICULTY_MEDIUM: - std::vector*chords = &medium; + chords = &medium; break; case DIFFICULTY_HARD: - std::vector*chords = &hard; + chords = &hard; break; case DIFFICULTY_EXPERT: - std::vector*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 *chords = &expert; - for (int i = 0; i < expert.size(); i++) + std::vector* 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(); } } -- cgit v1.2.3