40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <fmod.hpp>
|
|
#include <fmod_errors.h>
|
|
#include <memory>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
class AudioEmitter {
|
|
private:
|
|
std::unique_ptr<FMOD::System> system;
|
|
FMOD::Channel *timer{nullptr};
|
|
std::vector<std::unique_ptr<FMOD::Sound>> chords;
|
|
std::vector<std::unique_ptr<FMOD::Sound>> drums;
|
|
std::vector<std::unique_ptr<FMOD::Sound>> notes;
|
|
std::vector<std::vector<float>> markov_matrix_chords;
|
|
std::vector<std::vector<float>> markov_matrix_melody;
|
|
int nbr_melo_max{4};
|
|
int nbr_melo_total{ 64 };
|
|
int current_beat{0};
|
|
std::vector<std::vector<float>> rythmes;
|
|
int index_note;
|
|
std::vector<int> chordProgression;
|
|
std::vector<FMOD::Channel *> activeChannels;
|
|
|
|
public:
|
|
int tempo{ 170 };
|
|
AudioEmitter();
|
|
std::vector<std::pair<float, int>> generateMusic();
|
|
void audioUpdate();
|
|
void audioEnd();
|
|
int firstChord();
|
|
int nextChord(int currentChord);
|
|
int firstNote();
|
|
int nextNote(int currentNote);
|
|
int noteSecondaire(int note);
|
|
float getTimeTempo() const;
|
|
float getTime() const;
|
|
float timeBeforeNewGeneration{4.f};
|
|
};
|