![]() |
Audacity 3.2.0
|
Subclass of SpectrumTransformer that rewrites a track. More...
#include <SpectrumTransformer.h>
Public Member Functions | |
~TrackSpectrumTransformer () override | |
bool | Process (const WindowProcessor &processor, WaveTrack *track, size_t queueLength, sampleCount start, sampleCount len) |
Invokes Start(), ProcessSamples(), and Finish() More... | |
SpectrumTransformer (bool needsOutput, eWindowFunctions inWindowType, eWindowFunctions outWindowType, size_t windowSize, unsigned stepsPerWindow, bool leadingPadding, bool trailingPadding) | |
![]() | |
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) |
Call once after a sequence of calls to ProcessSamples; flushes the queue and Invokes DoFinish. More... | |
virtual std::unique_ptr< Window > | NewWindow (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 |
Window & | Nth (int n) |
Access the queue, so you can inspect and modify any window in it. More... | |
Window & | Newest () |
Window & | Latest () |
Protected Member Functions | |
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... | |
Private Attributes | |
WaveTrack * | mpTrack = nullptr |
std::shared_ptr< WaveTrack > | mOutputTrack |
sampleCount | mStart = 0 |
sampleCount | mLen = 0 |
Additional Inherited Members | |
![]() | |
using | FloatVector = std::vector< float > |
using | WindowProcessor = std::function< bool(SpectrumTransformer &) > |
Type of function that transforms windows in the queue. More... | |
![]() | |
const size_t | mWindowSize |
const size_t | mSpectrumSize |
const unsigned | mStepsPerWindow |
const size_t | mStepSize |
const bool | mLeadingPadding |
const bool | mTrailingPadding |
Subclass of SpectrumTransformer that rewrites a track.
Definition at line 183 of file SpectrumTransformer.h.
|
overridedefault |
|
overrideprotectedvirtual |
Called after the last call to ProcessWindow().
Reimplemented from SpectrumTransformer.
Definition at line 378 of file SpectrumTransformer.cpp.
References WaveTrack::ClearAndPaste(), mLen, mOutputTrack, mpTrack, and mStart.
Referenced by EffectNoiseReduction::Worker::DoFinish(), and SpectralDataManager::Worker::DoFinish().
|
overrideprotectedvirtual |
Called within ProcessSamples if output was requested.
Implements SpectrumTransformer.
Definition at line 104 of file SpectrumTransformer.cpp.
References floatSample, mOutputTrack, and SpectrumTransformer::mStepSize.
|
overrideprotectedvirtual |
Called before any calls to ProcessWindow.
More queue initializations can be done here.
Reimplemented from SpectrumTransformer.
Definition at line 404 of file SpectrumTransformer.cpp.
References SpectrumTransformer::DoStart(), WaveTrack::EmptyCopy(), mOutputTrack, mpTrack, and SpectrumTransformer::NeedsOutput().
Referenced by EffectNoiseReduction::Worker::DoStart(), and SpectralDataManager::Worker::DoStart().
bool TrackSpectrumTransformer::Process | ( | const WindowProcessor & | processor, |
WaveTrack * | track, | ||
size_t | queueLength, | ||
sampleCount | start, | ||
sampleCount | len | ||
) |
Invokes Start(), ProcessSamples(), and Finish()
Definition at line 341 of file SpectrumTransformer.cpp.
References SpectrumTransformer::Finish(), WaveTrack::GetBestBlockSize(), SampleTrack::GetFloats(), WaveTrack::GetMaxBlockSize(), limitSampleBufferSize(), min(), mLen, mpTrack, mStart, SpectrumTransformer::ProcessSamples(), and SpectrumTransformer::Start().
Referenced by EffectNoiseReduction::Worker::Process(), SpectralDataManager::Worker::Process(), SpectralDataManager::Worker::ProcessOvertones(), and SpectralDataManager::Worker::ProcessSnapping().
SpectrumTransformer::SpectrumTransformer | ( | bool | needsOutput, |
eWindowFunctions | inWindowType, | ||
eWindowFunctions | outWindowType, | ||
size_t | windowSize, | ||
unsigned | stepsPerWindow, | ||
bool | leadingPadding, | ||
bool | trailingPadding | ||
) |
!(inWindowType == eWinFuncRectangular && outWindowType eWinFuncRectangular)
windowSize % stepsPerWindow == 0
windowSize
is a power of 2 needsOutput | Whether to do the inverse FFT |
inWindowType | Used in FFT transform |
outWindowType | Used in inverse FFT transform |
windowSize | must be a power of 2 |
stepsPerWindow | determines the overlap |
leadingPadding | Whether to start the queue with windows that partially overlap the first full window of input samples |
trailingPadding | Whether to stop the procedure after the last complete window of input is added to the queue |
Definition at line 50 of file SpectrumTransformer.cpp.
|
private |
Definition at line 200 of file SpectrumTransformer.h.
Referenced by DoFinish(), and Process().
|
private |
Definition at line 199 of file SpectrumTransformer.h.
Referenced by DoFinish(), DoOutput(), and DoStart().
|
private |
Definition at line 198 of file SpectrumTransformer.h.
Referenced by DoFinish(), DoStart(), and Process().
|
private |
Definition at line 200 of file SpectrumTransformer.h.
Referenced by DoFinish(), and Process().