Audacity 3.2.0
Classes | Public Member Functions | Static Public Member Functions | List of all members
SpectralDataManager Class Reference

Performs the calculation for spectral editing. More...

#include <SpectralDataManager.h>

Classes

struct  Setting
 
class  Worker
 

Public Member Functions

 SpectralDataManager ()
 
 ~SpectralDataManager ()
 

Static Public Member Functions

static bool ProcessTracks (AudacityProject &project)
 
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)
 

Detailed Description

Performs the calculation for spectral editing.

Definition at line 20 of file SpectralDataManager.h.

Constructor & Destructor Documentation

◆ SpectralDataManager()

SpectralDataManager::SpectralDataManager ( )
default

◆ ~SpectralDataManager()

SpectralDataManager::~SpectralDataManager ( )
default

Member Function Documentation

◆ FindFrequencySnappingBin()

int SpectralDataManager::FindFrequencySnappingBin ( WaveTrack wt,
long long  startSC,
int  hopSize,
double  threshold,
int  targetFreqBin 
)
static

Definition at line 71 of file SpectralDataManager.cpp.

76{
77 Setting setting;
78 setting.mNeedOutput = false;
79 Worker worker(setting);
80
81 return worker.ProcessSnapping(wt, startSC, hopSize, setting.mWindowSize, threshold, targetFreqBin);
82}
Definition: Prefs.h:173

References SpectralDataManager::Setting::mNeedOutput, SpectralDataManager::Setting::mWindowSize, and SpectralDataManager::Worker::ProcessSnapping().

Referenced by BrushHandle::Drag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindHighestFrequencyBins()

std::vector< int > SpectralDataManager::FindHighestFrequencyBins ( WaveTrack wt,
long long int  startSC,
int  hopSize,
double  threshold,
int  targetFreqBin 
)
static

Definition at line 84 of file SpectralDataManager.cpp.

89 {
90 Setting setting;
91 setting.mNeedOutput = false;
92 Worker worker(setting);
93
94 return worker.ProcessOvertones(wt, startSC, hopSize, setting.mWindowSize, threshold, targetFreqBin);
95 }

References SpectralDataManager::Setting::mNeedOutput, SpectralDataManager::Setting::mWindowSize, and SpectralDataManager::Worker::ProcessOvertones().

Referenced by BrushHandle::Drag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessTracks()

bool SpectralDataManager::ProcessTracks ( AudacityProject project)
static

Definition at line 36 of file SpectralDataManager.cpp.

36 {
37 auto &tracks = TrackList::Get(project);
38 int applyCount = 0;
39 Setting setting;
40 Worker worker(setting);
41
42 for ( auto wt : tracks.Any< WaveTrack >() ) {
43 auto &trackView = TrackView::Get(*wt);
44
45 if(auto waveTrackViewPtr = dynamic_cast<WaveTrackView*>(&trackView)){
46 for(const auto &subViewPtr : waveTrackViewPtr->GetAllSubViews()){
47 if(!subViewPtr->IsSpectral())
48 continue;
49 auto sView = std::static_pointer_cast<SpectrumView>(subViewPtr).get();
50 auto pSpectralData = sView->GetSpectralData();
51
52 if(!pSpectralData->dataHistory.empty()){
53 worker.Process(wt, pSpectralData);
54 applyCount += static_cast<int>(pSpectralData->dataHistory.size());
55 pSpectralData->clearAllData();
56 }
57 }
58 }
59 }
60
61 if (applyCount) {
63 XO("Applied effect to selection"),
64 XO("Applied effect to selection"));
65 ProjectHistory::Get(project).ModifyState(true);
66 }
67
68 return applyCount > 0;
69}
XO("Cut/Copy/Paste")
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:487
static TrackView & Get(Track &)
Definition: TrackView.cpp:69
A Track that contains audio waveform data.
Definition: WaveTrack.h:51

References ProjectHistory::Get(), TrackList::Get(), TrackView::Get(), ProjectHistory::ModifyState(), SpectralDataManager::Worker::Process(), ProjectHistory::PushState(), and XO().

Referenced by SpectrumView::KeyDown().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: