Mercurial > hg > svgui
diff layer/SpectrogramLayer.cpp @ 1414:fa986b91d77f
Merge from branch fix-static-analysis
author | Chris Cannam |
---|---|
date | Wed, 09 Jan 2019 15:24:51 +0000 |
parents | c8a6fd3f9dff |
children | 8e40faa56ffd |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Wed Jan 09 14:41:52 2019 +0000 +++ b/layer/SpectrogramLayer.cpp Wed Jan 09 15:24:51 2019 +0000 @@ -56,7 +56,7 @@ using namespace std; SpectrogramLayer::SpectrogramLayer(Configuration config) : - m_model(0), + m_model(nullptr), m_channel(0), m_windowSize(1024), m_windowType(HanningWindow), @@ -83,9 +83,9 @@ m_synchronous(false), m_haveDetailedScale(false), m_exiting(false), - m_fftModel(0), - m_wholeCache(0), - m_peakCache(0), + m_fftModel(nullptr), + m_wholeCache(nullptr), + m_peakCache(nullptr), m_peakCacheDivisor(8) { QString colourConfigName = "spectrogram-colour"; @@ -148,9 +148,9 @@ delete m_peakCache; delete m_wholeCache; - m_fftModel = 0; - m_peakCache = 0; - m_wholeCache = 0; + m_fftModel = nullptr; + m_peakCache = nullptr; + m_wholeCache = nullptr; } pair<ColourScaleType, double> @@ -582,7 +582,7 @@ return new LinearRangeMapper(-81, -1, -81, -1, tr("dB"), false, { { -81, Strings::minus_infinity } }); } - return 0; + return nullptr; } void @@ -1372,7 +1372,7 @@ SVDEBUG << "SpectrogramLayer::recreateFFTModel called" << endl; if (!m_model || !m_model->isOK()) { - emit sliceableModelReplaced(m_fftModel, 0); + emit sliceableModelReplaced(m_fftModel, nullptr); deleteDerivedModels(); return; } @@ -1381,11 +1381,11 @@ if (m_peakCache) m_peakCache->aboutToDelete(); delete m_peakCache; - m_peakCache = 0; + m_peakCache = nullptr; if (m_wholeCache) m_wholeCache->aboutToDelete(); delete m_wholeCache; - m_wholeCache = 0; + m_wholeCache = nullptr; FFTModel *newModel = new FFTModel(m_model, m_channel, @@ -1396,12 +1396,12 @@ if (!newModel->isOK()) { QMessageBox::critical - (0, tr("FFT cache failed"), + (nullptr, tr("FFT cache failed"), tr("Failed to create the FFT model for this spectrogram.\n" "There may be insufficient memory or disc space to continue.")); delete newModel; delete m_fftModel; - m_fftModel = 0; + m_fftModel = nullptr; return; } @@ -2314,9 +2314,9 @@ SpectrogramRangeMapper(sv_samplerate_t sr, int /* fftsize */) : m_dist(sr / 2), m_s2(sqrt(sqrt(2))) { } - ~SpectrogramRangeMapper() { } + ~SpectrogramRangeMapper() override { } - virtual int getPositionForValue(double value) const { + int getPositionForValue(double value) const override { double dist = m_dist; @@ -2330,12 +2330,12 @@ return n; } - virtual int getPositionForValueUnclamped(double value) const { + int getPositionForValueUnclamped(double value) const override { // We don't really support this return getPositionForValue(value); } - virtual double getValueForPosition(int position) const { + double getValueForPosition(int position) const override { // Vertical zoom step 0 shows the entire range from DC -> // Nyquist frequency. Step 1 shows 2^(1/4) of the range of @@ -2353,12 +2353,12 @@ return dist; } - virtual double getValueForPositionUnclamped(int position) const { + double getValueForPositionUnclamped(int position) const override { // We don't really support this return getValueForPosition(position); } - virtual QString getUnit() const { return "Hz"; } + QString getUnit() const override { return "Hz"; } protected: double m_dist; @@ -2473,7 +2473,7 @@ RangeMapper * SpectrogramLayer::getNewVerticalZoomRangeMapper() const { - if (!m_model) return 0; + if (!m_model) return nullptr; return new SpectrogramRangeMapper(m_model->getSampleRate(), getFFTSize()); }