changeset 1386:05d35ce6ea72 levelpanwidget

Start incorporating level-pan widgets
author Chris Cannam
date Mon, 05 Dec 2016 15:47:40 +0000
parents a01bca26ef52
children 4c5533df5d72
files .hgsubstate main/MainWindow.cpp main/MainWindow.h main/OSCHandler.cpp
diffstat 4 files changed, 38 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Mon Dec 05 14:51:25 2016 +0000
+++ b/.hgsubstate	Mon Dec 05 15:47:40 2016 +0000
@@ -1,4 +1,4 @@
-da88a268a477c7d24d715ce5cc041157ce4907ac bqaudioio
+523a466726ea153feca116a89579b3dfdd7cf4e1 bqaudioio
 f8f6b66b9875e6a9f153c1692b9f6cb241d51bf0 bqfft
 6b0cbfca8fb7cf64f89b0a0026b63bc212b156af bqresample
 68f8e88d6d76fc4ca074166cb80979ccbfc2b6c9 bqvec
@@ -7,7 +7,7 @@
 5359bc0783c637ba486a335fbc6757e64f4e83ac icons/scalable
 3257ddb6fff110cc88f3ffeaeefa0f29d5eb3b6f piper-cpp
 5f67a29f0fc7f1b908f7cde4866173a7af337862 sv-dependency-builds
-0d5c3abc965812805053cc2b399b6696178a1cd9 svapp
+fb675409297a97468a96c703ee9fa378575c52a6 svapp
 a421e752d22c71a9cd55db40a62f053f61d9ce57 svcore
-125748a569fa96c432b4e197a4f8be58a257a573 svgui
+916b62baf7ac87aa5cd2db9c26b51fdefddfc897 svgui
 0eebd22a081a824067bf3d5de65326696feab653 vamp-plugin-sdk
--- a/main/MainWindow.cpp	Mon Dec 05 14:51:25 2016 +0000
+++ b/main/MainWindow.cpp	Mon Dec 05 15:47:40 2016 +0000
@@ -47,6 +47,7 @@
 #include "widgets/PropertyBox.h"
 #include "widgets/PropertyStack.h"
 #include "widgets/AudioDial.h"
+#include "widgets/LevelPanWidget.h"
 #include "widgets/IconLoader.h"
 #include "widgets/LayerTreeDialog.h"
 #include "widgets/ListInputDialog.h"
@@ -233,10 +234,6 @@
             (ColourDatabase::getInstance()->getColourIndex(tr("Green")));
     }
 
-    m_fader = new Fader(frame, false);
-    connect(m_fader, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
-    connect(m_fader, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
-
     m_playSpeed = new AudioDial(frame);
     m_playSpeed->setMinimum(0);
     m_playSpeed->setMaximum(120);
@@ -254,7 +251,15 @@
     connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
     connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
 
-    IconLoader il;
+    m_mainLevelPan = new LevelPanWidget(frame);
+    connect(m_mainLevelPan, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
+    connect(m_mainLevelPan, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
+    
+/*!!!
+    m_fader = new Fader(frame, false);
+    connect(m_fader, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
+    connect(m_fader, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
+*/
 
     m_playControlsSpacer = new QFrame;
 
@@ -263,10 +268,11 @@
     layout->addWidget(m_overview, 1, 0);
     layout->addWidget(m_playControlsSpacer, 1, 1);
     layout->addWidget(m_playSpeed, 1, 2);
-    layout->addWidget(m_fader, 1, 3);
+//    layout->addWidget(m_fader, 1, 3);
+    layout->addWidget(m_mainLevelPan, 1, 3);
 
     m_playControlsWidth = 
-        m_fader->width() + m_playSpeed->width() + layout->spacing() * 2;
+        m_mainLevelPan->width() + m_playSpeed->width() + layout->spacing() * 2;
 
     m_paneStack->setPropertyStackMinWidth(m_playControlsWidth
                                           + 2 + layout->spacing());
@@ -4130,8 +4136,7 @@
 void
 MainWindow::outputLevelsChanged(float left, float right)
 {
-    m_fader->setPeakLeft(left);
-    m_fader->setPeakRight(right);
+    m_mainLevelPan->setMonitoringLevels(left, right);
 }
 
 void
@@ -4327,8 +4332,10 @@
     MainWindowBase::mainModelChanged(model);
 
     if (m_playTarget || m_audioIO) {
-        connect(m_fader, SIGNAL(valueChanged(float)),
+        connect(m_mainLevelPan, SIGNAL(levelChanged(float)),
                 this, SLOT(mainModelGainChanged(float)));
+        connect(m_mainLevelPan, SIGNAL(panChanged(float)),
+                this, SLOT(mainModelPanChanged(float)));
     }
 }
 
@@ -4343,6 +4350,17 @@
 }
 
 void
+MainWindow::mainModelPanChanged(float balance)
+{
+    // this is indeed stereo balance rather than pan
+    if (m_playTarget) {
+        m_playTarget->setOutputBalance(balance);
+    } else if (m_audioIO) {
+        m_audioIO->setOutputBalance(balance);
+    }
+}
+
+void
 MainWindow::modelAboutToBeDeleted(Model *model)
 {
     if (model == m_panLayer->getModel()) {
@@ -4603,8 +4621,8 @@
     QWidget *w = dynamic_cast<QWidget *>(sender());
     if (!w) return;
 
-    if (w == m_fader) {
-        contextHelpChanged(tr("Adjust the master playback level"));
+    if (w == m_mainLevelPan) {
+        contextHelpChanged(tr("Adjust the master playback level and pan"));
     } else if (w == m_playSpeed) {
         contextHelpChanged(tr("Adjust the master playback speed"));
     }
--- a/main/MainWindow.h	Mon Dec 05 14:51:25 2016 +0000
+++ b/main/MainWindow.h	Mon Dec 05 15:47:40 2016 +0000
@@ -137,6 +137,7 @@
 
     virtual void mainModelChanged(WaveFileModel *);
     virtual void mainModelGainChanged(float);
+    virtual void mainModelPanChanged(float);
     virtual void modelAdded(Model *);
     virtual void modelAboutToBeDeleted(Model *);
 
@@ -164,7 +165,8 @@
 
 protected:
     Overview                *m_overview;
-    Fader                   *m_fader;
+//!!!    Fader                   *m_fader;
+    LevelPanWidget          *m_mainLevelPan;
     AudioDial               *m_playSpeed;
     WaveformLayer           *m_panLayer;
     
--- a/main/OSCHandler.cpp	Mon Dec 05 14:51:25 2016 +0000
+++ b/main/OSCHandler.cpp	Mon Dec 05 15:47:40 2016 +0000
@@ -26,7 +26,7 @@
 #include "framework/Document.h"
 #include "data/fileio/WavFileWriter.h"
 #include "transform/TransformFactory.h"
-#include "widgets/Fader.h"
+#include "widgets/LevelPanWidget.h"
 #include "widgets/AudioDial.h"
 
 #include <bqaudioio/SystemPlaybackTarget.h>
@@ -342,7 +342,7 @@
 
             if (property == "gain") {
                 if (value < 0.0) value = 0.0;
-                m_fader->setValue(value);
+                m_mainLevelPan->setLevel(value);
                 if (m_playTarget) m_playTarget->setOutputGain(value);
             } else if (property == "speedup") {
                 m_playSpeed->setMappedValue(value);