diff widgets/LevelPanWidget.h @ 1177:916b62baf7ac levelpanwidget

Add monitoring to level-pan widget (though not well, yet)
author Chris Cannam
date Mon, 05 Dec 2016 15:47:32 +0000
parents 77110abca8a1
children 6a6a63506e3f
line wrap: on
line diff
--- a/widgets/LevelPanWidget.h	Mon Dec 05 14:51:25 2016 +0000
+++ b/widgets/LevelPanWidget.h	Mon Dec 05 15:47:32 2016 +0000
@@ -53,6 +53,9 @@
     /// Set pan in the range [-1,1] -- will be rounded
     void setPan(float);
 
+    /// Set left and right peak monitoring levels in the range [0,1]
+    void setMonitoringLevels(float, float);
+    
     /// Specify whether the widget is editable or read-only (default editable)
     void setEditable(bool);
 
@@ -60,8 +63,8 @@
     void setIncludeMute(bool);
     
 signals:
-    void levelChanged(float);
-    void panChanged(float);
+    void levelChanged(float); // range [0,1]
+    void panChanged(float); // range [-1,1]
 
 protected:
     virtual void mousePressEvent(QMouseEvent *ev);
@@ -75,9 +78,17 @@
     
     int m_level;
     int m_pan;
+    float m_monitorLeft;
+    float m_monitorRight;
     bool m_editable;
     bool m_includeMute;
 
+    static int audioLevelToLevel(float audioLevel, bool withMute);
+    static float levelToAudioLevel(int level, bool withMute);
+
+    static int audioPanToPan(float audioPan);
+    static float panToAudioPan(int pan);
+    
     QSizeF cellSize(QRectF) const;
     QPointF cellCentre(QRectF, int level, int pan) const;
     QSizeF cellLightSize(QRectF) const;