diff layer/SliceLayer.h @ 1386:fc3d89f88690 spectrogramparam

Use log-frequency rather than log-bin for calculating x coord in spectrum. This has the advantage that frequency positions don't move when we change the window size or oversampling ratio, but it does give us an unhelpfully large amount of space for very low frequencies - to be considered
author Chris Cannam
date Mon, 12 Nov 2018 11:34:34 +0000
parents 86f319dd6ab9
children 1eb560b363e7
line wrap: on
line diff
--- a/layer/SliceLayer.h	Thu Nov 08 12:55:36 2018 +0000
+++ b/layer/SliceLayer.h	Mon Nov 12 11:34:34 2018 +0000
@@ -121,9 +121,22 @@
     void modelAboutToBeDeleted(Model *);
 
 protected:
+    /// Convert a (possibly non-integral) bin into x-coord. May be overridden
     virtual double getXForBin(const LayerGeometryProvider *, double bin) const;
+    
+    /// Convert an x-coord into (possibly non-integral) bin. May be overridden
     virtual double getBinForX(const LayerGeometryProvider *, double x) const;
 
+    /// Convert a point such as a bin number into x-coord, given max &
+    /// min. For use by getXForBin etc
+    double getXForScalePoint(const LayerGeometryProvider *,
+                             double p, double pmin, double pmax) const;
+
+    /// Convert an x-coord into a point such as a bin number, given
+    /// max & min. For use by getBinForX etc
+    double getScalePointForX(const LayerGeometryProvider *,
+                             double x, double pmin, double pmax) const;
+
     virtual double getYForValue(const LayerGeometryProvider *v, double value, double &norm) const;
     virtual double getValueForY(const LayerGeometryProvider *v, double y) const;