add oscillator
This commit is contained in:
0
src/synth/Instruments/WavetableOscillator.cpp
Normal file
0
src/synth/Instruments/WavetableOscillator.cpp
Normal file
29
src/synth/Instruments/WavetableOscillator.hpp
Normal file
29
src/synth/Instruments/WavetableOscillator.hpp
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "synth/instruments/Instrument.hpp"
|
||||||
|
|
||||||
|
class PianoString : public Instrument {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
WavetableOscillator() = default;
|
||||||
|
WavetableOscillator(ConfigService* config, LoggerService* logger, float sampleRate);
|
||||||
|
~WavetableOscillator() = default;
|
||||||
|
|
||||||
|
void noteOn(float frequency, float velocity) override;
|
||||||
|
void noteOff() override;
|
||||||
|
|
||||||
|
bool isActive() override;
|
||||||
|
|
||||||
|
float process(bool& scopeTrigger) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool loadWavetable(std::string filename); // TODO: load from conf file instead
|
||||||
|
|
||||||
|
std::vector<float> wavetable;
|
||||||
|
|
||||||
|
};
|
||||||
0
src/synth/WavetableLoader.cpp
Normal file
0
src/synth/WavetableLoader.cpp
Normal file
4
src/synth/WavetableLoader.hpp
Normal file
4
src/synth/WavetableLoader.hpp
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
// placeholder to handle loading wavetables from files
|
||||||
|
// so that wavetables can be shared to each voice/instrument
|
||||||
|
// only need to need to load once for x number of voices
|
||||||
Reference in New Issue
Block a user