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 "SimpleMono.h"
16
17
18class WaveTrack;
19
20class AUDACITY_DLL_API EffectTwoPassSimpleMono /* not final */
21 : public StatefulEffect
22{
23public:
24 // Effect implementation
25
26 bool Process(EffectInstance &instance, EffectSettings &settings) override;
27
28protected:
29 // EffectTwoPassSimpleMono implementation
30
31 // Override these methods if you need to initialize something
32 // before each pass. Return None if processing should stop.
33 // These should not depend on mOutputTracks having been set up via CopyInputTracks().
34 virtual bool InitPass1();
35 virtual bool InitPass2();
36
37 // NEW virtuals
38
39 // Override these methods if you need to do things
40 // before every track (including the first one)
41 virtual bool NewTrackPass1();
42 virtual bool NewTrackPass2();
43
44 // Override this method to actually process audio
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
53 // Override this method to actually process audio with access to 2 sequential buffers at a time
54 // Either buffer1 or buffer2 may be modified as needed
55 // This allows implementation of processing with delays
56 // The default just calls the one-buffer-at-a-time method
58 (float *buffer1, size_t len1, float * WXUNUSED(buffer2), size_t WXUNUSED(len2))
59 { if(buffer1 != NULL) return ProcessPass1(buffer1, len1); else return true; }
61 (float *buffer1, size_t len1, float * WXUNUSED(buffer2), size_t WXUNUSED(len2))
62 { if(buffer1 != NULL) return ProcessPass2(buffer1, len1); else return true; }
63
64 // End of NEW virtuals
65
66 // Call this if you know in advance that no second pass will be needed.
67 // This is used as a hint for the progress bar
68 void DisableSecondPass() { mSecondPassDisabled = true; }
69
70 // Other useful information
72 double mCurRate;
73 double mCurT0;
74 double mCurT1;
76 int mPass;
78
79 std::shared_ptr<TrackList> mWorkTracks;
80 std::shared_ptr<TrackList> *mTrackLists[2];
81
82private:
83 bool ProcessOne(WaveTrack * t, WaveTrack * outTrack,
85 bool ProcessPass(EffectSettings &settings);
86};
87
88#endif
static Settings & settings()
Definition: TrackInfo.cpp:83
Performs effect computation.
An Effect base class that implements a two pass process by using EffectSimpleMono.
virtual bool ProcessPass1(float *WXUNUSED(buffer), size_t WXUNUSED(len))
virtual bool TwoBufferProcessPass1(float *buffer1, size_t len1, float *WXUNUSED(buffer2), size_t WXUNUSED(len2))
virtual bool ProcessPass2(float *WXUNUSED(buffer), size_t WXUNUSED(len))
virtual bool TwoBufferProcessPass2(float *buffer1, size_t len1, float *WXUNUSED(buffer2), size_t WXUNUSED(len2))
std::shared_ptr< TrackList > mWorkTracks
virtual bool Process(EffectInstance &instance, EffectSettings &settings)=0
A Track that contains audio waveform data.
Definition: WaveTrack.h:51
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.