39 lines
741 B
C++
39 lines
741 B
C++
|
|
#pragma once
|
|
|
|
#include "ConfigService.hpp"
|
|
#include "LoggerService.hpp"
|
|
#include "NoteQueue.hpp"
|
|
#include "Voice.hpp"
|
|
#include "Scope.hpp"
|
|
|
|
#include <vector>
|
|
|
|
class Synth {
|
|
|
|
public:
|
|
|
|
Synth(ConfigService* config, LoggerService* logger, ScopeBuffer* scope, NoteQueue* queue);
|
|
~Synth() = default;
|
|
|
|
void process(float* out, size_t nFrames);
|
|
void handleNoteEvent(const NoteEvent& event);
|
|
|
|
private:
|
|
|
|
Voice* findFreeVoice();
|
|
Voice* findVoiceByNote(uint8_t note);
|
|
|
|
std::vector<uint8_t> sustainedNotes_;
|
|
|
|
// voices
|
|
static constexpr size_t MAX_VOICES = 32;
|
|
std::array<Voice, MAX_VOICES> voices_;
|
|
|
|
ConfigService* config_;
|
|
LoggerService* logger_;
|
|
ScopeBuffer* scope_;;
|
|
NoteQueue* noteQueue_;
|
|
|
|
};
|