Audacity 3.2.0
EchoBase.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 EchoBase.h
6
7 Dominic Mazzoni
8 Vaughan Johnson (dialog)
9
10**********************************************************************/
11#pragma once
12
13#include "MemoryX.h"
14#include "PerTrackEffect.h"
15#include "SettingsVisitor.h"
16#include <cfloat>
17
19
21{
22 static constexpr double delayDefault = 1.0;
23 static constexpr double decayDefault = 0.5;
24
25 double delay { delayDefault };
26 double decay { decayDefault };
27};
28
29class BUILTIN_EFFECTS_API EchoBase :
30 public EffectWithSettings<EchoSettings, PerTrackEffect>
31{
32public:
34
35 EchoBase();
36 virtual ~EchoBase();
37
38 // ComponentInterface implementation
39
40 ComponentInterfaceSymbol GetSymbol() const override;
41 TranslatableString GetDescription() const override;
42 ManualPageID ManualPage() const override;
43
44 // EffectDefinitionInterface implementation
45
46 EffectType GetType() const override;
47
48 struct BUILTIN_EFFECTS_API Instance :
51 {
52 Instance(const PerTrackEffect& effect)
53 : PerTrackEffect::Instance { effect }
54 {
55 }
56
57 bool ProcessInitialize(
59 ChannelNames chanMap) override;
60
61 size_t ProcessBlock(
62 EffectSettings& settings, const float* const* inBlock,
63 float* const* outBlock, size_t blockLen) override;
64
65 bool ProcessFinalize() noexcept override;
66
67 unsigned GetAudioOutCount() const override
68 {
69 return 1;
70 }
71
72 unsigned GetAudioInCount() const override
73 {
74 return 1;
75 }
76
78 size_t histPos;
79 size_t histLen;
80 };
81
82protected:
83 // EchoBase implementation
84 const EffectParameterMethods& Parameters() const override;
85
86#if 0
87 // TODO simplify like this in C++20
88 using ParametersType = CapturedParameters<EchoBase,
90 &EchoBase::delay, L"Delay", 1.0f, 0.001f, FLT_MAX, 1.0f }
92 &EchoBase::decay, L"Decay", 0.5f, 0.0f, FLT_MAX, 1.0f }
93 >;
94#else
95
96 static constexpr EffectParameter Delay { &EchoSettings::delay,
97 L"Delay",
99 0.001f,
100 FLT_MAX,
101 1.0f };
102 static constexpr EffectParameter Decay { &EchoSettings::decay,
103 L"Decay",
105 0.0f,
106 FLT_MAX,
107 1.0f };
108
109#endif
110};
EffectType
ChannelName
static Settings & settings()
Definition: TrackInfo.cpp:51
Generates EffectParameterMethods overrides from variadic template arguments.
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
static const ComponentInterfaceSymbol Symbol
Definition: EchoBase.h:33
Inherit to add a state variable to an EffectInstance subclass.
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.
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
Definition: EchoBase.h:72
Instance(const PerTrackEffect &effect)
Definition: EchoBase.h:52
double delay
Definition: EchoBase.h:25
static constexpr double delayDefault
Definition: EchoBase.h:22
static constexpr double decayDefault
Definition: EchoBase.h:23
double decay
Definition: EchoBase.h:26
Externalized state of a plug-in.