1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-05 06:01:04 +01:00

Redo type HFFT as a smart pointer, remove malloc and free

This commit is contained in:
Paul Licameli
2016-08-13 11:02:35 -04:00
parent c5007d846e
commit 58574f2f78
12 changed files with 210 additions and 246 deletions

View File

@@ -348,10 +348,7 @@ SpectrogramSettings::~SpectrogramSettings()
void SpectrogramSettings::DestroyWindows()
{
if (hFFT != NULL) {
EndFFT(hFFT);
hFFT = NULL;
}
hFFT.reset();
window.reset();
dWindow.reset();
tWindow.reset();
@@ -420,9 +417,7 @@ void SpectrogramSettings::CacheWindows() const
const auto fftLen = WindowSize() * ZeroPaddingFactor();
const auto padding = (WindowSize() * (zeroPaddingFactor - 1)) / 2;
if (hFFT != NULL)
EndFFT(hFFT);
hFFT = InitializeFFT(fftLen);
hFFT = GetFFT(fftLen);
RecreateWindow(window, WINDOW, fftLen, padding, windowType, windowSize, scale);
if (algorithm == algReassignment) {
RecreateWindow(tWindow, TWINDOW, fftLen, padding, windowType, windowSize, scale);

View File

@@ -13,6 +13,7 @@ Paul Licameli
#include "../Experimental.h"
#include "../SampleFormat.h"
#include "../RealFFTf.h"
#undef SPECTRAL_SELECTION_GLOBAL_SWITCH
@@ -153,7 +154,7 @@ public:
// Following fields are derived from preferences.
// Variables used for computing the spectrum
mutable FFTParam *hFFT{};
mutable HFFT hFFT;
mutable Floats window;
// Two other windows for computing reassigned spectrogram