ofxPDSP
Decimator.h
1 
2 // Decimator.h
3 // ofxPDSP
4 // Nicola Pisanti, MIT License, 2016
5 
6 
7 #ifndef PDSP_SIGNAL_DECIMATOR_H_INCLUDED
8 #define PDSP_SIGNAL_DECIMATOR_H_INCLUDED
9 
10 
11 #include "../pdspCore.h"
12 
13 
14 namespace pdsp{
15 
20 class Decimator : public Unit {
21 
22 public:
23 
24  Decimator();
25 
31  Patchable& set(float freq);
32 
37 
38 
42  Patchable& in_freq();
43 
48 
49 private:
50  void prepareUnit( int expectedBufferSize, double sampleRate) override;
51  void releaseResources () override;
52  void process (int bufferSize) noexcept override ;
53 
54  template<bool pitchAR>
55  void process_audio(const float* inputBuffer, const float* freqBuffer, int bufferSize)noexcept;
56 
57  OutputNode output;
58  InputNode input_freq;
59  InputNode input_signal;
60 
61  float incCalculationMultiplier;
62  float phase;
63  float inc;
64  float sampled;
65 };
66 
67 
68 
69 }
70 
71 
72 #endif // PDSP_SIGNAL_DECIMATOR_H_INCLUDED
Patchable & out_signal()
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default outpu...
Definition: Decimator.cpp:34
Patchable & in_signal()
Sets "signal" as selected input and returns this Unit ready to be patched. This is the default input...
Definition: Decimator.cpp:26
Abstract class for implementing Units.
Definition: BasicNodes.h:223
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
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
Sample Rate Decimator, reduce the sample rate of the input signal. New sample rate frequency is a rea...
Definition: Decimator.h:20
Patchable & in_freq()
Sets "freq" as selected input and returns this Unit ready to be patched. This is the new sample rate...
Definition: Decimator.cpp:30