Audacity 3.2.0
Classes | Public Member Functions | Public Attributes | List of all members
MyTransformer Struct Reference
Inheritance diagram for MyTransformer:
[legend]
Collaboration diagram for MyTransformer:
[legend]

Classes

struct  MyWindow
 

Public Member Functions

 MyTransformer (EffectNoiseReduction::Worker &worker, WaveChannel *pOutputTrack, bool needsOutput, eWindowFunctions inWindowType, eWindowFunctions outWindowType, size_t windowSize, unsigned stepsPerWindow, bool leadingPadding, bool trailingPadding)
 
MyWindowNthWindow (int nn)
 
std::unique_ptr< WindowNewWindow (size_t windowSize) override
 Allocates a window to place in the queue. More...
 
bool DoStart () override
 Called before any calls to ProcessWindow. More...
 
bool DoFinish () override
 Called after the last call to ProcessWindow(). More...
 
- Public Member Functions inherited from TrackSpectrumTransformer
 TrackSpectrumTransformer (WaveChannel *pOutputTrack, bool needsOutput, eWindowFunctions inWindowType, eWindowFunctions outWindowType, size_t windowSize, unsigned stepsPerWindow, bool leadingPadding, bool trailingPadding)
 
 ~TrackSpectrumTransformer () override
 
bool Process (const WindowProcessor &processor, const WaveChannel &channel, size_t queueLength, sampleCount start, sampleCount len)
 Invokes Start(), ProcessSamples(), and Finish() More...
 
- Public Member Functions inherited from SpectrumTransformer
 SpectrumTransformer (bool needsOutput, eWindowFunctions inWindowType, eWindowFunctions outWindowType, size_t windowSize, unsigned stepsPerWindow, bool leadingPadding, bool trailingPadding)
 
virtual ~SpectrumTransformer ()
 
bool NeedsOutput () const
 
bool Start (size_t queueLength)
 Call once before a sequence of calls to ProcessSamples; Invokes DoStart. More...
 
bool ProcessSamples (const WindowProcessor &processor, const float *buffer, size_t len)
 Call multiple times. More...
 
bool Finish (const WindowProcessor &processor)
 
virtual std::unique_ptr< WindowNewWindow (size_t windowSize)
 Allocates a window to place in the queue. More...
 
virtual bool DoStart ()
 Called before any calls to ProcessWindow. More...
 
virtual void DoOutput (const float *outBuffer, size_t mStepSize)=0
 Called within ProcessSamples if output was requested. More...
 
virtual bool DoFinish ()
 Called after the last call to ProcessWindow(). More...
 
size_t TotalQueueSize () const
 Useful functions to implement WindowProcesser: More...
 
size_t CurrentQueueSize () const
 How many windows in the queue have been filled? More...
 
bool QueueIsFull () const
 
WindowNth (int n)
 Access the queue, so you can inspect and modify any window in it. More...
 
WindowNewest ()
 
WindowLatest ()
 

Public Attributes

EffectNoiseReduction::WorkermWorker
 

Additional Inherited Members

- Public Types inherited from SpectrumTransformer
using FloatVector = std::vector< float >
 
using WindowProcessor = std::function< bool(SpectrumTransformer &) >
 Type of function that transforms windows in the queue. More...
 
- Static Public Member Functions inherited from TrackSpectrumTransformer
static bool PostProcess (WaveTrack &outputTrack, sampleCount len)
 Final flush and trimming of tail samples. More...
 
- Protected Member Functions inherited from TrackSpectrumTransformer
bool DoStart () override
 Called before any calls to ProcessWindow. More...
 
void DoOutput (const float *outBuffer, size_t mStepSize) override
 Called within ProcessSamples if output was requested. More...
 
bool DoFinish () override
 Called after the last call to ProcessWindow(). More...
 
- Protected Attributes inherited from SpectrumTransformer
const size_t mWindowSize
 
const size_t mSpectrumSize
 
const unsigned mStepsPerWindow
 
const size_t mStepSize
 
const bool mLeadingPadding
 
const bool mTrailingPadding
 

Detailed Description

Definition at line 254 of file NoiseReduction.cpp.

Constructor & Destructor Documentation

◆ MyTransformer()

MyTransformer::MyTransformer ( EffectNoiseReduction::Worker worker,
WaveChannel pOutputTrack,
bool  needsOutput,
eWindowFunctions  inWindowType,
eWindowFunctions  outWindowType,
size_t  windowSize,
unsigned  stepsPerWindow,
bool  leadingPadding,
bool  trailingPadding 
)
inline

Definition at line 255 of file NoiseReduction.cpp.

260 : TrackSpectrumTransformer{ pOutputTrack,
261 needsOutput, inWindowType, outWindowType,
262 windowSize, stepsPerWindow, leadingPadding, trailingPadding
263 }
264 , mWorker{ worker }
265 {
266 }
Subclass of SpectrumTransformer that rewrites a track.
EffectNoiseReduction::Worker & mWorker

Member Function Documentation

◆ DoFinish()

bool MyTransformer::DoFinish ( )
overridevirtual

Called after the last call to ProcessWindow().

Returns
false to abort processing. Default implementation just returns true.

Reimplemented from SpectrumTransformer.

Definition at line 1206 of file NoiseReduction.cpp.

1207{
1208 if (mWorker.mDoProfile)
1211}
bool DoFinish() override
Called after the last call to ProcessWindow().

References TrackSpectrumTransformer::DoFinish().

Here is the call graph for this function:

◆ DoStart()

bool MyTransformer::DoStart ( )
overridevirtual

Called before any calls to ProcessWindow.

More queue initializations can be done here.

Returns
false to abort processing. Default implementation just returns true.

Reimplemented from SpectrumTransformer.

Definition at line 907 of file NoiseReduction.cpp.

908{
909 for (size_t ii = 0, nn = TotalQueueSize(); ii < nn; ++ii) {
910 MyWindow &record = NthWindow(ii);
911 std::fill(record.mSpectrums.begin(), record.mSpectrums.end(), 0.0);
912 std::fill(record.mGains.begin(), record.mGains.end(),
914 }
916}
size_t TotalQueueSize() const
Useful functions to implement WindowProcesser:
bool DoStart() override
Called before any calls to ProcessWindow.
MyWindow & NthWindow(int nn)

References TrackSpectrumTransformer::DoStart(), MyTransformer::MyWindow::mGains, and MyTransformer::MyWindow::mSpectrums.

Here is the call graph for this function:

◆ NewWindow()

auto MyTransformer::NewWindow ( size_t  windowSize)
overridevirtual

Allocates a window to place in the queue.

Only when initializing – windows are recycled thereafter. You can derive from Window to add fields, and then override this factory function.

Reimplemented from SpectrumTransformer.

Definition at line 626 of file NoiseReduction.cpp.

628{
629 return std::make_unique<MyWindow>(windowSize);
630}

◆ NthWindow()

MyWindow & MyTransformer::NthWindow ( int  nn)
inline

Definition at line 280 of file NoiseReduction.cpp.

280{ return static_cast<MyWindow&>(Nth(nn)); }
Window & Nth(int n)
Access the queue, so you can inspect and modify any window in it.

Referenced by EffectNoiseReduction::Worker::Classify(), EffectNoiseReduction::Worker::GatherStatistics(), and EffectNoiseReduction::Worker::ReduceNoise().

Here is the caller graph for this function:

Member Data Documentation

◆ mWorker

EffectNoiseReduction::Worker& MyTransformer::mWorker

Definition at line 285 of file NoiseReduction.cpp.

Referenced by EffectNoiseReduction::Worker::Processor().


The documentation for this struct was generated from the following file: