#include <SpectrogramLayer.h>
Inherits SliceableLayer, and PowerOfSqrtTwoZoomConstraint.
Inheritance diagram for SpectrogramLayer:


Definition at line 46 of file SpectrogramLayer.h.
Public Types | |
| enum | Configuration { FullRangeDb, MelodicRange, MelodicPeaks } |
| enum | ColourScale { LinearColourScale, MeterColourScale, dBSquaredColourScale, dBColourScale, PhaseColourScale } |
| enum | FrequencyScale { LinearFrequencyScale, LogFrequencyScale } |
| enum | BinDisplay { AllBins, PeakBins, PeakFrequencies } |
| enum | VerticalPosition { PositionTop, PositionMiddle, PositionBottom } |
| enum | SnapType { SnapLeft, SnapRight, SnapNearest, SnapNeighbouring } |
| enum | ColourSignificance { ColourAbsent, ColourIrrelevant, ColourDistinguishes, ColourAndBackgroundSignificant, ColourHasMeaningfulValue } |
| enum | PropertyType { ToggleProperty, RangeProperty, ValueProperty, ColourProperty, UnitsProperty, InvalidProperty } |
| typedef QString | PropertyName |
| typedef std::vector< PropertyName > | PropertyList |
| enum | RoundingDirection { RoundDown, RoundUp, RoundNearest } |
Public Slots | |
| void | showLayer (View *, bool show) |
| virtual void | setProperty (const PropertyName &, int value) |
| Set a property. | |
| virtual void | setProperty (QString nameString, QString valueString) |
| Set a property using a fuzzy match. | |
| virtual void | setPropertyWithCommand (const PropertyName &, int value) |
| Set a property using a command, supporting undo and redo. | |
| virtual void | setPropertyWithCommand (QString nameString, QString valueString) |
| As above, but using a command. | |
Signals | |
| void | sliceableModelReplaced (const Model *modelToBeReplaced, const Model *replacement) |
| void | modelChanged () |
| void | modelChanged (size_t startFrame, size_t endFrame) |
| void | modelCompletionChanged () |
| void | modelAlignmentCompletionChanged () |
| void | modelReplaced () |
| void | layerParametersChanged () |
| void | layerParameterRangesChanged () |
| void | layerMeasurementRectsChanged () |
| void | layerNameChanged () |
| void | verticalZoomChanged () |
| void | propertyChanged (PropertyContainer::PropertyName) |
Public Member Functions | |
| SpectrogramLayer (Configuration=FullRangeDb) | |
| ~SpectrogramLayer () | |
| virtual const ZoomConstraint * | getZoomConstraint () const |
| Return a zoom constraint object defining the supported zoom levels for this layer. | |
| virtual const Model * | getModel () const |
| virtual void | paint (View *v, QPainter &paint, QRect rect) const |
| virtual int | getVerticalScaleWidth (View *v, QPainter &) const |
| virtual void | paintVerticalScale (View *v, QPainter &paint, QRect rect) const |
| virtual bool | getCrosshairExtents (View *, QPainter &, QPoint cursorPos, std::vector< QRect > &extents) const |
| virtual void | paintCrosshairs (View *, QPainter &, QPoint) const |
| virtual QString | getFeatureDescription (View *v, QPoint &) const |
| virtual bool | snapToFeatureFrame (View *v, int &frame, size_t &resolution, SnapType snap) const |
| Adjust the given frame to snap to the nearest feature, if possible. | |
| virtual void | measureDoubleClick (View *, QMouseEvent *) |
| virtual bool | hasLightBackground () const |
| void | setModel (const DenseTimeValueModel *model) |
| virtual PropertyList | getProperties () const |
| Get a list of the names of all the supported properties on this container. | |
| virtual QString | getPropertyLabel (const PropertyName &) const |
| virtual QString | getPropertyIconName (const PropertyName &) const |
| virtual PropertyType | getPropertyType (const PropertyName &) const |
| virtual QString | getPropertyGroupName (const PropertyName &) const |
| virtual int | getPropertyRangeAndValue (const PropertyName &, int *min, int *max, int *deflt) const |
| virtual QString | getPropertyValueLabel (const PropertyName &, int value) const |
| virtual RangeMapper * | getNewPropertyRangeMapper (const PropertyName &) const |
| virtual void | setProperty (const PropertyName &, int value) |
| void | setChannel (int) |
| Specify the channel to use from the source model. | |
| int | getChannel () const |
| void | setWindowSize (size_t) |
| size_t | getWindowSize () const |
| void | setWindowHopLevel (size_t level) |
| size_t | getWindowHopLevel () const |
| void | setWindowType (WindowType type) |
| WindowType | getWindowType () const |
| void | setZeroPadLevel (size_t level) |
| size_t | getZeroPadLevel () const |
| void | setGain (float gain) |
| Set the gain multiplier for sample values in this view. | |
| float | getGain () const |
| void | setThreshold (float threshold) |
| Set the threshold for sample values to qualify for being shown in the FFT, in voltage units. | |
| float | getThreshold () const |
| void | setMinFrequency (size_t) |
| size_t | getMinFrequency () const |
| void | setMaxFrequency (size_t) |
| size_t | getMaxFrequency () const |
| void | setColourScale (ColourScale) |
| Specify the scale for sample levels. | |
| ColourScale | getColourScale () const |
| void | setFrequencyScale (FrequencyScale) |
| Specify the scale for the y axis. | |
| FrequencyScale | getFrequencyScale () const |
| void | setBinDisplay (BinDisplay) |
| Specify the processing of frequency bins for the y axis. | |
| BinDisplay | getBinDisplay () const |
| void | setNormalizeColumns (bool n) |
| bool | getNormalizeColumns () const |
| void | setNormalizeVisibleArea (bool n) |
| bool | getNormalizeVisibleArea () const |
| void | setColourMap (int map) |
| int | getColourMap () const |
| void | setColourRotation (int) |
| Specify the colourmap rotation for the colour scale. | |
| int | getColourRotation () const |
| virtual VerticalPosition | getPreferredFrameCountPosition () const |
| virtual bool | isLayerOpaque () const |
| This should return true if the layer completely obscures any underlying layers. | |
| virtual ColourSignificance | getLayerColourSignificance () const |
| This should return the degree of meaning associated with colour in this layer. | |
| float | getYForFrequency (const View *v, float frequency) const |
| float | getFrequencyForY (const View *v, int y) const |
| virtual int | getCompletion (View *v) const |
| Return the proportion of background work complete in drawing this view, as a percentage -- in most cases this will be the value returned by pointer from a call to the underlying model's isReady(int *) call. | |
| 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 the layer is configured to use a logarithmic y axis display. | |
| 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 the whole range of the model (returned by getValueExtents) is being displayed. | |
| virtual bool | setDisplayExtents (float min, float max) |
| Set the displayed minimum and maximum values for the y axis to the given range, if supported. | |
| virtual bool | getYScaleValue (const View *, int, float &, QString &) const |
| Return the value and unit at the given y coordinate in the given view. | |
| 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. | |
| void | setProperties (const QXmlAttributes &attributes) |
| Set the particular properties of a layer (those specific to the subclass) from a set of XML attributes. | |
| 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 visible in the near future (for example because the user has explicitly removed or hidden it). | |
| virtual bool | isLayerScrollable (const View *) const |
| This should return true if the layer can safely be scrolled automatically by a given view (simply copying the existing data and then refreshing the exposed area) without altering its meaning. | |
| virtual int | getVerticalZoomSteps (int &defaultStep) const |
| Get the number of vertical zoom steps available for this layer. | |
| virtual int | getCurrentVerticalZoomStep () const |
| Get the current vertical zoom step. | |
| virtual void | setVerticalZoomStep (int) |
| Set the vertical zoom step. | |
| virtual RangeMapper * | getNewVerticalZoomRangeMapper () const |
| Create and return a range mapper for vertical zoom step values. | |
| virtual const Model * | getSliceableModel () const |
| virtual Model * | getModel () |
| virtual bool | supportsOtherZoomLevels () const |
| Return true if this layer can handle zoom levels other than those supported by its zoom constraint (presumably less efficiently or accurately than the officially supported zoom levels). | |
| virtual VerticalPosition | getPreferredTimeRulerPosition () const |
| virtual QString | getPropertyContainerIconName () const |
| virtual QString | getPropertyContainerName () const |
| virtual void | setPresentationName (QString name) |
| virtual QString | getLayerPresentationName () const |
| virtual QPixmap | getLayerPresentationPixmap (QSize) const |
| virtual void | paintMeasurementRects (View *, QPainter &, bool showFocus, QPoint focusPoint) const |
| virtual bool | nearestMeasurementRectChanged (View *, QPoint prev, QPoint now) const |
| virtual void | drawStart (View *, QMouseEvent *) |
| virtual void | drawDrag (View *, QMouseEvent *) |
| virtual void | drawEnd (View *, QMouseEvent *) |
| virtual void | eraseStart (View *, QMouseEvent *) |
| virtual void | eraseDrag (View *, QMouseEvent *) |
| virtual void | eraseEnd (View *, QMouseEvent *) |
| virtual void | editStart (View *, QMouseEvent *) |
| virtual void | editDrag (View *, QMouseEvent *) |
| virtual void | editEnd (View *, QMouseEvent *) |
| virtual void | measureStart (View *, QMouseEvent *) |
| virtual void | measureDrag (View *, QMouseEvent *) |
| virtual void | measureEnd (View *, QMouseEvent *) |
| virtual bool | haveCurrentMeasureRect () const |
| virtual void | deleteCurrentMeasureRect () |
| virtual bool | editOpen (View *, QMouseEvent *) |
| Open an editor on the item under the mouse (e.g. | |
| virtual void | moveSelection (Selection, size_t) |
| virtual void | resizeSelection (Selection, Selection) |
| virtual void | deleteSelection (Selection) |
| virtual void | copy (View *, Selection, Clipboard &) |
| virtual bool | paste (View *, const Clipboard &, int, bool) |
| Paste from the given clipboard onto the layer at the given frame offset. | |
| virtual bool | isLayerEditable () const |
| This should return true if the layer can be edited by the user. | |
| virtual void | setObjectName (const QString &name) |
| virtual void | toBriefXml (QTextStream &stream, QString indent="", QString extraAttributes="") const |
| Produce XML containing the layer's ID and type. | |
| virtual void | addMeasurementRect (const QXmlAttributes &) |
| Add a measurement rectangle from the given XML attributes (presumably taken from a measurement element). | |
| virtual bool | isLayerDormant (const View *v) const |
| Return whether the layer is dormant (i.e. | |
| virtual PlayParameters * | getPlayParameters () |
| virtual bool | needsTextLabelHeight () const |
| virtual bool | hasTimeXAxis () const |
| virtual bool | getXScaleValue (const View *v, int x, float &value, QString &unit) const |
| Return the value and unit at the given x coordinate in the given view. | |
| virtual bool | getYScaleDifference (const View *v, int y0, int y1, float &diff, QString &unit) const |
| Return the difference between the values at the given y coordinates in the given view, and the unit of the difference. | |
| virtual QString | getPropertyLabel (const PropertyName &) const =0 |
| Return the human-readable (and i18n'ised) name of a property. | |
| virtual PropertyType | getPropertyType (const PropertyName &) const |
| Return the type of the given property, or InvalidProperty if the property is not supported on this container. | |
| virtual QString | getPropertyIconName (const PropertyName &) const |
| Return an icon for the property, if any. | |
| virtual QString | getPropertyGroupName (const PropertyName &) const |
| If this property has something in common with other properties on this container, return a name that can be used to group them (in order to save screen space, for example). | |
| virtual int | getPropertyRangeAndValue (const PropertyName &, int *min, int *max, int *deflt) const |
| Return the minimum and maximum values for the given property and its current value in this container. | |
| virtual QString | getPropertyValueLabel (const PropertyName &, int value) const |
| If the given property is a ValueProperty, return the display label to be used for the given value for that property. | |
| virtual RangeMapper * | getNewPropertyRangeMapper (const PropertyName &) const |
| If the given property is a RangeProperty, return a new RangeMapper object mapping its integer range onto an underlying floating point value range for human-intelligible display, if appropriate. | |
| virtual QString | toXmlString (QString indent="", QString extraAttributes="") const |
| Convert this exportable object to XML in a string. | |
| virtual size_t | getNearestBlockSize (size_t requestedBlockSize, RoundingDirection dir=RoundNearest) const |
| Given the "ideal" block size (frames per pixel) for a given zoom level, return the nearest viable block size for this constraint. | |
| virtual size_t | getNearestBlockSize (size_t requestedBlockSize, int &type, int &power, RoundingDirection dir=RoundNearest) const |
| virtual size_t | getMinCachePower () const |
| virtual size_t | getMaxZoomLevel () const |
| Return the maximum zoom level within range for this constraint. | |
Static Public Member Functions | |
| static QString | encodeEntities (QString) |
| static QString | encodeColour (QColor) |
| static int | getObjectExportId (const void *) |
Protected Types | |
| enum | { NO_VALUE = 0 } |
| typedef std::map< const View *, PixmapCache > | ViewPixmapCache |
| typedef std::pair< FFTModel *, int > | FFTFillPair |
| typedef std::map< const View *, FFTFillPair > | ViewFFTMap |
| typedef std::vector< float > | FloatVector |
| typedef std::map< const View *, MagnitudeRange > | ViewMagMap |
| typedef std::set< MeasureRect > | MeasureRectSet |
Protected Slots | |
| void | cacheInvalid () |
| void | cacheInvalid (size_t startFrame, size_t endFrame) |
| void | preferenceChanged (PropertyContainer::PropertyName name) |
| void | fillTimerTimedOut () |
Protected Member Functions | |
| void | invalidatePixmapCaches () |
| void | invalidatePixmapCaches (size_t startFrame, size_t endFrame) |
| void | initialisePalette () |
| void | rotatePalette (int distance) |
| unsigned char | getDisplayValue (View *v, float input) const |
| float | getInputForDisplayValue (unsigned char uc) const |
| int | getColourScaleWidth (QPainter &) const |
| void | illuminateLocalFeatures (View *v, QPainter &painter) const |
| float | getEffectiveMinFrequency () const |
| float | getEffectiveMaxFrequency () const |
| bool | getXBinRange (View *v, int x, float &windowMin, float &windowMax) const |
| bool | getYBinRange (View *v, int y, float &freqBinMin, float &freqBinMax) const |
| bool | getYBinSourceRange (View *v, int y, float &freqMin, float &freqMax) const |
| bool | getAdjustedYBinSourceRange (View *v, int x, int y, float &freqMin, float &freqMax, float &adjFreqMin, float &adjFreqMax) const |
| bool | getXBinSourceRange (View *v, int x, RealTime &timeMin, RealTime &timeMax) const |
| bool | getXYBinSourceRange (View *v, int x, int y, float &min, float &max, float &phaseMin, float &phaseMax) const |
| size_t | getWindowIncrement () const |
| size_t | getZeroPadLevel (const View *v) const |
| size_t | getFFTSize (const View *v) const |
| FFTModel * | getFFTModel (const View *v) const |
| void | invalidateFFTModels () |
| void | invalidateMagnitudes () |
| bool | updateViewMagnitudes (View *v) const |
| virtual void | updateMeasureRectYCoords (View *v, const MeasureRect &r) const |
| virtual void | setMeasureRectYCoord (View *v, MeasureRect &r, bool start, int y) const |
| void | connectSignals (const Model *) |
| virtual size_t | alignToReference (View *v, size_t frame) const |
| virtual size_t | alignFromReference (View *v, size_t frame) const |
| bool | clipboardHasDifferentAlignment (View *v, const Clipboard &clip) const |
| void | addMeasureRectToSet (const MeasureRect &r) |
| void | deleteMeasureRectFromSet (const MeasureRect &r) |
| void | updateMeasurePixrects (View *v) const |
| virtual void | updateMeasureRectYCoords (View *v, const MeasureRect &r) const |
| virtual void | setMeasureRectYCoord (View *v, MeasureRect &r, bool start, int y) const |
| virtual void | setMeasureRectFromPixrect (View *v, MeasureRect &r, QRect pixrect) const |
| MeasureRectSet::const_iterator | findFocusedMeasureRect (QPoint) const |
| void | paintMeasurementRect (View *v, QPainter &paint, const MeasureRect &r, bool focus) const |
| virtual bool | convertPropertyStrings (QString nameString, QString valueString, PropertyName &name, int &value) |
Protected Attributes | |
| const DenseTimeValueModel * | m_model |
| int | m_channel |
| size_t | m_windowSize |
| WindowType | m_windowType |
| size_t | m_windowHopLevel |
| size_t | m_zeroPadLevel |
| size_t | m_fftSize |
| float | m_gain |
| float | m_initialGain |
| float | m_threshold |
| float | m_initialThreshold |
| int | m_colourRotation |
| int | m_initialRotation |
| size_t | m_minFrequency |
| size_t | m_maxFrequency |
| size_t | m_initialMaxFrequency |
| ColourScale | m_colourScale |
| int | m_colourMap |
| QColor | m_crosshairColour |
| FrequencyScale | m_frequencyScale |
| BinDisplay | m_binDisplay |
| bool | m_normalizeColumns |
| bool | m_normalizeVisibleArea |
| int | m_lastEmittedZoomStep |
| int | m_lastPaintBlockWidth |
| RealTime | m_lastPaintTime |
| Palette | m_palette |
| ViewPixmapCache | m_pixmapCaches |
| QImage | m_drawBuffer |
| QTimer * | m_updateTimer |
| size_t | m_candidateFillStartFrame |
| bool | m_exiting |
| ViewFFTMap | m_fftModels |
| Model * | m_sliceableModel |
| ViewMagMap | m_viewMags |
| std::vector< MagnitudeRange > | m_columnMags |
| MeasureRectSet | m_measureRects |
| MeasureRect | m_draggingRect |
| bool | m_haveDraggingRect |
| bool | m_haveCurrentMeasureRect |
| QPoint | m_currentMeasureRectPoint |
| QString | m_presentationName |
Classes | |
| struct | LayerRange |
| class | MagnitudeRange |
| class | Palette |
| struct | PixmapCache |
typedef std::map<const View *, PixmapCache> SpectrogramLayer::ViewPixmapCache [protected] |
Definition at line 291 of file SpectrogramLayer.h.
typedef std::pair<FFTModel *, int> SpectrogramLayer::FFTFillPair [protected] |
Definition at line 343 of file SpectrogramLayer.h.
typedef std::map<const View *, FFTFillPair> SpectrogramLayer::ViewFFTMap [protected] |
Definition at line 344 of file SpectrogramLayer.h.
typedef std::vector<float> SpectrogramLayer::FloatVector [protected] |
Definition at line 345 of file SpectrogramLayer.h.
typedef std::map<const View *, MagnitudeRange> SpectrogramLayer::ViewMagMap [protected] |
Definition at line 397 of file SpectrogramLayer.h.
typedef std::set<MeasureRect> Layer::MeasureRectSet [protected, inherited] |
typedef QString PropertyContainer::PropertyName [inherited] |
Definition at line 35 of file PropertyContainer.h.
typedef std::vector<PropertyName> PropertyContainer::PropertyList [inherited] |
Definition at line 36 of file PropertyContainer.h.
Definition at line 134 of file SpectrogramLayer.h.
Definition at line 149 of file SpectrogramLayer.h.
anonymous enum [protected] |
enum Layer::VerticalPosition [inherited] |
enum Layer::SnapType [inherited] |
enum Layer::ColourSignificance [inherited] |
enum PropertyContainer::PropertyType [inherited] |
Definition at line 38 of file PropertyContainer.h.
enum ZoomConstraint::RoundingDirection [inherited] |
| SpectrogramLayer::SpectrogramLayer | ( | Configuration | = FullRangeDb |
) |
Definition at line 47 of file SpectrogramLayer.cpp.
References FullRangeDb, Preferences::getInstance(), Preferences::getWindowType(), initialisePalette(), LinearColourScale, LogFrequencyScale, m_initialMaxFrequency, MelodicPeaks, MelodicRange, PeakFrequencies, preferenceChanged(), PropertyContainer::propertyChanged(), setBinDisplay(), setColourMap(), setColourScale(), setFrequencyScale(), setMaxFrequency(), setMinFrequency(), setNormalizeColumns(), setWindowHopLevel(), setWindowSize(), setWindowType(), and ColourMapper::Sunset.
| SpectrogramLayer::~SpectrogramLayer | ( | ) |
Definition at line 110 of file SpectrogramLayer.cpp.
References invalidateFFTModels(), and m_updateTimer.
| virtual const ZoomConstraint* SpectrogramLayer::getZoomConstraint | ( | ) | const [inline, virtual] |
Return a zoom constraint object defining the supported zoom levels for this layer.
If this returns zero, the layer will support any integer zoom level.
Reimplemented from Layer.
Definition at line 57 of file SpectrogramLayer.h.
| virtual const Model* SpectrogramLayer::getModel | ( | ) | const [inline, virtual] |
| void SpectrogramLayer::paint | ( | View * | v, | |
| QPainter & | paint, | |||
| QRect | rect | |||
| ) | const [virtual] |
Implements Layer.
Definition at line 1673 of file SpectrogramLayer.cpp.
References FFTModel::AllPeaks, RealTime::fromMilliseconds(), RealTime::fromTimeval(), SpectrogramLayer::Palette::getColour(), getDisplayValue(), getEffectiveMaxFrequency(), getEffectiveMinFrequency(), getFFTModel(), getFFTSize(), Preferences::getInstance(), FFTModel::getMagnitudeAt(), SpectrogramLayer::MagnitudeRange::getMax(), SpectrogramLayer::MagnitudeRange::getMin(), FFTModel::getNormalizedMagnitudeAt(), FFTModel::getPeakFrequencies(), FFTModel::getPhaseAt(), Model::getSampleRate(), Preferences::getSpectrogramSmoothing(), View::getStartFrame(), FFTModel::getWidth(), getWindowIncrement(), getXBinRange(), getZeroPadLevel(), View::getZoomLevel(), illuminateLocalFeatures(), FFTModel::isColumnAvailable(), Layer::isLayerDormant(), DenseThreeDimensionalModel::isLocalPeak(), Model::isOK(), DenseThreeDimensionalModel::isOverThreshold(), Model::isReady(), SpectrogramLayer::MagnitudeRange::isSet(), LogFrequencyScale, m_binDisplay, m_candidateFillStartFrame, m_colourScale, m_columnMags, m_drawBuffer, m_fftSize, m_frequencyScale, m_gain, m_lastPaintBlockWidth, m_lastPaintTime, m_maxFrequency, m_minFrequency, m_model, m_normalizeColumns, m_normalizeVisibleArea, m_palette, m_pixmapCaches, m_threshold, m_updateTimer, m_viewMags, PeakBins, PeakFrequencies, PhaseColourScale, SpectrogramLayer::PixmapCache::pixmap, FFTModel::resume(), SpectrogramLayer::MagnitudeRange::sample(), Layer::setLayerDormant(), Preferences::SpectrogramInterpolated, Preferences::SpectrogramZeroPaddedAndInterpolated, SpectrogramLayer::PixmapCache::startFrame, FFTModel::suspendWrites(), updateViewMagnitudes(), SpectrogramLayer::PixmapCache::validArea, and SpectrogramLayer::PixmapCache::zoomLevel.
| int SpectrogramLayer::getVerticalScaleWidth | ( | View * | v, | |
| QPainter & | ||||
| ) | const [virtual] |
Reimplemented from Layer.
Definition at line 2800 of file SpectrogramLayer.cpp.
References getColourScaleWi