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