Nouveaux sons et cette fois ça marche

This commit is contained in:
antpoms 2025-06-14 19:41:36 +02:00
parent 4bbdbfe6e4
commit 2837bbf6fa
5 changed files with 11 additions and 12 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -25,8 +25,7 @@ AudioEmitter::AudioEmitter() {
system.reset(rawSystem);
ERRCHECK(system->init(512, FMOD_INIT_NORMAL, nullptr));
std::vector<FMOD::Sound *> rawChords(14);
printf("coucou\n");
std::vector<FMOD::Sound *> rawChords(7);
ERRCHECK(system->createSound("media/chords/variation1/C.mp3", FMOD_LOOP_OFF, nullptr,
&rawChords[0]));
ERRCHECK(system->createSound("media/chords/variation1/D.mp3", FMOD_LOOP_OFF, nullptr,
@ -41,21 +40,22 @@ AudioEmitter::AudioEmitter() {
&rawChords[5]));
ERRCHECK(system->createSound("media/chords/variation1/B.mp3", FMOD_LOOP_OFF, nullptr,
&rawChords[6]));
std::vector<FMOD::Sound*> rawChords2(7);
ERRCHECK(system->createSound("media/chords/variation2/C.mp3", FMOD_LOOP_OFF, nullptr,
&rawChords[7]));
&rawChords2[0]));
ERRCHECK(system->createSound("media/chords/variation2/D.mp3", FMOD_LOOP_OFF, nullptr,
&rawChords[8]));
&rawChords2[1]));
ERRCHECK(system->createSound("media/chords/variation2/E.mp3", FMOD_LOOP_OFF, nullptr,
&rawChords[9]));
&rawChords2[2]));
ERRCHECK(system->createSound("media/chords/variation2/F.mp3", FMOD_LOOP_OFF, nullptr,
&rawChords[10]));
&rawChords2[3]));
ERRCHECK(system->createSound("media/chords/variation2/G.mp3", FMOD_LOOP_OFF, nullptr,
&rawChords[11]));
&rawChords2[4]));
ERRCHECK(system->createSound("media/chords/variation2/A.mp3", FMOD_LOOP_OFF, nullptr,
&rawChords[12]));
&rawChords2[5]));
ERRCHECK(system->createSound("media/chords/variation2/B.mp3", FMOD_LOOP_OFF, nullptr,
&rawChords[13]));
for (int i = 0; i < 14; i += 1) {
&rawChords2[6]));
for (int i = 0; i < 7; i += 1) {
chords.push_back(std::unique_ptr<FMOD::Sound>(rawChords[i]));
}
@ -198,7 +198,7 @@ AudioEmitter::AudioEmitter() {
}
FMOD::Sound *metronome_Sound;
ERRCHECK(system->createSound("media/notes/A1.mp3", FMOD_DEFAULT, nullptr,
ERRCHECK(system->createSound("media/percussions/drums1.wav", FMOD_DEFAULT, nullptr,
&metronome_Sound));
ERRCHECK(system->playSound(metronome_Sound, nullptr, true, &timer));
ERRCHECK(timer->setVolume(0));
@ -311,7 +311,6 @@ std::vector<std::pair<float, int>> AudioEmitter::generateMusic() {
ERRCHECK(system->playSound(notes[index_note].get(), nullptr, true,
&channelNote));
float note_start = (i + time / 8.f) * beatDuration;
printf("note start %f \n", note_start);
unsigned long long delayNote =
(unsigned long long)(note_start * sampleRate);
ERRCHECK(channelNote->setDelay(delayNote, 0, true));