Audacity 3.2.0
|
#include <SpectralDataManager.h>
Classes | |
struct | MyWindow |
Public Member Functions | |
Worker (WaveChannel *pChannel, const Setting &setting) | |
~Worker () | |
bool | Process (const WaveChannel &channel, const std::shared_ptr< SpectralData > &sDataPtr) |
int | ProcessSnapping (const WaveChannel &channel, long long int startSC, int hopSize, size_t winSize, double threshold, int targetFreqBin) |
std::vector< int > | ProcessOvertones (const WaveChannel &channel, long long int startSC, int hopSize, size_t winSize, double threshold, int targetFreqBin) |
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< 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 | |
MyWindow & | NthWindow (int nn) |
std::unique_ptr< Window > | NewWindow (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... | |
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... | |
Static Protected Member Functions | |
static bool | Processor (SpectrumTransformer &transformer) |
static bool | OvertonesProcessor (SpectrumTransformer &transformer) |
static bool | SnappingProcessor (SpectrumTransformer &transformer) |
Private Member Functions | |
bool | ApplyEffectToSelection () |
Private Attributes | |
std::shared_ptr< SpectralData > | mpSpectralData |
int | mWindowCount { 0 } |
double | mSnapSamplingRate |
double | mSnapThreshold |
double | mOvertonesThreshold |
std::vector< int > | mOvertonesTargetFreqBin |
int | mSnapTargetFreqBin |
int | mSnapReturnFreqBin { -1 } |
long long | mStartHopNum { 0 } |
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 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 |
Definition at line 40 of file SpectralDataManager.h.
SpectralDataManager::Worker::Worker | ( | WaveChannel * | pChannel, |
const Setting & | setting | ||
) |
Definition at line 150 of file SpectralDataManager.cpp.
|
default |
|
private |
Definition at line 323 of file SpectralDataManager.cpp.
|
overrideprotectedvirtual |
Called after the last call to ProcessWindow().
Reimplemented from SpectrumTransformer.
Definition at line 166 of file SpectralDataManager.cpp.
References TrackSpectrumTransformer::DoFinish().
|
overrideprotectedvirtual |
Called before any calls to ProcessWindow.
More queue initializations can be done here.
Reimplemented from SpectrumTransformer.
Definition at line 163 of file SpectralDataManager.cpp.
References TrackSpectrumTransformer::DoStart().
|
overrideprotectedvirtual |
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 339 of file SpectralDataManager.cpp.
|
inlineprotected |
Definition at line 71 of file SpectralDataManager.h.
References SpectrumTransformer::Nth().
|
staticprotected |
Definition at line 255 of file SpectralDataManager.cpp.
References details::begin(), details::end(), lrint, and SpectralDataManager::Worker::MyWindow::mSpectrums.
bool SpectralDataManager::Worker::Process | ( | const WaveChannel & | channel, |
const std::shared_ptr< SpectralData > & | sDataPtr | ||
) |
Definition at line 170 of file SpectralDataManager.cpp.
References TrackSpectrumTransformer::Process().
|
staticprotected |
Definition at line 301 of file SpectralDataManager.cpp.
References SpectralDataManager::Worker::MyWindow::mSpectrums.
std::vector< int > SpectralDataManager::Worker::ProcessOvertones | ( | const WaveChannel & | channel, |
long long int | startSC, | ||
int | hopSize, | ||
size_t | winSize, | ||
double | threshold, | ||
int | targetFreqBin | ||
) |
Definition at line 201 of file SpectralDataManager.cpp.
References WaveTrack::GetRate(), WaveChannel::GetTrack(), and TrackSpectrumTransformer::Process().
int SpectralDataManager::Worker::ProcessSnapping | ( | const WaveChannel & | channel, |
long long int | startSC, | ||
int | hopSize, | ||
size_t | winSize, | ||
double | threshold, | ||
int | targetFreqBin | ||
) |
Definition at line 184 of file SpectralDataManager.cpp.
References WaveTrack::GetRate(), WaveChannel::GetTrack(), and TrackSpectrumTransformer::Process().
|
staticprotected |
Definition at line 216 of file SpectralDataManager.cpp.
References min(), and SpectralDataManager::Worker::MyWindow::mSpectrums.
|
private |
Definition at line 88 of file SpectralDataManager.h.
|
private |
Definition at line 87 of file SpectralDataManager.h.
|
private |
Definition at line 83 of file SpectralDataManager.h.
|
private |
Definition at line 90 of file SpectralDataManager.h.
|
private |
Definition at line 85 of file SpectralDataManager.h.
|
private |
Definition at line 89 of file SpectralDataManager.h.
|
private |
Definition at line 86 of file SpectralDataManager.h.
|
private |
Definition at line 91 of file SpectralDataManager.h.
|
private |
Definition at line 84 of file SpectralDataManager.h.