CabSim.h (1562B)
1 /* 2 ============================================================================== 3 4 CabSim 5 6 ============================================================================== 7 */ 8 #include "../JuceLibraryCode/JuceHeader.h" 9 10 #pragma once 11 12 //============================================================================== 13 class CabSim 14 { 15 public: 16 //============================================================================== 17 CabSim() = default; 18 19 //============================================================================== 20 void prepare (const juce::dsp::ProcessSpec& spec) 21 { 22 processorChain.prepare(spec); 23 } 24 25 //============================================================================== 26 template <typename ProcessContext> 27 void process(const ProcessContext& context) noexcept 28 { 29 processorChain.process(context); 30 } 31 32 //============================================================================== 33 void reset() noexcept 34 { 35 processorChain.reset(); 36 } 37 38 void load(File irFile) noexcept 39 { 40 auto& convolution = processorChain.template get<convolutionIndex>(); 41 convolution.loadImpulseResponse(irFile, 42 juce::dsp::Convolution::Stereo::yes, 43 juce::dsp::Convolution::Trim::no, 44 0); // Set to 0 to use the full size of IR with no trimming 45 } 46 47 private: 48 enum 49 { 50 convolutionIndex 51 }; 52 53 juce::dsp::ProcessorChain<juce::dsp::Convolution> processorChain; 54 55 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CabSim) 56 };