Repository navigation
Expand file tree
/
Copy pathEffects.cpp
More file actions
73 lines (65 loc) · 1.78 KB
/
Copy pathEffects.cpp
File metadata and controls
73 lines (65 loc) · 1.78 KB
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
68
69
70
71
72
73
#include "effects.h"
#include "parameters.h"
#include "reverb.h"
FXParam fx;
using P = ParamUnitName;
float driveGainCompensation = 0.0f;
const char *effectLabels[] = {
" - ",
"Drive",
"Chorus",
"Comp",
"Reverb"};
// Реалізація функцій
void EffectsInit(float samplerate)
{
fx.drive.Init();
fx.chorus.Init(samplerate);
fx.reverb.Init(samplerate);
fx.compressor.Init(samplerate);
}
void ProcessEffectsReverb(float inL, float inR, float &outL, float &outR)
{
fx.reverb.Process(inL, inR, &outL, &outR);
}
void ProcessEffects(uint8_t slot, float inL, float inR, float &outL, float &outR)
{
if (!currentPreset.effectSlots[slot].isActive)
{
outL = inL;
outR = inR;
return;
}
else
{
float dryWet = paramManager.GetValue(EFFECT_SLOT_DRYWET[slot]);
switch (currentPreset.effectSlots[slot].selectedEffect)
{
case EFFECT_OVERDRIVE:
outL = (fx.drive.Process(inL) + driveGainCompensation) * dryWet + (inL * (1 - dryWet));
outR = outL;
break;
case EFFECT_CHORUS:
outL = fx.chorus.Process(inL);
outR = fx.chorus.Process(inR);
outL = inL + (outL * dryWet);
outR = inR + (outR * dryWet);
break;
case EFFECT_COMPRESSOR:
outL = fx.compressor.Process(inL) * dryWet + (inL * (1 - dryWet));
outR = outL;
break;
case EFFECT_REVERB:
ProcessEffectsReverb(inL, inR, outL, outR);
outL = inL + (outL * dryWet);
outR = inR + (outR * dryWet);
break;
case EFFECT_NONE:
outL = inL;
outR = inR;
break;
default:
break;
}
}
}