-
Notifications
You must be signed in to change notification settings - Fork 0
/
Comprezz.h
67 lines (53 loc) · 1.32 KB
/
Comprezz.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
#include "IPlug_include_in_plug_hdr.h"
#include "IControls.h"
#include <detector.h>
#include <dynamics.h>
#include "PatternMeter.h"
#include "DelayLine.h"
#include "delay_line.h"
const int kNumPresets = 3;
enum EParams
{
kGain = 0,
kRatio,
kThreshold,
kAttackMs, // Attack time in ms
kReleaseMs, // Release time in ms
kStereoLink,
kLookAhead,
kKneeWidth,
kNumParams
};
enum EControlTags
{
kCtrlTagGrMeter = 0,
kCtrlTagScMeter,
kCtrlTagOutMeter,
kCtrlTags
};
using namespace iplug;
using namespace igraphics;
class Comprezz final : public Plugin
{
public:
Comprezz(const InstanceInfo& info);
void OnParamChange(int paramIdx) override;
void OnReset() override;
#if IPLUG_DSP // http://bit.ly/2S64BDd
void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override;
void OnIdle() override;
private:
double linearGain = 0.;
IPeakSender<2> grMeterSender;
IPeakSender<2> scMeterSender;
IPeakSender<2> outMeterSender;
// TODO This fixed size does not support 96000 sampleRate, should be dynamic
std::array<DelayLine<8192>, 2> delays;
std::vector<dsptk::Compressor> compressors;
std::vector<dsptk::DecoupledPeakDetector> scDetectors;
std::vector<dsptk::DecoupledPeakDetector> outDetectors;
void ClearDelaySamples();
void UpdateDelaySamples();
#endif
};