feat(filter): Add modulation support and LFO integration
This commit is contained in:
parent
3c3fec9b90
commit
fe594a5494
6 changed files with 131 additions and 20 deletions
39
core/Oscillator.hpp
Normal file
39
core/Oscillator.hpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef OSCILLATOR_HPP_INCLUDED
|
||||
#define OSCILLATOR_HPP_INCLUDED
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
class Oscillator {
|
||||
enum WaveShape { kWaveShapeSine, kWaveShapeTriangle, kWaveShapeSquare };
|
||||
|
||||
public:
|
||||
Oscillator(float initFreq);
|
||||
void process(float *out, uint32_t frames);
|
||||
|
||||
void setFrequency(float newFreq);
|
||||
float getFrequency() const;
|
||||
|
||||
void setGain(float newGain);
|
||||
float getGain() const;
|
||||
|
||||
void setSampleRate(float newSampleRate);
|
||||
float getSampleRate() const;
|
||||
|
||||
void setWaveShape(WaveShape shape);
|
||||
WaveShape getWaveShape() const;
|
||||
|
||||
private:
|
||||
float freq_;
|
||||
float gain_;
|
||||
WaveShape waveShape_;
|
||||
float sampleRate_;
|
||||
float phase_;
|
||||
float inc_;
|
||||
void recalc_();
|
||||
};
|
||||
|
||||
#endif // OSCILLATOR_HPP_INCLUDED
|
||||
Loading…
Add table
Add a link
Reference in a new issue