AnalogTapeModel

Physical modelling signal processing for analog tape recording
Log | Files | Refs | Submodules | README | LICENSE

DegradeProcessor.h (1366B)


      1 #ifndef DEGRADEPROCESSOR_H_INCLUDED
      2 #define DEGRADEPROCESSOR_H_INCLUDED
      3 
      4 #include "../BypassProcessor.h"
      5 #include "../GainProcessor.h"
      6 #include "DegradeFilter.h"
      7 #include "DegradeNoise.h"
      8 
      9 class DegradeProcessor
     10 {
     11 public:
     12     DegradeProcessor (AudioProcessorValueTreeState& vts);
     13 
     14     static void createParameterLayout (chowdsp::Parameters& params);
     15 
     16     void cookParams();
     17     void prepareToPlay (double sampleRate, int samplesPerBlock, int numChannels);
     18     void processBlock (AudioBuffer<float>& buffer);
     19 
     20 private:
     21     void processShortBlock (AudioBuffer<float>& buffer);
     22 
     23     std::atomic<float>* point1xParam = nullptr;
     24     std::atomic<float>* onOffParam = nullptr;
     25     chowdsp::FloatParameter* depthParam = nullptr;
     26     chowdsp::FloatParameter* amtParam = nullptr;
     27     chowdsp::FloatParameter* varParam = nullptr;
     28     chowdsp::FloatParameter* envParam = nullptr;
     29 
     30     std::vector<DegradeFilter> filterProc;
     31     GainProcessor gainProc;
     32 
     33     AudioBuffer<float> noiseBuffer;
     34     std::vector<DegradeNoise> noiseProc;
     35 
     36     AudioBuffer<float> levelBuffer;
     37     chowdsp::LevelDetector<float> levelDetector;
     38 
     39     Random random;
     40 
     41     float fs = 44100.0f;
     42 
     43     BypassProcessor bypass;
     44 
     45     static constexpr int smallBlockSize = 2048;
     46     int sampleCounter = 0;
     47 
     48     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DegradeProcessor)
     49 };
     50 
     51 #endif // DEGRADEPROCESSOR_H_INCLUDED