Audacity 3.2.0
DynamicRangeProcessorTypes.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 DynamicRangeProcessorTypes.h
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11#pragma once
12
13#include "LockFreeQueue.h"
14#include <array>
15#include <limits>
16#include <memory>
17#include <vector>
18
20{
21 long long indexOfFirstSample = 0;
22 int numSamples = 0;
25 float inputDb = 0;
26 float outputDb = 0;
27};
28
31
33{
35 float outputDb = std::numeric_limits<float>::lowest();
36};
37
39
41{
44 {
45 }
46 double sampleRate;
47};
48
50{
51};
52
53static constexpr auto compressorMeterUpdatePeriodMs = 1000 / 30;
54
55constexpr double compressorThresholdDbDefault = -10;
56constexpr double compressorMakeupGainDbDefault = 0;
57constexpr double compressorKneeWidthDbDefault = 5;
59constexpr double compressorLookaheadMsDefault = 1;
60constexpr double compressorAttackMsDefault = 30;
61constexpr double compressorReleaseMsDefault = 150;
62constexpr double compressorMaxLookaheadMs = 1000.;
63
64constexpr double limiterThresholdDbDefault = -5;
65constexpr double limiterMakeupTargetDbDefault = -1;
66constexpr double limiterKneeWidthDbDefault = 2;
67constexpr double limiterLookaheadMsDefault = 1;
68constexpr double limiterReleaseMsDefault = 20;
69constexpr double limiterMaxLookaheadMs = 50;
70
71constexpr double showInputDefault = 0;
72constexpr double showOutputDefault = 1;
73constexpr double showActualDefault = 1;
74constexpr double showTargetDefault = 0;
75
77{
89};
90
92{
102};
103
105{
107 : inCompressionThreshDb { compressorSettings.thresholdDb }
108 , outCompressionThreshDb { compressorSettings.thresholdDb +
109 compressorSettings.makeupGainDb }
110 , kneeWidthDb { compressorSettings.kneeWidthDb }
111 , compressionRatio { compressorSettings.compressionRatio }
112 , lookaheadMs { compressorSettings.lookaheadMs }
113 , attackMs { compressorSettings.attackMs }
114 , releaseMs { compressorSettings.releaseMs }
115 , showInput { compressorSettings.showInput }
116 , showOutput { compressorSettings.showOutput }
117 , showActual { compressorSettings.showActual }
118 , showTarget { compressorSettings.showTarget }
119 {
120 }
121
123 : inCompressionThreshDb { limiterSettings.thresholdDb }
124 , outCompressionThreshDb { limiterSettings.makeupTargetDb }
125 , kneeWidthDb { limiterSettings.kneeWidthDb }
126 , compressionRatio { std::numeric_limits<double>::infinity() }
127 , lookaheadMs { limiterSettings.lookaheadMs }
128 , attackMs { 0. }
129 , releaseMs { limiterSettings.releaseMs }
130 , showInput { limiterSettings.showInput }
131 , showOutput { limiterSettings.showOutput }
132 , showActual { limiterSettings.showActual }
133 , showTarget { limiterSettings.showTarget }
134 {
135 }
136
142 double attackMs;
143 double releaseMs;
144 double showInput;
148};
149
150constexpr bool operator==(
153{
156 lhs.kneeWidthDb == rhs.kneeWidthDb &&
158 lhs.lookaheadMs == rhs.lookaheadMs && lhs.attackMs == rhs.attackMs &&
159 lhs.releaseMs == rhs.releaseMs && lhs.showInput == rhs.showInput &&
160 lhs.showOutput == rhs.showOutput &&
161 lhs.showActual == rhs.showActual && lhs.showTarget == rhs.showTarget;
162}
163
164constexpr bool operator!=(
167{
168 return !(lhs == rhs);
169}
constexpr bool operator!=(const DynamicRangeProcessorSettings &lhs, const DynamicRangeProcessorSettings &rhs)
constexpr double compressorThresholdDbDefault
constexpr double compressorLookaheadMsDefault
constexpr double compressorMakeupGainDbDefault
constexpr double showOutputDefault
constexpr double compressorMaxLookaheadMs
constexpr double compressorAttackMsDefault
constexpr double limiterReleaseMsDefault
constexpr double compressorKneeWidthDbDefault
constexpr double showInputDefault
constexpr double compressorCompressionRatioDefault
constexpr double showActualDefault
static constexpr auto compressorMeterUpdatePeriodMs
constexpr double limiterThresholdDbDefault
constexpr bool operator==(const DynamicRangeProcessorSettings &lhs, const DynamicRangeProcessorSettings &rhs)
constexpr double limiterKneeWidthDbDefault
constexpr double showTargetDefault
constexpr double limiterMaxLookaheadMs
constexpr double limiterMakeupTargetDbDefault
constexpr double limiterLookaheadMsDefault
constexpr double compressorReleaseMsDefault
STL namespace.
DynamicRangeProcessorSettings(const LimiterSettings &limiterSettings)
DynamicRangeProcessorSettings(const CompressorSettings &compressorSettings)