add instrument factory
This commit is contained in:
35
src/synth/InstrumentFactory.hpp
Normal file
35
src/synth/InstrumentFactory.hpp
Normal 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;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user