Audacity 3.2.0
TwoPassSimpleMono.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 TwoPassSimpleMono.h
6
7 Dominic Mazzoni
8
9 This bit by Martyn Shaw.
10
11**********************************************************************/
12#ifndef __AUDACITY_EFFECT_TWOPASSSIMPLEMONO__
13#define __AUDACITY_EFFECT_TWOPASSSIMPLEMONO__
14
15#include "StatefulEffect.h"
16
17class WaveChannel;
18
19class AUDACITY_DLL_API EffectTwoPassSimpleMono /* not final */
20 : public StatefulEffect
21{
22public:
24
25 // Effect implementation
26
27 bool Process(EffectInstance &instance, EffectSettings &settings) override;
28
29protected:
30 // EffectTwoPassSimpleMono implementation
31
34 virtual bool InitPass1();
35 virtual bool InitPass2();
36
37 // new virtuals
38
41 virtual bool NewTrackPass1();
42 virtual bool NewTrackPass2();
43
45 virtual bool ProcessPass1
46 (float * WXUNUSED(buffer), size_t WXUNUSED(len))
47 { return false; }
48
49 virtual bool ProcessPass2
50 (float * WXUNUSED(buffer), size_t WXUNUSED(len))
51 { return false; }
52
55
60 virtual bool TwoBufferProcessPass1(float *buffer1, size_t len1,
61 [[maybe_unused]] float *buffer2,
62 [[maybe_unused]] size_t len2)
63 {
64 if (buffer1)
65 return ProcessPass1(buffer1, len1);
66 else return true;
67 }
68 virtual bool TwoBufferProcessPass2(float *buffer1, size_t len1,
69 [[maybe_unused]] float * buffer2,
70 [[maybe_unused]] size_t len2)
71 {
72 if(buffer1)
73 return ProcessPass2(buffer1, len1);
74 else return true;
75 }
76
77 // End of new virtuals
78
80
83 void DisableSecondPass() { mSecondPassDisabled = true; }
84
85 // Other useful information
87 double mCurRate;
88 double mCurT0;
89 double mCurT1;
90 int mPass;
92
93 std::shared_ptr<TrackList> mWorkTracks;
94 TrackList *mTrackLists[2];
95
96private:
97 bool ProcessOne(WaveChannel &t, WaveChannel &outTrack,
99 bool ProcessPass(EffectSettings &settings);
100};
101
102#endif
static Settings & settings()
Definition: TrackInfo.cpp:69
Performs effect computation.
An Effect base class that implements a two pass process.
virtual bool ProcessPass1(float *WXUNUSED(buffer), size_t WXUNUSED(len))
Override this method to actually process audio.
virtual bool TwoBufferProcessPass2(float *buffer1, size_t len1, float *buffer2, size_t len2)
virtual bool ProcessPass2(float *WXUNUSED(buffer), size_t WXUNUSED(len))
virtual bool TwoBufferProcessPass1(float *buffer1, size_t len1, float *buffer2, size_t len2)
void DisableSecondPass()
Call this if you know in advance that no second pass will be needed.
~EffectTwoPassSimpleMono() override
std::shared_ptr< TrackList > mWorkTracks
virtual bool Process(EffectInstance &instance, EffectSettings &settings)=0
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:993
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
Externalized state of a plug-in.