Audacity 3.2.0
SpectralDataManager.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 SpectralDataManager.h
6
7 Edward Hui
8
9*******************************************************************//*******************************************************************/
15
17#include "effects/Effect.h"
19
21public:
24 static bool ProcessTracks(AudacityProject &project);
26 long long startSC,
27 int hopSize,
28 double threshold,
29 int targetFreqBin);
30
31 static std::vector<int> FindHighestFrequencyBins(WaveTrack *wt,
32 long long int startSC,
33 int hopSize,
34 double threshold,
35 int targetFreqBin);
36private:
37 class Worker;
38 struct Setting;
39};
40
43public:
44 Worker(const Setting &setting);
46
47 struct MyWindow : public Window
48 {
49 MyWindow(size_t windowSize)
50 : Window{ windowSize }
51 , mSpectrums(windowSize / 2 + 1)
52 , mGains(windowSize / 2 + 1)
53 {
54
55 }
56 ~MyWindow() override;
57
60 };
61
62 bool Process(WaveTrack* wt, const std::shared_ptr<SpectralData> &sDataPtr);
63 int ProcessSnapping(WaveTrack *wt, long long int startSC, int hopSize, size_t winSize,
64 double threshold, int targetFreqBin);
65 std::vector<int> ProcessOvertones(WaveTrack *wt, long long int startSC, int hopSize, size_t winSize,
66 double threshold, int targetFreqBin);
67
68protected:
70 return static_cast<MyWindow&>(Nth(nn));
71 }
72 std::unique_ptr<Window> NewWindow(size_t windowSize) override;
73 bool DoStart() override;
74 static bool Processor(SpectrumTransformer &transformer);
75 static bool OvertonesProcessor(SpectrumTransformer &transformer);
76 static bool SnappingProcessor(SpectrumTransformer &transformer);
77 bool DoFinish() override;
78
79private:
81 std::shared_ptr<SpectralData> mpSpectralData;
82 int mWindowCount { 0 };
86 std::vector<int> mOvertonesTargetFreqBin;
89 long long mStartHopNum { 0 };
90};
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
std::vector< int > mOvertonesTargetFreqBin
bool DoFinish() override
Called after the last call to ProcessWindow().
int ProcessSnapping(WaveTrack *wt, long long int startSC, int hopSize, size_t winSize, double threshold, int targetFreqBin)
bool DoStart() override
Called before any calls to ProcessWindow.
std::unique_ptr< Window > NewWindow(size_t windowSize) override
Allocates a window to place in the queue.
std::vector< int > ProcessOvertones(WaveTrack *wt, long long int startSC, int hopSize, size_t winSize, double threshold, int targetFreqBin)
Worker(const Setting &setting)
bool Process(WaveTrack *wt, const std::shared_ptr< SpectralData > &sDataPtr)
std::shared_ptr< SpectralData > mpSpectralData
static bool OvertonesProcessor(SpectrumTransformer &transformer)
static bool Processor(SpectrumTransformer &transformer)
static bool SnappingProcessor(SpectrumTransformer &transformer)
Performs the calculation for spectral editing.
static int FindFrequencySnappingBin(WaveTrack *wt, long long startSC, int hopSize, double threshold, int targetFreqBin)
static std::vector< int > FindHighestFrequencyBins(WaveTrack *wt, long long int startSC, int hopSize, double threshold, int targetFreqBin)
static bool ProcessTracks(AudacityProject &project)
A class that transforms a portion of a wave track (preserving duration) by applying Fourier transform...
std::vector< float > FloatVector
Window & Nth(int n)
Access the queue, so you can inspect and modify any window in it.
Subclass of SpectrumTransformer that rewrites a track.
A Track that contains audio waveform data.
Definition: WaveTrack.h:57