changeset 1201:a68c25ba1153 levelpanwidget

Fix incorrect initial display levels in LevelPanWidget
author Chris Cannam
date Fri, 16 Dec 2016 19:35:57 +0000
parents 808d375a3b12
children 6828735468c9
files widgets/LevelPanWidget.cpp widgets/LevelPanWidget.h
diffstat 2 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/LevelPanWidget.cpp	Fri Dec 16 16:29:53 2016 +0000
+++ b/widgets/LevelPanWidget.cpp	Fri Dec 16 19:35:57 2016 +0000
@@ -43,6 +43,8 @@
     m_includeMute(true)
 {
     setToolTip(tr("Drag vertically to adjust level, horizontally to adjust pan"));
+    setLevel(1.0);
+    setPan(0.0);
 }
 
 LevelPanWidget::~LevelPanWidget()
@@ -124,7 +126,8 @@
 float
 LevelPanWidget::getLevel() const
 {
-    return levelToAudioLevel(m_level, m_includeMute);
+    float flevel = levelToAudioLevel(m_level, m_includeMute);
+    return flevel;
 }
 
 int
@@ -196,14 +199,12 @@
 void
 LevelPanWidget::emitLevelChanged()
 {
-    cerr << "emitting levelChanged(" << getLevel() << ")" << endl;
     emit levelChanged(getLevel());
 }
 
 void
 LevelPanWidget::emitPanChanged()
 {
-    cerr << "emitting panChanged(" << getPan() << ")" << endl;
     emit panChanged(getPan());
 }
 
--- a/widgets/LevelPanWidget.h	Fri Dec 16 16:29:53 2016 +0000
+++ b/widgets/LevelPanWidget.h	Fri Dec 16 19:35:57 2016 +0000
@@ -29,7 +29,8 @@
     LevelPanWidget(QWidget *parent = 0);
     ~LevelPanWidget();
     
-    /// Return level as a gain value in the range [0,1]
+    /// Return level as a gain value. The basic level range is [0,1] but the
+    /// gain scale may go up to 4.0
     float getLevel() const; 
     
     /// Return pan as a value in the range [-1,1]
@@ -47,10 +48,11 @@
     QSize sizeHint() const;
                                                
 public slots:
-    /// Set level in the range [0,1] -- will be rounded
+    /// Set level. The basic level range is [0,1] but the scale may go
+    /// higher. The value will be rounded.
     void setLevel(float);
 
-    /// Set pan in the range [-1,1] -- will be rounded
+    /// Set pan in the range [-1,1]. The value will be rounded
     void setPan(float);
 
     /// Set left and right peak monitoring levels in the range [0,1]