-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathenginepregain.h
45 lines (38 loc) · 1.5 KB
/
enginepregain.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
#pragma once
#include "engine/engineobject.h"
#include "util/performancetimer.h"
class ControlAudioTaperPot;
class ControlPotmeter;
class ControlObject;
// The pregain control alters the volume of the track based on several inputs,
// including user pregain adjustment, ReplayGain value, and vinyl-like
// adjustments in volume relative to playback speed.
class EnginePregain : public EngineObject {
Q_OBJECT
public:
EnginePregain(const QString& group);
~EnginePregain() override;
// If the user is scratching and the record reverses direction, the volume
// will be ramped to zero and back up again to mimic a vinyl scratch.
// If the user is not scratching and the direction is reversed
// (e.g. reverse button is pressed), the audio will be immediately
// reversed without a ramp to zero.
void setSpeedAndScratching(double speed, bool scratching);
void process(CSAMPLE* pInOut, const std::size_t bufferSize) override;
void collectFeatures(GroupFeatureState* pGroupFeatures) const override;
private:
double m_dSpeed;
double m_dOldSpeed;
double m_dNonScratchSpeed;
bool m_scratching;
CSAMPLE_GAIN m_fPrevGain;
ControlAudioTaperPot* m_pPotmeterPregain;
ControlObject* m_pTotalGain;
ControlObject* m_pCOReplayGain;
ControlObject* m_pPassthroughEnabled;
static ControlPotmeter* s_pReplayGainBoost;
static ControlPotmeter* s_pDefaultBoost;
static ControlObject* s_pEnableReplayGain;
bool m_bSmoothFade;
PerformanceTimer m_timer;
};