Audacity 3.2.0
BassTrebleBase.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4 Audacity(R) is copyright (c) 1999-2016 Audacity Team.
5 License: GPL v2 or later. See License.txt.
6
7 BassTrebleBase.h (two shelf filters)
8 Steve Daulton
9
10**********************************************************************/
11#pragma once
12
13#include "PerTrackEffect.h"
14#include "SettingsVisitor.h"
15
16// Used to communicate the type of the filter.
18{
21};
22
24{
25public:
27 double treble;
28 double bass;
29 double gain;
35};
36
38{
39 static constexpr double bassDefault = 0.0;
40 static constexpr double trebleDefault = 0.0;
41 static constexpr double gainDefault = 0.0;
42 static constexpr bool linkDefault = false;
43
44 double mBass { bassDefault };
46 double mGain { gainDefault };
48};
49
50class BUILTIN_EFFECTS_API BassTrebleBase :
51 public EffectWithSettings<BassTrebleSettings, PerTrackEffect>
52{
53public:
55
57 virtual ~BassTrebleBase();
58
59 // ComponentInterface implementation
60
61 ComponentInterfaceSymbol GetSymbol() const override;
62 TranslatableString GetDescription() const override;
63 ManualPageID ManualPage() const override;
64
65 // EffectDefinitionInterface implementation
66
67 EffectType GetType() const override;
68 RealtimeSince RealtimeSupport() const override;
69
70 // Effect Implementation
71
72 bool CheckWhetherSkipEffect(const EffectSettings& settings) const override;
73
74 struct BUILTIN_EFFECTS_API Instance :
77 {
78 explicit Instance(const PerTrackEffect& effect)
79 : PerTrackEffect::Instance { effect }
80 {
81 }
82
83 bool ProcessInitialize(
85 ChannelNames chanMap) override;
86
87 size_t ProcessBlock(
88 EffectSettings& settings, const float* const* inBlock,
89 float* const* outBlock, size_t blockLen) override;
90
91 bool RealtimeInitialize(EffectSettings& settings, double) override;
92
93 bool RealtimeAddProcessor(
95 unsigned numChannels, float sampleRate) override;
96
97 bool RealtimeFinalize(EffectSettings& settings) noexcept override;
98
99 size_t RealtimeProcess(
100 size_t group, EffectSettings& settings, const float* const* inbuf,
101 float* const* outbuf, size_t numSamples) override;
102
103 unsigned GetAudioInCount() const override;
104 unsigned GetAudioOutCount() const override;
105
106 static void InstanceInit(
108
109 static size_t InstanceProcess(
111 const float* const* inBlock, float* const* outBlock, size_t blockLen);
112
113 static void Coefficients(
114 double hz, double slope, double gain, double samplerate, int type,
115 double& a0, double& a1, double& a2, double& b0, double& b1,
116 double& b2);
117
118 static float DoFilter(BassTrebleState& data, float in);
119
121 std::vector<BassTrebleBase::Instance> mSlaves;
122 };
123
124protected:
125 const EffectParameterMethods& Parameters() const override;
126
128 L"Bass",
130 -30.0,
131 30.0,
132 1 };
133
135 L"Treble",
137 -30.0,
138 30.0,
139 1 };
140
142 L"Gain",
144 -30.0,
145 30.0,
146 1 };
147
149 L"Link Sliders",
151 false,
152 true,
153 1 };
154};
kShelfType
@ kBass
@ kTreble
EffectType
ChannelName
static Settings & settings()
Definition: TrackInfo.cpp:51
static const ComponentInterfaceSymbol Symbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
RealtimeSince
In which versions of Audacity was an effect realtime capable?
Inherit to add a state variable to an EffectInstance subclass.
Hold values to send to effect output meters.
Interface for manipulations of an Effect's settings.
Base class for many of the effects in Audacity.
Holds a msgid for the translation catalog; may also bind format arguments.
Instance(const PerTrackEffect &effect)
std::vector< BassTrebleBase::Instance > mSlaves
static constexpr double gainDefault
static constexpr double bassDefault
static constexpr bool linkDefault
static constexpr double trebleDefault
Externalized state of a plug-in.