Audacity 3.2.0
StatefulPerTrackEffect.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 StatefulPerTrackEffect.h
6
7 Dominic Mazzoni
8 Vaughan Johnson
9
10 Paul Licameli split from PerTrackEffect.h
11
12**********************************************************************/
13
14#ifndef __AUDACITY_STATEFUL_PER_TRACK_EFFECT__
15#define __AUDACITY_STATEFUL_PER_TRACK_EFFECT__
16
17#include "PerTrackEffect.h" // to inherit
18#include "StatefulEffectBase.h" // to inherit
19
22class EFFECTS_API StatefulPerTrackEffect :
23 public StatefulEffectBase,
24 public PerTrackEffect
25{
26public:
27
30 class EFFECTS_API Instance :
33 {
34 public:
36 : StatefulEffectBase::Instance{ effect }
37 , PerTrackEffect::Instance{ effect }
38 {}
39 ~Instance() override;
41 ChannelNames chanMap) override;
42 bool ProcessFinalize() noexcept override;
43 size_t ProcessBlock(EffectSettings &settings,
44 const float *const *inBlock, float *const *outBlock, size_t blockLen)
45 override;
46
47 protected:
48 StatefulPerTrackEffect &GetEffect() const
49 {
50 // Tolerate const_cast in this class while it sun-sets
51 return static_cast<StatefulPerTrackEffect &>(
52 const_cast<PerTrackEffect &>(mProcessor));
53 }
54 };
55
57
58 std::shared_ptr<EffectInstance> MakeInstance() const override;
59
60 size_t SetBlockSize(size_t maxBlockSize) override;
61 size_t GetBlockSize() const override;
62
67 ChannelNames chanMap = nullptr) override;
68
72 bool ProcessFinalize() noexcept override;
73
77 virtual size_t ProcessBlock(EffectSettings &settings,
78 const float *const *inBlock, float *const *outBlock, size_t blockLen) = 0;
79
80private:
81 bool Process(EffectInstance &instance, EffectSettings &settings) final;
82
83 size_t mBlockSize{};
84};
85
86#endif
ChannelName
static Settings & settings()
Definition: TrackInfo.cpp:51
virtual std::shared_ptr< EffectInstance > MakeInstance() const =0
Make an object maintaining short-term state of an Effect.
Performs effect computation.
Base class for many of the effects in Audacity.
Calls through to members of StatefulEffectBase.
virtual bool ProcessFinalize() noexcept
virtual size_t GetBlockSize() const
virtual size_t SetBlockSize(size_t maxBlockSize)
virtual bool ProcessInitialize(EffectSettings &settings, double sampleRate, ChannelNames chanMap=nullptr)
Instance(StatefulPerTrackEffect &effect)
Base class for many of the effects in Audacity.
~StatefulPerTrackEffect() override
Externalized state of a plug-in.