quantumVERB  1.0.0
A FOSS convolution reverb plugin
PluginProcessor.h
1 /*
2  ==============================================================================
3 
4  This file was auto-generated!
5 
6  It contains the basic framework code for a JUCE plugin processor.
7 
8  ==============================================================================
9 */
10 
11 #pragma once
12 
13 #include "JuceHeader.h"
14 
15 #include "IRBank.h"
16 #include "IRPipeline.h"
17 #include "MainPipeline.h"
18 
19 #include <map>
20 #include <mutex>
21 #include <vector>
22 
23 namespace reverb
24 {
25 
26  //==============================================================================
27  /**
28  * Main reverb audio processor class. Contains all processing steps and provides a user-
29  * facing editor for parameter adjustment.
30  */
32  {
33  public:
34  //==============================================================================
36  ~AudioProcessor();
37 
38  //==============================================================================
39  void prepareToPlay(double sampleRate, int samplesPerBlock) override;
41 
42 #ifndef JucePlugin_PreferredChannelConfigurations
44 #endif
45 
46  void processBlock(juce::AudioSampleBuffer& audio, juce::MidiBuffer&) override;
47 
48  void processBlockBypassed(juce::AudioSampleBuffer& audio, juce::MidiBuffer& midi) override;
49 
50  //==============================================================================
51  juce::AudioProcessorEditor* createEditor() override;
52  bool hasEditor() const override;
53 
54  //==============================================================================
55  const juce::String getName() const override;
56 
57  bool acceptsMidi() const override;
58  bool producesMidi() const override;
59  bool isMidiEffect() const override;
60  double getTailLengthSeconds() const override;
61 
62  //==============================================================================
63  int getNumPrograms() override;
64  int getCurrentProgram() override;
65  void setCurrentProgram(int index) override;
66  const juce::String getProgramName(int index) override;
67  void changeProgramName(int index, const juce::String& newName) override;
68 
69  //==============================================================================
70  void getStateInformation(juce::MemoryBlock& destData) override;
71  void setStateInformation(const void* data, int sizeInBytes) override;
72 
73  //==============================================================================
74  juce::AudioProcessorValueTreeState parameters;
75 
76  // Unique parameter IDs
77  static constexpr const char * PID_ACTIVE = "is_active";
78 
79  static constexpr const char * PID_IR_FILE_CHOICE = "ir_file_choice";
80  static constexpr const char * PID_IR_LENGTH = "ir_length";
81 
82  static constexpr const char * PID_FILTER_PREFIX = "filter";
83  static constexpr const char * PID_FILTER_FREQ_SUFFIX = "_freq";
84  static constexpr const char * PID_FILTER_Q_SUFFIX = "_q";
85  static constexpr const char * PID_FILTER_GAIN_SUFFIX = "_gain";
86 
87  static constexpr const char * PID_PREDELAY = "predelay";
88  static constexpr const char * PID_IR_GAIN = "ir_gain";
89  static constexpr const char * PID_WETRATIO = "wetratio";
90  static constexpr const char * PID_AUDIO_OUT_GAIN = "audio_out_gain";
91 
92  //==============================================================================
93  std::vector<IRPipeline::Ptr> irPipelines;
94  std::vector<MainPipeline::Ptr> mainPipelines;
95 
96  std::mutex updatingParams;
97 
98 
99  protected:
100  //==============================================================================
101  void initParams();
102  bool paramsInitialised = false;
103 
104  //==============================================================================
105  static constexpr int NUM_BLOCKS_PER_UPDATE_PARAMS = 5;
106  int64_t blocksProcessed = 0;
107 
108  void updateParams(double sampleRate);
109  void updateParamsForChannel(int channelIdx, double sampleRate);
110 
111  //==============================================================================
112  void processChannel(int channelIdx);
113 
114  AudioBlock audioChannels;
115 
116  private:
117  //==============================================================================
119  };
120 
121 }
float getParam(const juce::AudioProcessorValueTreeState &params, const juce::String &blockId) const
Internal method used to get (and check) a parameter&#39;s value.
Definition: Task.h:111
void updateParams(double sampleRate)
Update parameters across all channels.
void processChannel(int channelIdx)
Applies reverb effect on single channel using preconfigured pipelines.
void updateParamsForChannel(int channelIdx, double sampleRate)
Update parameters for a given channel.
void prepareToPlay(double sampleRate, int samplesPerBlock) override
Prepare the processor before playback starts.
void releaseResources() override
Release resource when playback stops.
AudioProcessor()
Constructs a reverb audio processor & initialises its inner pipelines.
void processBlock(juce::AudioSampleBuffer &audio, juce::MidiBuffer &) override
Applies reverb effect on audio buffer using parameters given through the editor.