16 #ifndef _SPECTROGRAM_LAYER_H_ 17 #define _SPECTROGRAM_LAYER_H_ 20 #include "base/Window.h" 21 #include "base/RealTime.h" 22 #include "base/Thread.h" 23 #include "base/PropertyContainer.h" 24 #include "data/model/PowerOfSqrtTwoZoomConstraint.h" 25 #include "data/model/DenseTimeValueModel.h" 26 #include "data/model/FFTModel.h" 29 #include <QWaitCondition> 39 class Dense3DModelPeakCache;
48 public PowerOfSqrtTwoZoomConstraint
67 std::vector<QRect> &extents)
const;
80 void setModel(
const DenseTimeValueModel *model);
88 int *min,
int *max,
int *deflt)
const;
92 virtual void setProperty(
const PropertyName &,
int value);
220 bool &logarithmic, QString &unit)
const;
228 virtual void toXml(QTextStream &stream, QString indent =
"",
229 QString extraAttributes =
"")
const;
359 bool getXBinRange(
View *v,
int x,
float &windowMin,
float &windowMax)
const;
360 bool getYBinRange(
View *v,
int y,
float &freqBinMin,
float &freqBinMax)
const;
365 float &freqMin,
float &freqMax,
366 float &adjFreqMin,
float &adjFreqMax)
const;
369 float &phaseMin,
float &phaseMax)
const;
397 void set(
float min,
float max) {
404 bool changed =
false;
406 if (ui <
m_min) {
m_min = ui; changed =
true; }
407 if (ui >
m_max) {
m_max = ui; changed =
true; }
415 bool changed =
false;
432 if (f < 0.f) f = 0.f;
433 if (f > 1.f) f = 1.f;
434 return (
unsigned int)(f * UINT_MAX);
444 int *binforx,
float *binfory,
447 bool &overallMagChanged)
const;
452 float displayMinFreq,
453 float displayMaxFreq,
456 bool &overallMagChanged)
const;
ColourScale m_colourScale
void setChannel(int)
Specify the channel to use from the source model.
virtual bool snapToFeatureFrame(View *v, int &frame, int &resolution, SnapType snap) const
Adjust the given frame to snap to the nearest feature, if possible.
void setColourRotation(int)
Specify the colourmap rotation for the colour scale.
bool getNormalizeHybrid() const
int m_lastPaintBlockWidth
virtual void measureDoubleClick(View *, QMouseEvent *)
FFTModel * getFFTModel(const View *v) const
virtual bool hasLightBackground() const
void invalidateFFTModels()
bool paintDrawBuffer(View *v, int w, int h, int *binforx, float *binfory, bool usePeaksCache, MagnitudeRange &overallMag, bool &overallMagChanged) const
SpectrogramLayer(Configuration=FullRangeDb)
virtual const Model * getSliceableModel() const
void invalidateImageCaches()
int getColourRotation() const
virtual void setVerticalZoomStep(int)
Set the vertical zoom step.
void illuminateLocalFeatures(View *v, QPainter &painter) const
std::map< const View *, Dense3DModelPeakCache * > PeakCacheMap
int m_lastEmittedZoomStep
PeakCacheMap m_peakCaches
virtual const Model * getModel() const
SpectrogramLayer represents waveform data (obtained from a DenseTimeValueModel) in spectrogram form.
void setColourScale(ColourScale)
Specify the scale for sample levels.
virtual ColourSignificance getLayerColourSignificance() const
This should return the degree of meaning associated with colour in this layer.
bool getYBinRange(View *v, int y, float &freqBinMin, float &freqBinMax) const
virtual void toXml(QTextStream &stream, QString indent="", QString extraAttributes="") const
Convert the layer's data (though not those of the model it refers to) into XML for file output.
virtual void paintVerticalScale(View *v, bool detailed, QPainter &paint, QRect rect) const
virtual void paint(View *v, QPainter &paint, QRect rect) const
Paint the given rectangle of this layer onto the given view using the given painter,...
WindowType getWindowType() const
int getFFTSize(const View *v) const
void set(float min, float max)
bool getNormalizeVisibleArea() const
void setMaxFrequency(int)
virtual int getPropertyRangeAndValue(const PropertyName &, int *min, int *max, int *deflt) const
ColourScale getColourScale() const
Dense3DModelPeakCache * getPeakCache(const View *v) const
virtual QString getPropertyGroupName(const PropertyName &) const
virtual int getCurrentVerticalZoomStep() const
Get the current vertical zoom step.
virtual void setProperty(const PropertyName &, int value)
bool m_normalizeVisibleArea
void setThreshold(float threshold)
Set the threshold for sample values to qualify for being shown in the FFT, in voltage units.
virtual VerticalPosition getPreferredFrameCountPosition() const
void invalidateMagnitudes()
bool getXBinRange(View *v, int x, float &windowMin, float &windowMax) const
std::map< const View *, MagnitudeRange > ViewMagMap
unsigned int convert(float f)
unsigned char getDisplayValue(View *v, float input) const
virtual PropertyList getProperties() const
void setWindowHopLevel(int level)
const DenseTimeValueModel * m_model
void setProperties(const QXmlAttributes &attributes)
Set the particular properties of a layer (those specific to the subclass) from a set of XML attribute...
void setColourMap(int map)
virtual bool getYScaleValue(const View *, int, float &, QString &) const
Return the value and unit at the given y coordinate in the given view.
bool getAdjustedYBinSourceRange(View *v, int x, int y, float &freqMin, float &freqMax, float &adjFreqMin, float &adjFreqMax) const
virtual bool setDisplayExtents(float min, float max)
Set the displayed minimum and maximum values for the y axis to the given range, if supported.
bool getXYBinSourceRange(View *v, int x, int y, float &min, float &max, float &phaseMin, float &phaseMax) const
int getZeroPadLevel() const
virtual void setLayerDormant(const View *v, bool dormant)
Indicate that a layer is not currently visible in the given view and is not expected to become visibl...
std::pair< FFTModel *, int > FFTFillPair
virtual const ZoomConstraint * getZoomConstraint() const
Return a zoom constraint object defining the supported zoom levels for this layer.
bool getSmoothedYBinRange(View *v, int y, float &freqBinMin, float &freqBinMax) const
virtual int getVerticalZoomSteps(int &defaultStep) const
Get the number of vertical zoom steps available for this layer.
virtual QString getFeatureDescription(View *v, QPoint &) const
float getEffectiveMaxFrequency() const
virtual PropertyType getPropertyType(const PropertyName &) const
void setFrequencyScale(FrequencyScale)
Specify the scale for the y axis.
bool sample(const MagnitudeRange &r)
float getThreshold() const
virtual void setMeasureRectYCoord(View *v, MeasureRect &r, bool start, int y) const
int getColourScaleWidth(QPainter &) const
int getMinFrequency() const
FrequencyScale getFrequencyScale() const
void preferenceChanged(PropertyContainer::PropertyName name)
bool updateViewMagnitudes(View *v) const
virtual QString getError(View *v) const
Return an error string if any errors have occurred while loading or processing data for the given vie...
int m_initialMaxFrequency
void setZeroPadLevel(int level)
ImageCache covers the area of the view, at view resolution.
virtual int getVerticalScaleWidth(View *v, bool detailed, QPainter &) const
virtual bool isLayerScrollable(const View *) const
This should return true if the layer can safely be scrolled automatically by a given view (simply cop...
bool getXBinSourceRange(View *v, int x, RealTime &timeMin, RealTime &timeMax) const
std::map< const View *, FFTFillPair > ViewFFTMap
virtual void paintCrosshairs(View *, QPainter &, QPoint) const
QImage m_drawBuffer
When painting, we draw directly onto the draw buffer and then copy this to the part of the image cach...
void setNormalizeHybrid(bool n)
Normalize each column to its maximum value, and then scale by the log of the (absolute) maximum value...
int getWindowSize() const
virtual bool getDisplayExtents(float &min, float &max) const
Return the minimum and maximum values within the displayed range for the y axis, if only a subset of ...
virtual QString getPropertyIconName(const PropertyName &) const
virtual QString getPropertyValueLabel(const PropertyName &, int value) const
BinDisplay getBinDisplay() const
float getEffectiveMinFrequency() const
bool getYBinSourceRange(View *v, int y, float &freqMin, float &freqMax) const
std::vector< MagnitudeRange > m_columnMags
virtual QString getPropertyLabel(const PropertyName &) const
void setNormalizeVisibleArea(bool n)
Normalize each value against the maximum in the visible region.
int getWindowHopLevel() const
View is the base class of widgets that display one or more overlaid views of data against a horizonta...
Base class for layers that can be sliced, that is, that contain models appropriate for use in a Slice...
int m_candidateFillStartFrame
virtual bool isLayerOpaque() const
This should return true if the layer completely obscures any underlying layers.
float getFrequencyForY(const View *v, int y) const
void setGain(float gain)
Set the gain multiplier for sample values in this view.
int getWindowIncrement() const
int getMaxFrequency() const
bool paintDrawBufferPeakFrequencies(View *v, int w, int h, int *binforx, int minbin, int maxbin, float displayMinFreq, float displayMaxFreq, bool logarithmic, MagnitudeRange &overallMag, bool &overallMagChanged) const
virtual void updateMeasureRectYCoords(View *v, const MeasureRect &r) const
virtual void setSynchronousPainting(bool synchronous)
Enable or disable synchronous painting.
float getYForFrequency(const View *v, float frequency) const
ViewImageCache m_imageCaches
std::map< const View *, ImageCache > ViewImageCache
bool operator==(const MagnitudeRange &r)
FrequencyScale m_frequencyScale
void setMinFrequency(int)
virtual bool getCrosshairExtents(View *, QPainter &, QPoint cursorPos, std::vector< QRect > &extents) const
QColor getColour(unsigned char index) const
void setModel(const DenseTimeValueModel *model)
void setColour(unsigned char index, QColor colour)
void setWindowType(WindowType type)
virtual RangeMapper * getNewVerticalZoomRangeMapper() const
Create and return a range mapper for vertical zoom step values.
void setNormalizeColumns(bool n)
Normalize each column to its maximum value, independent of its neighbours.
bool getNormalizeColumns() const
virtual int getCompletion(View *v) const
Return the proportion of background work complete in drawing this view, as a percentage – in most cas...
void setBinDisplay(BinDisplay)
Specify the processing of frequency bins for the y axis.
virtual RangeMapper * getNewPropertyRangeMapper(const PropertyName &) const
void rotatePalette(int distance)
virtual bool getValueExtents(float &min, float &max, bool &logarithmic, QString &unit) const
Return the minimum and maximum values for the y axis of the model in this layer, as well as whether t...