Audacity 3.2.0
PerTrackEffect.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 PerTrackEffect.h
6
7 Dominic Mazzoni
8 Vaughan Johnson
9
10 Paul Licameli split from Effect.h
11
12**********************************************************************/
13
14#ifndef __AUDACITY_PER_TRACK_EFFECT__
15#define __AUDACITY_PER_TRACK_EFFECT__
16
17#include "AudioGraphSink.h" // to inherit
18#include "AudioGraphSource.h" // to inherit
19#include "Effect.h" // to inherit
20#include "MemoryX.h"
21#include "SampleCount.h"
22#include <functional>
23
26
33class EFFECTS_API PerTrackEffect
34 : public Effect
35{
36public:
37 ~PerTrackEffect() override;
38
39 class EFFECTS_API Instance : public virtual EffectInstanceEx {
40 public:
41 explicit Instance(const PerTrackEffect &processor)
42 : mProcessor{ processor }
43 {}
44 ~Instance() override;
45
47 bool Process(EffectSettings &settings) final;
48
49 bool ProcessInitialize(EffectSettings &settings,
50 double sampleRate, ChannelNames chanMap) override;
51
52 bool ProcessFinalize() noexcept override;
53 protected:
54 const PerTrackEffect &mProcessor;
55 };
56
57protected:
58 // These were overridables but the generality wasn't used yet
59 /* virtual */ bool DoPass1() const;
60 /* virtual */ bool DoPass2() const;
61
62 // non-virtual
63 bool Process(EffectInstance &instance, EffectSettings &settings) const;
64
65 sampleCount mSampleCnt{};
66
67private:
69
70 bool ProcessPass(Instance &instance, EffectSettings &settings);
71 using Factory = std::function<std::shared_ptr<EffectInstance>()>;
80 static bool ProcessTrack(bool multi,
83 std::optional<sampleCount> genLength,
84 double sampleRate, const Track &track,
85 Buffers &inBuffers, Buffers &outBuffers);
86};
87#endif
ChannelName
static Settings & settings()
Definition: TrackInfo.cpp:83
Accumulates (non-interleaved) data during effect processing.
Downstream receiver of sample streams, taking Buffers as external context.
Upstream producer of sample streams, taking Buffers as external context.
Base class for many of the effects in Audacity.
Definition: Effect.h:26
Performs effect computation.
Definition: EffectPlugin.h:96
Performs effect computation.
Instance(const PerTrackEffect &processor)
Base class for many of the effects in Audacity.
~PerTrackEffect() override
std::function< std::shared_ptr< EffectInstance >()> Factory
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:162
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19
static RegisteredToolbarFactory factory
Externalized state of a plug-in.