comparison layer/SpectrogramLayer.h @ 1086:163cb9b98104 spectrogram-minor-refactor

Simplify the oversampling/zero-padding logic. FFT model selection no longer depends on the view.
author Chris Cannam
date Fri, 01 Jul 2016 18:30:42 +0100
parents 179ea8a2f650
children 6d990a24ac1b
comparison
equal deleted inserted replaced
1085:179ea8a2f650 1086:163cb9b98104
113 int getWindowHopLevel() const; 113 int getWindowHopLevel() const;
114 114
115 void setWindowType(WindowType type); 115 void setWindowType(WindowType type);
116 WindowType getWindowType() const; 116 WindowType getWindowType() const;
117 117
118 void setZeroPadLevel(int level);
119 int getZeroPadLevel() const;
120
121 /** 118 /**
122 * Set the gain multiplier for sample values in this view. 119 * Set the gain multiplier for sample values in this view.
123 * The default is 1.0. 120 * The default is 1.0.
124 */ 121 */
125 void setGain(float gain); 122 void setGain(float gain);
253 250
254 int m_channel; 251 int m_channel;
255 int m_windowSize; 252 int m_windowSize;
256 WindowType m_windowType; 253 WindowType m_windowType;
257 int m_windowHopLevel; 254 int m_windowHopLevel;
258 int m_zeroPadLevel; 255 int m_fftSize; // m_windowSize * oversampling level
259 int m_fftSize;
260 float m_gain; 256 float m_gain;
261 float m_initialGain; 257 float m_initialGain;
262 float m_threshold; 258 float m_threshold;
263 float m_initialThreshold; 259 float m_initialThreshold;
264 int m_colourRotation; 260 int m_colourRotation;
323 void illuminateLocalFeatures(LayerGeometryProvider *v, QPainter &painter) const; 319 void illuminateLocalFeatures(LayerGeometryProvider *v, QPainter &painter) const;
324 320
325 double getEffectiveMinFrequency() const; 321 double getEffectiveMinFrequency() const;
326 double getEffectiveMaxFrequency() const; 322 double getEffectiveMaxFrequency() const;
327 323
328 // Note that the getYBin... methods return the nominal bin in the
329 // un-smoothed spectrogram. This is not necessarily the same bin
330 // as is pulled from the spectrogram and drawn at the given
331 // position, if the spectrogram has oversampling smoothing. Use
332 // getSmoothedYBinRange to obtain that.
333
334 bool getXBinRange(LayerGeometryProvider *v, int x, double &windowMin, double &windowMax) const; 324 bool getXBinRange(LayerGeometryProvider *v, int x, double &windowMin, double &windowMax) const;
335 bool getYBinRange(LayerGeometryProvider *v, int y, double &freqBinMin, double &freqBinMax) const; 325 bool getYBinRange(LayerGeometryProvider *v, int y, double &freqBinMin, double &freqBinMax) const;
336 bool getSmoothedYBinRange(LayerGeometryProvider *v, int y, double &freqBinMin, double &freqBinMax) const;
337 326
338 bool getYBinSourceRange(LayerGeometryProvider *v, int y, double &freqMin, double &freqMax) const; 327 bool getYBinSourceRange(LayerGeometryProvider *v, int y, double &freqMin, double &freqMax) const;
339 bool getAdjustedYBinSourceRange(LayerGeometryProvider *v, int x, int y, 328 bool getAdjustedYBinSourceRange(LayerGeometryProvider *v, int x, int y,
340 double &freqMin, double &freqMax, 329 double &freqMin, double &freqMax,
341 double &adjFreqMin, double &adjFreqMax) const; 330 double &adjFreqMin, double &adjFreqMax) const;
347 if (m_windowHopLevel == 0) return m_windowSize; 336 if (m_windowHopLevel == 0) return m_windowSize;
348 else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4; 337 else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4;
349 else return m_windowSize / (1 << (m_windowHopLevel - 1)); 338 else return m_windowSize / (1 << (m_windowHopLevel - 1));
350 } 339 }
351 340
352 int getZeroPadLevel(const LayerGeometryProvider *v) const; 341 int getFFTOversampling() const;
353 int getFFTSize(const LayerGeometryProvider *v) const; 342 int getFFTSize(const LayerGeometryProvider *v) const;
354 FFTModel *getFFTModel(const LayerGeometryProvider *v) const; 343 FFTModel *getFFTModel(const LayerGeometryProvider *v) const;
355 Dense3DModelPeakCache *getPeakCache(const LayerGeometryProvider *v) const; 344 Dense3DModelPeakCache *getPeakCache(const LayerGeometryProvider *v) const;
356 void invalidateFFTModels(); 345 void invalidateFFTModels();
357 346