diff --git a/spectrogramplot.cpp b/spectrogramplot.cpp index fb14fd8..a05255b 100644 --- a/spectrogramplot.cpp +++ b/spectrogramplot.cpp @@ -45,11 +45,6 @@ SpectrogramPlot::SpectrogramPlot(SampleSource> *src) } -SpectrogramPlot::~SpectrogramPlot() -{ - delete fft; -} - void SpectrogramPlot::paintMid(QPainter &painter, QRect &rect, range_t sampleRange) { if (!inputSource || inputSource->count() == 0) @@ -143,8 +138,7 @@ void SpectrogramPlot::setSampleRate(int rate) void SpectrogramPlot::setFFTSize(int size) { fftSize = size; - delete fft; - fft = new FFT(fftSize); + fft.reset(new FFT(fftSize)); window.reset(new float[fftSize]); for (int i = 0; i < fftSize; i++) { diff --git a/spectrogramplot.h b/spectrogramplot.h index 48cb30e..4a067c0 100644 --- a/spectrogramplot.h +++ b/spectrogramplot.h @@ -38,7 +38,6 @@ class SpectrogramPlot : public Plot public: SpectrogramPlot(SampleSource> *src); - ~SpectrogramPlot(); void paintMid(QPainter &painter, QRect &rect, range_t sampleRange); @@ -66,7 +65,7 @@ private: const int linesPerGraduation = 50; const int tileSize = 65536; // This must be a multiple of the maximum FFT size - FFT *fft = nullptr; + std::unique_ptr fft; std::unique_ptr window; fftwf_complex *lineBuffer = nullptr; QCache pixmapCache;