diff data/model/FFTModel.h @ 1780:6d6740b075c3

Support optional max frequency setting, useful when we want to store caches of very constrained frequency ranges (as in melodic-range spectrogram, potentially)
author Chris Cannam
date Thu, 12 Sep 2019 11:52:19 +0100
parents b92bdcd4954b
children 4eac4bf35b45
line wrap: on
line diff
--- a/data/model/FFTModel.h	Wed Sep 11 13:20:40 2019 +0100
+++ b/data/model/FFTModel.h	Thu Sep 12 11:52:19 2019 +0100
@@ -93,6 +93,9 @@
     int getWindowIncrement() const { return m_windowIncrement; }
     int getFFTSize() const { return m_fftSize; }
 
+    void setMaximumFrequency(double freq);
+    double getMaximumFrequency() const { return m_maximumFrequency; }
+
 //!!! review which of these are ever actually called
     
     float getMagnitudeAt(int x, int y) const;
@@ -140,6 +143,7 @@
     FFTModel &operator=(const FFTModel &) =delete;
 
     const ModelId m_model; // a DenseTimeValueModel
+    sv_samplerate_t m_sampleRate;
     int m_channel;
     WindowType m_windowType;
     int m_windowSize;
@@ -147,6 +151,7 @@
     int m_fftSize;
     Window<float> m_windower;
     mutable breakfastquay::FFT m_fft;
+    double m_maximumFrequency;
     
     int getPeakPickWindowSize(PeakPickType type, sv_samplerate_t sampleRate,
                               int bin, double &dist) const;
@@ -163,8 +168,8 @@
     typedef std::vector<float, breakfastquay::StlAllocator<float>> fvec;
     typedef std::vector<std::complex<float>,
                         breakfastquay::StlAllocator<std::complex<float>>> cvec;
-    
-    const cvec &getFFTColumn(int column) const; // returns ref for immediate use only
+
+    cvec getFFTColumn(int column) const;
     fvec getSourceSamples(int column) const;
     fvec getSourceData(std::pair<sv_frame_t, sv_frame_t>) const;
     fvec getSourceDataUncached(std::pair<sv_frame_t, sv_frame_t>) const;