changeset 145:4d132a06db9b

* Add mono timestretch toggle button; some more work on getting blocksize etc parameters through to plugins
author Chris Cannam
date Mon, 18 Sep 2006 16:43:17 +0000
parents d1e5cd4574a0
children a1f7d265ac79
files view/Pane.cpp widgets/PluginParameterDialog.cpp widgets/PluginParameterDialog.h
diffstat 3 files changed, 76 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/view/Pane.cpp	Fri Sep 15 16:36:04 2006 +0000
+++ b/view/Pane.cpp	Mon Sep 18 16:43:17 2006 +0000
@@ -980,6 +980,23 @@
 
             //!!! this should have its own function
 
+            //!!! want to do some cleverness to avoid dragging left/right
+            // at the same time as up/down when the user moves the mouse
+            // diagonally.
+            // e.g. have horizontal and vertical thresholds and a series
+            // of states: unknown, constrained, free
+            //
+            // -> when the mouse first moves we're in unknown state:
+            // what then? the thing we really want to avoid is moving
+            // a tiny amount in the wrong direction, because usually
+            // the problem is that to move at all is expensive -- so what
+            // do we do?
+            //
+            // -> when it's moved more than say 10px in h or v
+            // direction we lock into h or v constrained mode.  If it
+            // moves more than say 20px in the other direction
+            // subsequently, then we switch into free mode.
+
             Layer *layer = 0;
             if (getLayerCount() > 0) layer = getLayer(getLayerCount() - 1);
 
--- a/widgets/PluginParameterDialog.cpp	Fri Sep 15 16:36:04 2006 +0000
+++ b/widgets/PluginParameterDialog.cpp	Mon Sep 18 16:43:17 2006 +0000
@@ -41,6 +41,9 @@
     QDialog(parent),
     m_plugin(plugin),
     m_channel(defaultChannel),
+    m_stepSize(0),
+    m_blockSize(0),
+    m_windowType(HanningWindow),
     m_parameterBox(0)
 {
     setWindowTitle(tr("Plugin Parameters"));
@@ -221,6 +224,9 @@
 
         std::cerr << "size: " << size << ", increment: " << increment << std::endl;
 
+        //!!! deal with block and step sizes (coming from the plugin's
+        // preferences) that don't fit into the default list
+
         QComboBox *blockSizeCombo = new QComboBox;
         blockSizeCombo->setEditable(true);
         for (int i = 0; i < 14; ++i) {
@@ -229,6 +235,8 @@
             if (val == size) blockSizeCombo->setCurrentIndex(i);
         }
         blockSizeCombo->setValidator(new QIntValidator(1, pow(2, 18), this));
+        connect(blockSizeCombo, SIGNAL(valueChanged(QString)),
+                this, SLOT(blockSizeComboChanged(QString)));
         windowLayout->addWidget(blockSizeCombo, 0, 1);
 
         if (showFrequencyDomainOptions) {
@@ -243,17 +251,18 @@
                 if (val == increment) incrementCombo->setCurrentIndex(i);
             }
             incrementCombo->setValidator(new QIntValidator(1, pow(2, 18), this));
+            connect(incrementCombo, SIGNAL(valueChanged(QString)),
+                    this, SLOT(incrementComboChanged(QString)));
             windowLayout->addWidget(incrementCombo, 1, 1);
             
             windowLayout->addWidget(new QLabel(tr("Window shape:")), 2, 0);
             WindowTypeSelector *windowTypeSelector = new WindowTypeSelector;
+            connect(windowTypeSelector, SIGNAL(windowTypeChanged(WindowType type)),
+                    this, SLOT(windowTypeChanged(type)));
             windowLayout->addWidget(windowTypeSelector, 2, 1);
         }
     }
 
-    //!!! We lack a comfortable way of passing around the channel and
-    //blocksize data
-
     QHBoxLayout *hbox = new QHBoxLayout;
     grid->addLayout(hbox, 4, 0);
 
@@ -294,6 +303,41 @@
 }
 
 void
+PluginParameterDialog::getProcessingParameters(size_t &blockSize) const
+{
+    blockSize = m_blockSize;
+    return;
+}
+
+void
+PluginParameterDialog::getProcessingParameters(size_t &stepSize,
+                                               size_t &blockSize,
+                                               WindowType &windowType) const
+{
+    stepSize = m_stepSize;
+    blockSize = m_blockSize;
+    windowType = m_windowType;
+}
+
+void
+PluginParameterDialog::blockSizeComboChanged(QString text)
+{
+    m_blockSize = text.toInt();
+}
+
+void
+PluginParameterDialog::incrementComboChanged(QString text)
+{
+    m_stepSize = text.toInt();
+}
+
+void
+PluginParameterDialog::windowTypeChanged(WindowType type)
+{
+    m_windowType = type;
+}
+
+void
 PluginParameterDialog::advancedToggled()
 {
     bool visible = !m_advanced->isVisible();
--- a/widgets/PluginParameterDialog.h	Fri Sep 15 16:36:04 2006 +0000
+++ b/widgets/PluginParameterDialog.h	Mon Sep 18 16:43:17 2006 +0000
@@ -18,6 +18,8 @@
 
 #include <QDialog>
 
+#include "base/Window.h"
+
 namespace Vamp { class PluginBase; }
 class PluginParameterBox;
 class QWidget;
@@ -50,16 +52,26 @@
 
     int getChannel() const { return m_channel; }
 
+    void getProcessingParameters(size_t &blockSize) const;
+    void getProcessingParameters(size_t &stepSize, size_t &blockSize,
+                                 WindowType &windowType) const;
+
 signals:
     void pluginConfigurationChanged(QString);
 
 protected slots:
     void channelComboChanged(int);
+    void blockSizeComboChanged(QString);
+    void incrementComboChanged(QString);
+    void windowTypeChanged(WindowType type);
     void advancedToggled();
 
 protected:
     Vamp::PluginBase *m_plugin;
     int m_channel;
+    size_t m_stepSize;
+    size_t m_blockSize;
+    WindowType m_windowType;
     PluginParameterBox *m_parameterBox;
     QPushButton *m_advancedButton;
     QWidget *m_advanced;