| 1 |
/* |
| 2 |
* Dragonfly Reverb, copyright (c) 2019 Michael Willis, Rob van den Berg |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU General Public License as |
| 6 |
* published by the Free Software Foundation; either version 3 of |
| 7 |
* the License, or any later version. |
| 8 |
* |
| 9 |
* This program is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* For a full copy of the GNU General Public License see the LICENSE file. |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef DRAGONFLY_REVERB_DSP_HPP_INCLUDED |
| 18 |
#define DRAGONFLY_REVERB_DSP_HPP_INCLUDED |
| 19 |
|
| 20 |
#include "AbstractDSP.hpp" |
| 21 |
#include "freeverb/earlyref.hpp" |
| 22 |
#include "freeverb/progenitor2.hpp" |
| 23 |
|
| 24 |
class DragonflyReverbDSP : public AbstractDSP { |
| 25 |
public: |
| 26 |
DragonflyReverbDSP(double sampleRate); |
| 27 |
float getParameterValue(uint32_t index) const; |
| 28 |
void setParameterValue(uint32_t index, float value); |
| 29 |
void run(const float** inputs, float** outputs, uint32_t frames); |
| 30 |
void sampleRateChanged(double newSampleRate); |
| 31 |
void mute(); |
| 32 |
|
| 33 |
private: |
| 34 |
float oldParams[paramCount]; |
| 35 |
float newParams[paramCount]; |
| 36 |
|
| 37 |
double sampleRate; |
| 38 |
|
| 39 |
float dryLevel = 0.0; |
| 40 |
float earlyLevel = 0.0; |
| 41 |
float early_send = 0.0; |
| 42 |
float lateLevel = 0.0; |
| 43 |
|
| 44 |
fv3::iir_1st_f input_lpf_0, input_lpf_1, input_hpf_0, input_hpf_1; |
| 45 |
|
| 46 |
fv3::earlyref_f early; |
| 47 |
fv3::progenitor2_f late; |
| 48 |
|
| 49 |
static const uint32_t BUFFER_SIZE = 256; |
| 50 |
float filtered_input_buffer[2][BUFFER_SIZE]; |
| 51 |
float early_out_buffer[2][BUFFER_SIZE]; |
| 52 |
float late_in_buffer[2][BUFFER_SIZE]; |
| 53 |
float late_out_buffer[2][BUFFER_SIZE]; |
| 54 |
|
| 55 |
void setInputLPF(float freq); |
| 56 |
void setInputHPF(float freq); |
| 57 |
}; |
| 58 |
|
| 59 |
#endif |