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 "Effect.h"
19
20class WaveChannel;
21
23public:
27 static int FindFrequencySnappingBin(const WaveChannel &channel,
28 long long startSC, int hopSize, double threshold, int targetFreqBin);
29
30 static std::vector<int> FindHighestFrequencyBins(WaveChannel &wc,
31 long long int startSC,
32 int hopSize,
33 double threshold,
34 int targetFreqBin);
35private:
36 class Worker;
37 struct Setting;
38};
39
42public:
43 Worker(WaveChannel *pChannel, const Setting &setting);
45
46 struct MyWindow : public Window
47 {
48 MyWindow(size_t windowSize)
49 : Window{ windowSize }
50 , mSpectrums(windowSize / 2 + 1)
51 , mGains(windowSize / 2 + 1)
52 {
53
54 }
55 ~MyWindow() override;
56
59 };
60
61 bool Process(const WaveChannel &channel,
62 const std::shared_ptr<SpectralData> &sDataPtr);
63 int ProcessSnapping(const WaveChannel &channel,
64 long long int startSC, int hopSize, size_t winSize,
65 double threshold, int targetFreqBin);
66 std::vector<int> ProcessOvertones(const WaveChannel &channel,
67 long long int startSC, int hopSize, size_t winSize,
68 double threshold, int targetFreqBin);
69
70protected:
72 return static_cast<MyWindow&>(Nth(nn));
73 }
74 std::unique_ptr<Window> NewWindow(size_t windowSize) override;
75 bool DoStart() override;
76 static bool Processor(SpectrumTransformer &transformer);
77 static bool OvertonesProcessor(SpectrumTransformer &transformer);
78 static bool SnappingProcessor(SpectrumTransformer &transformer);
79 bool DoFinish() override;
80
81private:
83 std::shared_ptr<SpectralData> mpSpectralData;
84 int mWindowCount { 0 };
88 std::vector<int> mOvertonesTargetFreqBin;
91 long long mStartHopNum { 0 };
92};
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
Worker(WaveChannel *pChannel, const Setting &setting)
std::vector< int > mOvertonesTargetFreqBin
std::vector< int > ProcessOvertones(const WaveChannel &channel, long long int startSC, int hopSize, size_t winSize, double threshold, int targetFreqBin)
bool DoFinish() override
Called after the last call to ProcessWindow().
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.
int ProcessSnapping(const WaveChannel &channel, long long int startSC, int hopSize, size_t winSize, double threshold, int targetFreqBin)
bool Process(const WaveChannel &channel, 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 std::vector< int > FindHighestFrequencyBins(WaveChannel &wc, long long int startSC, int hopSize, double threshold, int targetFreqBin)
static bool ProcessTracks(AudacityProject &project)
static int FindFrequencySnappingBin(const WaveChannel &channel, long long startSC, int hopSize, double threshold, int targetFreqBin)
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.
Derive this class to add information to the queue.