nombre fini de notes générées
This commit is contained in:
parent
e5357049b0
commit
b542aea9b3
2 changed files with 7 additions and 3 deletions
|
@ -33,7 +33,6 @@ public:
|
|||
int nextChord(int currentChord);
|
||||
int firstNote();
|
||||
int nextNote(int currentNote);
|
||||
int noteSecondaire(int note);
|
||||
float getTimeTempo() const;
|
||||
float getTime() const;
|
||||
float timeBeforeNewGeneration{4.f};
|
||||
|
|
|
@ -280,6 +280,9 @@ int AudioEmitter::nextNote(int currentNote) {
|
|||
*/
|
||||
std::vector<std::pair<float, int>> AudioEmitter::generateMusic() {
|
||||
std::vector<std::pair<float, int>> result;
|
||||
if (current_beat >= nbr_melo_total) {
|
||||
return result;
|
||||
}
|
||||
result.reserve(16 * nbr_melo_max);
|
||||
float beatDuration = tempo / 60.f;
|
||||
unsigned int sampleRate = 48000;
|
||||
|
@ -344,8 +347,10 @@ std::vector<std::pair<float, int>> AudioEmitter::generateMusic() {
|
|||
void AudioEmitter::audioUpdate() { system->update(); }
|
||||
|
||||
void AudioEmitter::audioEnd() {
|
||||
for (FMOD::Channel *c : activeChannels) {
|
||||
delete c;
|
||||
for (int i = 0; i < activeChannels.size(); i += 1) {
|
||||
if (activeChannels[i]) {
|
||||
activeChannels[i]->stop();
|
||||
}
|
||||
}
|
||||
timer->stop();
|
||||
system->close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue