AnalogTapeModel

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

CompressionProcessor.h (1169B)


      1 #ifndef COMPRESSIONPROCESSOR_H_INCLUDED
      2 #define COMPRESSIONPROCESSOR_H_INCLUDED
      3 
      4 #include "../BypassProcessor.h"
      5 #include <xsimd/xsimd.hpp>
      6 
      7 class CompressionProcessor
      8 {
      9 public:
     10     CompressionProcessor (AudioProcessorValueTreeState& vts);
     11 
     12     static void createParameterLayout (chowdsp::Parameters& params);
     13 
     14     void prepare (double sr, int samplesPerBlock, int numChannels);
     15     void processBlock (AudioBuffer<float>& buffer);
     16 
     17     float getLatencySamples() const noexcept;
     18 
     19 private:
     20     std::atomic<float>* onOff = nullptr;
     21     chowdsp::FloatParameter* amountParam = nullptr;
     22     chowdsp::FloatParameter* attackParam = nullptr;
     23     chowdsp::FloatParameter* releaseParam = nullptr;
     24 
     25     std::vector<chowdsp::LevelDetector<float>> slewLimiter;
     26     BypassProcessor bypass;
     27 
     28     std::unique_ptr<dsp::Oversampling<float>> oversample;
     29 
     30     std::vector<SmoothedValue<float, ValueSmoothingTypes::Linear>> dbPlusSmooth;
     31 
     32     std::vector<float, xsimd::aligned_allocator<float>> xDBVec;
     33     std::vector<float, xsimd::aligned_allocator<float>> compGainVec;
     34 
     35     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CompressionProcessor)
     36 };
     37 
     38 #endif // COMPRESSIONPROCESSOR_H_INCLUDED