comparison data/model/FFTModel.h @ 1744:b92bdcd4954b by-id

Update FFT model to ById
author Chris Cannam
date Tue, 02 Jul 2019 11:49:28 +0100
parents 78fe29adfd16
children 6d6740b075c3
comparison
equal deleted inserted replaced
1743:7001b9570e37 1744:b92bdcd4954b
48 * 48 *
49 * If the model has multiple channels use only the given channel, 49 * If the model has multiple channels use only the given channel,
50 * unless the channel is -1 in which case merge all available 50 * unless the channel is -1 in which case merge all available
51 * channels. 51 * channels.
52 */ 52 */
53 FFTModel(const DenseTimeValueModel *model, 53 FFTModel(ModelId model, // a DenseTimeValueModel
54 int channel, 54 int channel,
55 WindowType windowType, 55 WindowType windowType,
56 int windowSize, 56 int windowSize,
57 int windowIncrement, 57 int windowIncrement,
58 int fftSize); 58 int fftSize);
61 // DenseThreeDimensionalModel and Model methods: 61 // DenseThreeDimensionalModel and Model methods:
62 // 62 //
63 int getWidth() const override; 63 int getWidth() const override;
64 int getHeight() const override; 64 int getHeight() const override;
65 float getValueAt(int x, int y) const override { return getMagnitudeAt(x, y); } 65 float getValueAt(int x, int y) const override { return getMagnitudeAt(x, y); }
66 bool isOK() const override { return m_model && m_model->isOK(); } 66 bool isOK() const override;
67 sv_frame_t getStartFrame() const override { return 0; } 67 sv_frame_t getStartFrame() const override { return 0; }
68 sv_frame_t getTrueEndFrame() const override { 68 sv_frame_t getTrueEndFrame() const override {
69 return sv_frame_t(getWidth()) * getResolution() + getResolution(); 69 return sv_frame_t(getWidth()) * getResolution() + getResolution();
70 } 70 }
71 sv_samplerate_t getSampleRate() const override { 71 sv_samplerate_t getSampleRate() const override;
72 return isOK() ? m_model->getSampleRate() : 0;
73 }
74 int getResolution() const override { return m_windowIncrement; } 72 int getResolution() const override { return m_windowIncrement; }
75 virtual int getYBinCount() const { return getHeight(); } 73 virtual int getYBinCount() const { return getHeight(); }
76 float getMinimumLevel() const override { return 0.f; } // Can't provide 74 float getMinimumLevel() const override { return 0.f; } // Can't provide
77 float getMaximumLevel() const override { return 1.f; } // Can't provide 75 float getMaximumLevel() const override { return 1.f; } // Can't provide
78 Column getColumn(int x) const override; // magnitudes 76 Column getColumn(int x) const override; // magnitudes
79 virtual Column getPhases(int x) const; 77 virtual Column getPhases(int x) const;
80 QString getBinName(int n) const override; 78 QString getBinName(int n) const override;
81 bool shouldUseLogValueScale() const override { return true; } 79 bool shouldUseLogValueScale() const override { return true; }
82 int getCompletion() const override { 80 int getCompletion() const override;
83 int c = 100;
84 if (m_model) {
85 if (m_model->isReady(&c)) return 100;
86 }
87 return c;
88 }
89 virtual QString getError() const { return ""; } //!!!??? 81 virtual QString getError() const { return ""; } //!!!???
90 virtual sv_frame_t getFillExtent() const { return getEndFrame(); } 82 virtual sv_frame_t getFillExtent() const { return getEndFrame(); }
91 QString toDelimitedDataString(QString, DataExportOptions, 83 QString toDelimitedDataString(QString, DataExportOptions,
92 sv_frame_t, sv_frame_t) const override { 84 sv_frame_t, sv_frame_t) const override {
93 return ""; 85 return "";
141 virtual PeakSet getPeakFrequencies(PeakPickType type, int x, 133 virtual PeakSet getPeakFrequencies(PeakPickType type, int x,
142 int ymin = 0, int ymax = 0) const; 134 int ymin = 0, int ymax = 0) const;
143 135
144 QString getTypeName() const override { return tr("FFT"); } 136 QString getTypeName() const override { return tr("FFT"); }
145 137
146 public slots: 138 private:
147 void sourceModelAboutToBeDeleted(); 139 FFTModel(const FFTModel &) =delete;
140 FFTModel &operator=(const FFTModel &) =delete;
148 141
149 private: 142 const ModelId m_model; // a DenseTimeValueModel
150 FFTModel(const FFTModel &); // not implemented
151 FFTModel &operator=(const FFTModel &); // not implemented
152
153 const DenseTimeValueModel *m_model;
154 int m_channel; 143 int m_channel;
155 WindowType m_windowType; 144 WindowType m_windowType;
156 int m_windowSize; 145 int m_windowSize;
157 int m_windowIncrement; 146 int m_windowIncrement;
158 int m_fftSize; 147 int m_fftSize;