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 (NoiseReductionBase::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

NoiseReductionBase::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
 
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 185 of file NoiseReductionBase.cpp.

Constructor & Destructor Documentation

◆ MyTransformer()

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

Definition at line 187 of file NoiseReductionBase.cpp.

192 : TrackSpectrumTransformer { pOutputTrack, needsOutput,
193 inWindowType, outWindowType,
194 windowSize, stepsPerWindow,
195 leadingPadding, trailingPadding }
196 , mWorker { worker }
197 {
198 }
Subclass of SpectrumTransformer that rewrites a track.
NoiseReductionBase::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 1079 of file NoiseReductionBase.cpp.

1080{
1081 if (mWorker.mDoProfile)
1084}
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 758 of file NoiseReductionBase.cpp.

759{
760 for (size_t ii = 0, nn = TotalQueueSize(); ii < nn; ++ii)
761 {
762 MyWindow& record = NthWindow(ii);
763 std::fill(record.mSpectrums.begin(), record.mSpectrums.end(), 0.0);
764 std::fill(
765 record.mGains.begin(), record.mGains.end(), mWorker.mNoiseAttenFactor);
766 }
768}
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 455 of file NoiseReductionBase.cpp.

456{
457 return std::make_unique<MyWindow>(windowSize);
458}

◆ NthWindow()

MyWindow & MyTransformer::NthWindow ( int  nn)
inline

Definition at line 213 of file NoiseReductionBase.cpp.

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

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

Here is the caller graph for this function:

Member Data Documentation

◆ mWorker

NoiseReductionBase::Worker& MyTransformer::mWorker

Definition at line 221 of file NoiseReductionBase.cpp.

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


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