ofxPDSP
Oscillator.h
1 
2 // Oscillator.h
3 // ofxPDSP
4 // Nicola Pisanti, MIT License, 2016
5 
6 
7 #ifndef PDSP_OSC_OSCILLATOR_H_INCLUDED
8 #define PDSP_OSC_OSCILLATOR_H_INCLUDED
9 
10 #include "../../pdspCore.h"
11 
12 namespace pdsp{
13 
20 class Oscillator : public Unit{
21 public:
22 
23  Oscillator();
24 
25 
30 
35 
39  float meter_output() const;
40 
41 protected:
46  virtual void prepareOscillator(double sampleRate);
47 
51  virtual void releaseOscillator();
52 
59  virtual void oscillate(float* outputBuffer, const float* phaseBuffer, int bufferSize) noexcept;
60 
61 private:
62  void prepareUnit( int expectedBufferSize, double sampleRate) override;
63  void releaseResources() override;
64  void process(int bufferSize) noexcept override;
65 
66  InputNode input_phase;
67  OutputNode output;
68 
69  std::atomic<float> meter;
70 };
71 
72 }
73 
74 
75 
76 
77 
78 #endif // PDSP_OSC_OSCILLATOR_H_INCLUDED
Patchable & out_signal()
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default outpu...
Definition: Oscillator.cpp:23
Abstract class to implement oscillators.
Definition: Oscillator.h:20
virtual void oscillate(float *outputBuffer, const float *phaseBuffer, int bufferSize) noexcept
the oscillator DSP method to implement
Definition: Oscillator.cpp:29
float meter_output() const
Returns the first value of the last processed output. Usually is more useful to track when the oscill...
Definition: Oscillator.cpp:15
Abstract class for implementing Units.
Definition: BasicNodes.h:223
virtual void releaseOscillator()
method to implement for cleaning up on resource release, overriding it is not mandatory ...
Definition: Oscillator.cpp:28
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
Patchable & in_phase()
Sets "phase" as selected input and returns this Unit ready to be patched. This is the default input...
Definition: Oscillator.cpp:19
virtual void prepareOscillator(double sampleRate)
method to implement for preparing oscillator to play, overriding it is not mandatory ...
Definition: Oscillator.cpp:27
Input of a Unit, process all the connected Outputs and sum them. Has an internal variable state...
Definition: BasicNodes.h:536
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
Output of a Unit, contains a buffer of rendered floats and has a variable state flag.
Definition: BasicNodes.h:354