1 // Ported from CAPS Reverb.
2 // This effect is GPL code.
3 
4 #pragma once
5 
6 #include <QMap>
7 
8 #include <Reverb.h>
9 
10 #include "effects/effectprocessor.h"
11 #include "engine/effects/engineeffect.h"
12 #include "engine/effects/engineeffectparameter.h"
13 #include "util/class.h"
14 #include "util/defs.h"
15 #include "util/sample.h"
16 #include "util/types.h"
17 
18 class ReverbGroupState : public EffectState {
19   public:
ReverbGroupState(const mixxx::EngineParameters & bufferParameters)20     ReverbGroupState(const mixxx::EngineParameters& bufferParameters)
21         : EffectState(bufferParameters),
22           sendPrevious(0) {
23     }
24 
engineParametersChanged(const mixxx::EngineParameters & bufferParameters)25     void engineParametersChanged(const mixxx::EngineParameters& bufferParameters) {
26         sampleRate = bufferParameters.sampleRate();
27         sendPrevious = 0;
28     }
29 
30     float sampleRate;
31     float sendPrevious;
32     MixxxPlateX2 reverb{};
33 };
34 
35 class ReverbEffect : public EffectProcessorImpl<ReverbGroupState> {
36   public:
37     ReverbEffect(EngineEffect* pEffect);
38     virtual ~ReverbEffect();
39 
40     static QString getId();
41     static EffectManifestPointer getManifest();
42 
43     // See effectprocessor.h
44     void processChannel(const ChannelHandle& handle,
45                         ReverbGroupState* pState,
46                         const CSAMPLE* pInput, CSAMPLE* pOutput,
47                         const mixxx::EngineParameters& bufferParameters,
48                         const EffectEnableState enableState,
49                         const GroupFeatureState& groupFeatures);
50 
51   private:
debugString()52     QString debugString() const {
53         return getId();
54     }
55 
56     EngineEffectParameter* m_pDecayParameter;
57     EngineEffectParameter* m_pBandWidthParameter;
58     EngineEffectParameter* m_pDampingParameter;
59     EngineEffectParameter* m_pSendParameter;
60 
61     DISALLOW_COPY_AND_ASSIGN(ReverbEffect);
62 };
63