diff --git a/SimpleGame/media/accords/do.wav b/SimpleGame/media/accords/do.wav deleted file mode 100644 index 7881b72..0000000 Binary files a/SimpleGame/media/accords/do.wav and /dev/null differ diff --git a/SimpleGame/media/accords/fa.wav b/SimpleGame/media/accords/fa.wav deleted file mode 100644 index 9c7a2b3..0000000 Binary files a/SimpleGame/media/accords/fa.wav and /dev/null differ diff --git a/SimpleGame/media/accords/la.wav b/SimpleGame/media/accords/la.wav deleted file mode 100644 index b1c66ef..0000000 Binary files a/SimpleGame/media/accords/la.wav and /dev/null differ diff --git a/SimpleGame/media/accords/mi.wav b/SimpleGame/media/accords/mi.wav deleted file mode 100644 index 9223be1..0000000 Binary files a/SimpleGame/media/accords/mi.wav and /dev/null differ diff --git a/SimpleGame/media/accords/re.wav b/SimpleGame/media/accords/re.wav deleted file mode 100644 index 76dbf30..0000000 Binary files a/SimpleGame/media/accords/re.wav and /dev/null differ diff --git a/SimpleGame/media/accords/si.wav b/SimpleGame/media/accords/si.wav deleted file mode 100644 index 44ebf87..0000000 Binary files a/SimpleGame/media/accords/si.wav and /dev/null differ diff --git a/SimpleGame/media/accords/sol.wav b/SimpleGame/media/accords/sol.wav deleted file mode 100644 index c4c6795..0000000 Binary files a/SimpleGame/media/accords/sol.wav and /dev/null differ diff --git a/SimpleGame/media/chords/variation1/A.mp3 b/SimpleGame/media/chords/variation1/A.mp3 new file mode 100644 index 0000000..f09ff33 Binary files /dev/null and b/SimpleGame/media/chords/variation1/A.mp3 differ diff --git a/SimpleGame/media/chords/variation1/B.mp3 b/SimpleGame/media/chords/variation1/B.mp3 new file mode 100644 index 0000000..3cf3e81 Binary files /dev/null and b/SimpleGame/media/chords/variation1/B.mp3 differ diff --git a/SimpleGame/media/chords/variation1/C.mp3 b/SimpleGame/media/chords/variation1/C.mp3 new file mode 100644 index 0000000..7dc9580 Binary files /dev/null and b/SimpleGame/media/chords/variation1/C.mp3 differ diff --git a/SimpleGame/media/chords/variation1/D.mp3 b/SimpleGame/media/chords/variation1/D.mp3 new file mode 100644 index 0000000..006eb4f Binary files /dev/null and b/SimpleGame/media/chords/variation1/D.mp3 differ diff --git a/SimpleGame/media/chords/variation1/E.mp3 b/SimpleGame/media/chords/variation1/E.mp3 new file mode 100644 index 0000000..837a4bc Binary files /dev/null and b/SimpleGame/media/chords/variation1/E.mp3 differ diff --git a/SimpleGame/media/chords/variation1/F.mp3 b/SimpleGame/media/chords/variation1/F.mp3 new file mode 100644 index 0000000..6cc386a Binary files /dev/null and b/SimpleGame/media/chords/variation1/F.mp3 differ diff --git a/SimpleGame/media/chords/variation1/G.mp3 b/SimpleGame/media/chords/variation1/G.mp3 new file mode 100644 index 0000000..b7d3db3 Binary files /dev/null and b/SimpleGame/media/chords/variation1/G.mp3 differ diff --git a/SimpleGame/media/chords/variation2/A.mp3 b/SimpleGame/media/chords/variation2/A.mp3 new file mode 100644 index 0000000..f4a9a06 Binary files /dev/null and b/SimpleGame/media/chords/variation2/A.mp3 differ diff --git a/SimpleGame/media/chords/variation2/B.mp3 b/SimpleGame/media/chords/variation2/B.mp3 new file mode 100644 index 0000000..a271250 Binary files /dev/null and b/SimpleGame/media/chords/variation2/B.mp3 differ diff --git a/SimpleGame/media/chords/variation2/C.mp3 b/SimpleGame/media/chords/variation2/C.mp3 new file mode 100644 index 0000000..50bd794 Binary files /dev/null and b/SimpleGame/media/chords/variation2/C.mp3 differ diff --git a/SimpleGame/media/chords/variation2/D.mp3 b/SimpleGame/media/chords/variation2/D.mp3 new file mode 100644 index 0000000..9a5e355 Binary files /dev/null and b/SimpleGame/media/chords/variation2/D.mp3 differ diff --git a/SimpleGame/media/chords/variation2/E.mp3 b/SimpleGame/media/chords/variation2/E.mp3 new file mode 100644 index 0000000..0749c1d Binary files /dev/null and b/SimpleGame/media/chords/variation2/E.mp3 differ diff --git a/SimpleGame/media/chords/variation2/F.mp3 b/SimpleGame/media/chords/variation2/F.mp3 new file mode 100644 index 0000000..7891b73 Binary files /dev/null and b/SimpleGame/media/chords/variation2/F.mp3 differ diff --git a/SimpleGame/media/chords/variation2/G.mp3 b/SimpleGame/media/chords/variation2/G.mp3 new file mode 100644 index 0000000..04f473a Binary files /dev/null and b/SimpleGame/media/chords/variation2/G.mp3 differ diff --git a/SimpleGame/media/loyal three.mp3 b/SimpleGame/media/loyal three.mp3 deleted file mode 100644 index 9413944..0000000 Binary files a/SimpleGame/media/loyal three.mp3 and /dev/null differ diff --git a/SimpleGame/media/notes/A1.mp3 b/SimpleGame/media/notes/A1.mp3 new file mode 100644 index 0000000..f22160b Binary files /dev/null and b/SimpleGame/media/notes/A1.mp3 differ diff --git a/SimpleGame/media/notes/A1.wav b/SimpleGame/media/notes/A1.wav deleted file mode 100644 index 459f5fb..0000000 Binary files a/SimpleGame/media/notes/A1.wav and /dev/null differ diff --git a/SimpleGame/media/notes/A2.mp3 b/SimpleGame/media/notes/A2.mp3 new file mode 100644 index 0000000..1f6fa7d Binary files /dev/null and b/SimpleGame/media/notes/A2.mp3 differ diff --git a/SimpleGame/media/notes/A2.wav b/SimpleGame/media/notes/A2.wav deleted file mode 100644 index 43cf18c..0000000 Binary files a/SimpleGame/media/notes/A2.wav and /dev/null differ diff --git a/SimpleGame/media/notes/A3.mp3 b/SimpleGame/media/notes/A3.mp3 new file mode 100644 index 0000000..457b2a5 Binary files /dev/null and b/SimpleGame/media/notes/A3.mp3 differ diff --git a/SimpleGame/media/notes/A3.wav b/SimpleGame/media/notes/A3.wav deleted file mode 100644 index c4bd560..0000000 Binary files a/SimpleGame/media/notes/A3.wav and /dev/null differ diff --git a/SimpleGame/media/notes/B1.mp3 b/SimpleGame/media/notes/B1.mp3 new file mode 100644 index 0000000..b07a05a Binary files /dev/null and b/SimpleGame/media/notes/B1.mp3 differ diff --git a/SimpleGame/media/notes/B1.wav b/SimpleGame/media/notes/B1.wav deleted file mode 100644 index 078cf10..0000000 Binary files a/SimpleGame/media/notes/B1.wav and /dev/null differ diff --git a/SimpleGame/media/notes/B2.mp3 b/SimpleGame/media/notes/B2.mp3 new file mode 100644 index 0000000..40827e2 Binary files /dev/null and b/SimpleGame/media/notes/B2.mp3 differ diff --git a/SimpleGame/media/notes/B2.wav b/SimpleGame/media/notes/B2.wav deleted file mode 100644 index e4300cb..0000000 Binary files a/SimpleGame/media/notes/B2.wav and /dev/null differ diff --git a/SimpleGame/media/notes/C1.mp3 b/SimpleGame/media/notes/C1.mp3 new file mode 100644 index 0000000..8eebc94 Binary files /dev/null and b/SimpleGame/media/notes/C1.mp3 differ diff --git a/SimpleGame/media/notes/C1.wav b/SimpleGame/media/notes/C1.wav deleted file mode 100644 index 9573fb6..0000000 Binary files a/SimpleGame/media/notes/C1.wav and /dev/null differ diff --git a/SimpleGame/media/notes/C2.mp3 b/SimpleGame/media/notes/C2.mp3 new file mode 100644 index 0000000..ad59e2b Binary files /dev/null and b/SimpleGame/media/notes/C2.mp3 differ diff --git a/SimpleGame/media/notes/C2.wav b/SimpleGame/media/notes/C2.wav deleted file mode 100644 index 4c1ff41..0000000 Binary files a/SimpleGame/media/notes/C2.wav and /dev/null differ diff --git a/SimpleGame/media/notes/D1.mp3 b/SimpleGame/media/notes/D1.mp3 new file mode 100644 index 0000000..1fb8d76 Binary files /dev/null and b/SimpleGame/media/notes/D1.mp3 differ diff --git a/SimpleGame/media/notes/D1.wav b/SimpleGame/media/notes/D1.wav deleted file mode 100644 index 22413b6..0000000 Binary files a/SimpleGame/media/notes/D1.wav and /dev/null differ diff --git a/SimpleGame/media/notes/D2.mp3 b/SimpleGame/media/notes/D2.mp3 new file mode 100644 index 0000000..a4f7af4 Binary files /dev/null and b/SimpleGame/media/notes/D2.mp3 differ diff --git a/SimpleGame/media/notes/D2.wav b/SimpleGame/media/notes/D2.wav deleted file mode 100644 index bab5a05..0000000 Binary files a/SimpleGame/media/notes/D2.wav and /dev/null differ diff --git a/SimpleGame/media/notes/E1.mp3 b/SimpleGame/media/notes/E1.mp3 new file mode 100644 index 0000000..eee8c43 Binary files /dev/null and b/SimpleGame/media/notes/E1.mp3 differ diff --git a/SimpleGame/media/notes/E1.wav b/SimpleGame/media/notes/E1.wav deleted file mode 100644 index 8d0ab0e..0000000 Binary files a/SimpleGame/media/notes/E1.wav and /dev/null differ diff --git a/SimpleGame/media/notes/E2.mp3 b/SimpleGame/media/notes/E2.mp3 new file mode 100644 index 0000000..a34ae5f Binary files /dev/null and b/SimpleGame/media/notes/E2.mp3 differ diff --git a/SimpleGame/media/notes/E2.wav b/SimpleGame/media/notes/E2.wav deleted file mode 100644 index 1d0bda2..0000000 Binary files a/SimpleGame/media/notes/E2.wav and /dev/null differ diff --git a/SimpleGame/media/notes/F1.mp3 b/SimpleGame/media/notes/F1.mp3 new file mode 100644 index 0000000..2852db2 Binary files /dev/null and b/SimpleGame/media/notes/F1.mp3 differ diff --git a/SimpleGame/media/notes/F1.wav b/SimpleGame/media/notes/F1.wav deleted file mode 100644 index 8b3526d..0000000 Binary files a/SimpleGame/media/notes/F1.wav and /dev/null differ diff --git a/SimpleGame/media/notes/F2.mp3 b/SimpleGame/media/notes/F2.mp3 new file mode 100644 index 0000000..e7526e7 Binary files /dev/null and b/SimpleGame/media/notes/F2.mp3 differ diff --git a/SimpleGame/media/notes/F2.wav b/SimpleGame/media/notes/F2.wav deleted file mode 100644 index f3917e7..0000000 Binary files a/SimpleGame/media/notes/F2.wav and /dev/null differ diff --git a/SimpleGame/media/notes/G1.mp3 b/SimpleGame/media/notes/G1.mp3 new file mode 100644 index 0000000..09440d7 Binary files /dev/null and b/SimpleGame/media/notes/G1.mp3 differ diff --git a/SimpleGame/media/notes/G1.wav b/SimpleGame/media/notes/G1.wav deleted file mode 100644 index 8b2f7ad..0000000 Binary files a/SimpleGame/media/notes/G1.wav and /dev/null differ diff --git a/SimpleGame/media/notes/G2.mp3 b/SimpleGame/media/notes/G2.mp3 new file mode 100644 index 0000000..431a701 Binary files /dev/null and b/SimpleGame/media/notes/G2.mp3 differ diff --git a/SimpleGame/media/notes/G2.wav b/SimpleGame/media/notes/G2.wav deleted file mode 100644 index a6d11bb..0000000 Binary files a/SimpleGame/media/notes/G2.wav and /dev/null differ diff --git a/SimpleGame/media/pecharunt.mp3 b/SimpleGame/media/pecharunt.mp3 deleted file mode 100644 index c2e744d..0000000 Binary files a/SimpleGame/media/pecharunt.mp3 and /dev/null differ diff --git a/SimpleGame/media/percussions/drums1.wav b/SimpleGame/media/percussions/drums1.wav deleted file mode 100644 index 8cbdba9..0000000 Binary files a/SimpleGame/media/percussions/drums1.wav and /dev/null differ diff --git a/SimpleGame/media/percussions/drums2.wav b/SimpleGame/media/percussions/drums2.wav deleted file mode 100644 index e921428..0000000 Binary files a/SimpleGame/media/percussions/drums2.wav and /dev/null differ diff --git a/SimpleGame/media/percussions/drums3.wav b/SimpleGame/media/percussions/drums3.wav deleted file mode 100644 index 35c9391..0000000 Binary files a/SimpleGame/media/percussions/drums3.wav and /dev/null differ diff --git a/SimpleGame/src/Include/AudioEmitter.hpp b/SimpleGame/src/Include/AudioEmitter.hpp index e1bd695..d41cae8 100644 --- a/SimpleGame/src/Include/AudioEmitter.hpp +++ b/SimpleGame/src/Include/AudioEmitter.hpp @@ -13,7 +13,6 @@ private: std::vector> chords; std::vector> drums; std::vector> notes; - int tempo{170}; std::vector> markov_matrix_chords; std::vector> markov_matrix_melody; int nbr_melo_max{4}; @@ -24,6 +23,7 @@ private: std::vector activeChannels; public: + int tempo{ 170 }; AudioEmitter(); std::vector> generateMusic(); void audioUpdate(); @@ -35,5 +35,5 @@ public: int noteSecondaire(int note); float getTimeTempo() const; float getTime() const; - float timeBeforeNewGeneration{0.2f}; + float timeBeforeNewGeneration{4.f}; }; diff --git a/SimpleGame/src/Source/AudioEmitter.cpp b/SimpleGame/src/Source/AudioEmitter.cpp index d88e89c..82d79f6 100644 --- a/SimpleGame/src/Source/AudioEmitter.cpp +++ b/SimpleGame/src/Source/AudioEmitter.cpp @@ -25,67 +25,70 @@ AudioEmitter::AudioEmitter() { system.reset(rawSystem); ERRCHECK(system->init(512, FMOD_INIT_NORMAL, nullptr)); - std::vector rawChords(7); - ERRCHECK(system->createSound("media/accords/do.wav", FMOD_LOOP_OFF, nullptr, + std::vector rawChords(14); + printf("coucou\n"); + ERRCHECK(system->createSound("media/chords/variation1/C.mp3", FMOD_LOOP_OFF, nullptr, &rawChords[0])); - ERRCHECK(system->createSound("media/accords/re.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/chords/variation1/D.mp3", FMOD_LOOP_OFF, nullptr, &rawChords[1])); - ERRCHECK(system->createSound("media/accords/mi.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/chords/variation1/E.mp3", FMOD_LOOP_OFF, nullptr, &rawChords[2])); - ERRCHECK(system->createSound("media/accords/fa.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/chords/variation1/F.mp3", FMOD_LOOP_OFF, nullptr, &rawChords[3])); - ERRCHECK(system->createSound("media/accords/sol.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/chords/variation1/G.mp3", FMOD_LOOP_OFF, nullptr, &rawChords[4])); - ERRCHECK(system->createSound("media/accords/la.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/chords/variation1/A.mp3", FMOD_LOOP_OFF, nullptr, &rawChords[5])); - ERRCHECK(system->createSound("media/accords/si.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/chords/variation1/B.mp3", FMOD_LOOP_OFF, nullptr, &rawChords[6])); - for (int i = 0; i < 7; i += 1) { + ERRCHECK(system->createSound("media/chords/variation2/C.mp3", FMOD_LOOP_OFF, nullptr, + &rawChords[7])); + ERRCHECK(system->createSound("media/chords/variation2/D.mp3", FMOD_LOOP_OFF, nullptr, + &rawChords[8])); + ERRCHECK(system->createSound("media/chords/variation2/E.mp3", FMOD_LOOP_OFF, nullptr, + &rawChords[9])); + ERRCHECK(system->createSound("media/chords/variation2/F.mp3", FMOD_LOOP_OFF, nullptr, + &rawChords[10])); + ERRCHECK(system->createSound("media/chords/variation2/G.mp3", FMOD_LOOP_OFF, nullptr, + &rawChords[11])); + ERRCHECK(system->createSound("media/chords/variation2/A.mp3", FMOD_LOOP_OFF, nullptr, + &rawChords[12])); + ERRCHECK(system->createSound("media/chords/variation2/B.mp3", FMOD_LOOP_OFF, nullptr, + &rawChords[13])); + for (int i = 0; i < 14; i += 1) { chords.push_back(std::unique_ptr(rawChords[i])); } - int nbr_drums = 3; - std::vector rawDrums(nbr_drums); - ERRCHECK(system->createSound("media/percussions/drums1.wav", FMOD_LOOP_OFF, - nullptr, &rawDrums[0])); - ERRCHECK(system->createSound("media/percussions/drums2.wav", FMOD_LOOP_OFF, - nullptr, &rawDrums[1])); - ERRCHECK(system->createSound("media/percussions/drums3.wav", FMOD_LOOP_OFF, - nullptr, &rawDrums[2])); - for (int i = 0; i < nbr_drums; i += 1) { - drums.push_back(std::unique_ptr(rawDrums[i])); - } - std::vector rawNotes(15); - ERRCHECK(system->createSound("media/notes/A1.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/A1.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[0])); - ERRCHECK(system->createSound("media/notes/B1.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/B1.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[1])); - ERRCHECK(system->createSound("media/notes/C1.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/C1.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[2])); - ERRCHECK(system->createSound("media/notes/D1.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/D1.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[3])); - ERRCHECK(system->createSound("media/notes/E1.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/E1.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[4])); - ERRCHECK(system->createSound("media/notes/F1.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/F1.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[5])); - ERRCHECK(system->createSound("media/notes/G1.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/G1.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[6])); - ERRCHECK(system->createSound("media/notes/A2.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/A2.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[7])); - ERRCHECK(system->createSound("media/notes/B2.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/B2.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[8])); - ERRCHECK(system->createSound("media/notes/C2.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/C2.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[9])); - ERRCHECK(system->createSound("media/notes/D2.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/D2.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[10])); - ERRCHECK(system->createSound("media/notes/E2.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/E2.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[11])); - ERRCHECK(system->createSound("media/notes/F2.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/F2.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[12])); - ERRCHECK(system->createSound("media/notes/G2.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/G2.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[13])); - ERRCHECK(system->createSound("media/notes/A3.wav", FMOD_LOOP_OFF, nullptr, + ERRCHECK(system->createSound("media/notes/A3.mp3", FMOD_LOOP_OFF, nullptr, &rawNotes[14])); for (int i = 0; i < 15; i += 1) { notes.push_back(std::unique_ptr(rawNotes[i])); @@ -195,7 +198,7 @@ AudioEmitter::AudioEmitter() { } FMOD::Sound *metronome_Sound; - ERRCHECK(system->createSound("media/notes/A1.wav", FMOD_DEFAULT, nullptr, + ERRCHECK(system->createSound("media/notes/A1.mp3", FMOD_DEFAULT, nullptr, &metronome_Sound)); ERRCHECK(system->playSound(metronome_Sound, nullptr, true, &timer)); ERRCHECK(timer->setVolume(0)); @@ -264,18 +267,6 @@ int AudioEmitter::nextNote(int currentNote) { return sampleIndex(markov_matrix_melody[currentNote]); } -int AudioEmitter::noteSecondaire(int note) { - std::vector notesPossibles = {note - 4, note - 3, note + 3, note + 4, - note + 5}; - std::vector proba = {0.05, 0.10, 0.60, 0.05, 0.2}; - for (int i = 0; i < proba.size(); i += 1) { - if ((notesPossibles[i] < 0) || (notesPossibles[i] >= notes.size())) { - proba[i] = 0; - } - } - return randomWeightedChoice(notesPossibles, proba); -} - /** * generate music * @@ -299,7 +290,7 @@ std::vector> AudioEmitter::generateMusic() { for (int i = 1; i < 4; i += 1) { chordProgression[i] = nextChord(chordProgression[i - 1]); } - int index_drums = rand() % 3; + for (int i = current_beat; i < current_beat + nbr_melo_max; i += 1) { // Chords FMOD::Channel *channelChords = nullptr; @@ -313,14 +304,6 @@ std::vector> AudioEmitter::generateMusic() { ERRCHECK(channelChords->setPaused(false)); activeChannels.push_back(channelChords); - // Drums - FMOD::Channel *channelDrums = nullptr; - ERRCHECK(system->playSound(drums[index_drums].get(), nullptr, true, - &channelDrums)); - ERRCHECK(channelDrums->setDelay(delay, 0, true)); - ERRCHECK(channelDrums->setPaused(false)); - - activeChannels.push_back(channelDrums); // Mélodie std::vector rythme_melodie = rythmes[rand() % rythmes.size()]; for (float time : rythme_melodie) { @@ -333,8 +316,8 @@ std::vector> AudioEmitter::generateMusic() { (unsigned long long)(note_start * sampleRate); ERRCHECK(channelNote->setDelay(delayNote, 0, true)); ERRCHECK(channelNote->setPaused(false)); - index_note = nextNote(index_note); result.push_back(std::pair(note_start, index_note)); + index_note = nextNote(index_note); activeChannels.push_back(channelNote); } } diff --git a/SimpleGame/src/Source/Main.cpp b/SimpleGame/src/Source/Main.cpp index 1c1c038..6551ccf 100644 --- a/SimpleGame/src/Source/Main.cpp +++ b/SimpleGame/src/Source/Main.cpp @@ -4,7 +4,7 @@ int main() { // from out/build/src - if (!NoteSprite::loadTexture("../../../media/sprites/flower_tile.png")) { + if (!NoteSprite::loadTexture("media/sprites/flower_tile.png")) { std::cerr << "Failed to load texture!" << std::endl; return -1; } diff --git a/SimpleGame/src/Source/NoteSprite.cpp b/SimpleGame/src/Source/NoteSprite.cpp index 4dd8855..e4623b3 100644 --- a/SimpleGame/src/Source/NoteSprite.cpp +++ b/SimpleGame/src/Source/NoteSprite.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +//#include #include sf::Texture NoteSprite::texture; diff --git a/SimpleGame/src/Source/NoteTile.cpp b/SimpleGame/src/Source/NoteTile.cpp index d67505c..312a66c 100644 --- a/SimpleGame/src/Source/NoteTile.cpp +++ b/SimpleGame/src/Source/NoteTile.cpp @@ -12,7 +12,7 @@ NoteTile::NoteTile(float play_time, float good_interval, NotePlaceEnum place, : play_time(play_time), good_interval(good_interval), place(place), note_sprite() { // TODO do real note_sprite init, make it fall at good speed far enough... - note_sprite.fall_speed = 100; + note_sprite.fall_speed = 500; note_sprite.sprite.setPosition(sf::Vector2f( NOTE_PLACE_X_POS[place], NOTE_PRESS_HEIGHT - note_sprite.fall_speed * (play_time - current_time))); diff --git a/SimpleGame/src/Source/TilePattern.cpp b/SimpleGame/src/Source/TilePattern.cpp index a4382af..6556cc2 100644 --- a/SimpleGame/src/Source/TilePattern.cpp +++ b/SimpleGame/src/Source/TilePattern.cpp @@ -8,12 +8,13 @@ void generateTilePattern(std::vector> new_notes, const AudioEmitter &audio_emitter) { int i = -1; + float beatDuration = 60.f / audio_emitter.tempo; for (auto note : new_notes) { i++; - if (i % 4 != 0) // skip les 3/4 des notes (je suis trop nul sinon) - continue; + // if (i % 4 != 0) // skip les 3/4 des notes (je suis trop nul sinon) + // continue; float start_time = note.first; NotePlaceEnum notePlace = static_cast(i % 3); - NoteTile::create(start_time, 0.5, notePlace, audio_emitter.getTime()); + NoteTile::create(start_time, beatDuration, notePlace, audio_emitter.getTime()); } }