SynthLab SDK
noiseoscillator.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "synthbase.h"
4 #include "synthfunctions.h"
5 
6 // -----------------------------
7 // --- SynthLab SDK File --- //
8 // ----------------------------
16 // -----------------------------------------------------------------------------
17 namespace SynthLab
18 {
99  {
100  public:
102  NoiseOscillator(std::shared_ptr<MidiInputData> _midiInputData,
103  std::shared_ptr<NoiseOscillatorParameters> _parameters,
104  uint32_t blockSize = 32);
105 
107  virtual ~NoiseOscillator() {}/* D-TOR */
108 
110  virtual bool reset(double _sampleRate) override;
111  virtual bool update() override;
112  virtual bool render(uint32_t samplesToProcess = 1) override;
113  virtual bool doNoteOn(MIDINoteEvent& noteEvent) override;
114  virtual bool doNoteOff(MIDINoteEvent& noteEvent) override;
115 
117  std::shared_ptr<NoiseOscillatorParameters> getParameters() { return parameters; }
118 
119  protected:
121  std::shared_ptr<NoiseOscillatorParameters> parameters = nullptr;
122 
123  // --- sample rate
124  double sampleRate = 0.0;
125 
126  // --- output scalar
127  double outputAmplitude = 0.0;
128 
129  // --- timebase
131 
132  // --- the noise generator is general purpose; here used as the core
134  };
135 
136 
137 } // namespace
virtual bool doNoteOn(MIDINoteEvent &noteEvent) override
Calls the note-on handler for the module.
Definition: noiseoscillator.cpp:114
Compact modulo counter with wrapping used as the timebase for all oscillators.
Definition: synthbase.h:137
double outputAmplitude
raw value
Definition: noiseoscillator.h:127
double sampleRate
sample rate
Definition: noiseoscillator.h:124
NoiseOscillator(std::shared_ptr< MidiInputData > _midiInputData, std::shared_ptr< NoiseOscillatorParameters > _parameters, uint32_t blockSize=32)
Constructs Noise Oscillator module.
Definition: noiseoscillator.cpp:26
virtual bool reset(double _sampleRate) override
Resets object to initialized state.
Definition: noiseoscillator.cpp:49
Simple object that generates white, gaussian white or pink noise.
Definition: synthbase.h:495
NoiseGenerator noiseGen
the actual generator
Definition: noiseoscillator.h:133
Definition: addosccore.cpp:4
std::shared_ptr< NoiseOscillatorParameters > parameters
Definition: noiseoscillator.h:121
SynthClock synthClock
timebase
Definition: noiseoscillator.h:130
Abstract base class that encapsulates functionality of a module; used with the Module-Core paradigm...
Definition: synthbase.h:1600
Noise oscillator module.
Definition: noiseoscillator.h:98
virtual ~NoiseOscillator()
Definition: noiseoscillator.h:107
virtual bool doNoteOff(MIDINoteEvent &noteEvent) override
Calls the note-off handler for the module.
Definition: noiseoscillator.cpp:124
hard-coded arrays of FIR filter coefficients for the sample rate conversion objects (Interpolator and...
std::shared_ptr< NoiseOscillatorParameters > getParameters()
Definition: noiseoscillator.h:117
virtual bool render(uint32_t samplesToProcess=1) override
Renders audio from the noise generator object.
Definition: noiseoscillator.cpp:76
virtual bool update() override
Updates the output amplitude gain value.
Definition: noiseoscillator.cpp:60
Information about a MIDI note event (note on or note off).
Definition: synthstructures.h:212
See also Designing Software Synthesizers in C++ 2nd Ed. by Will Pirkle.