add instrument factory

This commit is contained in:
2026-10-17 03:34:19 -05:00
parent 54996469d1
commit 5d86018d06
17 changed files with 171 additions and 126 deletions

View File

@@ -0,0 +1,35 @@
#pragma once
#include "config/ConfigService.hpp"
#include "config/AudioConfig.hpp"
#include "LoggerService.hpp"
#include "Instruments/Instrument.hpp"
#include "WavetableLoader.hpp"
class InstrumentFactory {
public:
InstrumentFactory(ConfigService* config, LoggerService* logger);
~InstrumentFactory() = default;
int32_t createInstruments(std::vector<Instrument*>* instruments, size_t voiceCount, float sampleRate, AudioParams* params);
enum class InstrumentType {
Default,
PianoString,
WavetableOscillator
};
private:
Instrument* createInstrument(InstrumentType type, float sampleRate, AudioParams* params);
ConfigService* config_;
LoggerService* logger_;
// optional creators
WavetableLoader* wavetableLoader_ = nullptr;
};