diff main/MainWindow.cpp @ 16:3715efc38f95

* substantial enhancements to time stretcher: -- use putInput/getOutput methods to ensure the audio source always feeds it enough input, avoiding underruns due to rounding error -- add a percussion detector and an optional "Sharpen" toggle to the main window, which invokes a very basic variable speed timestretcher
author Chris Cannam
date Wed, 13 Sep 2006 17:17:42 +0000
parents 085f34c73939
children 67d54627efd3
line wrap: on
line diff
--- a/main/MainWindow.cpp	Wed Sep 13 11:56:44 2006 +0000
+++ b/main/MainWindow.cpp	Wed Sep 13 17:17:42 2006 +0000
@@ -78,6 +78,7 @@
 #include <QSettings>
 #include <QDateTime>
 #include <QProcess>
+#include <QCheckBox>
 
 #include <iostream>
 #include <cstdio>
@@ -165,10 +166,21 @@
     connect(m_playSpeed, SIGNAL(valueChanged(int)),
 	    this, SLOT(playSpeedChanged(int)));
 
-    layout->addWidget(m_paneStack, 0, 0, 1, 3);
+    m_playSharpen = new QCheckBox(frame);
+    m_playSharpen->setToolTip(tr("Sharpen"));
+    m_playSharpen->setEnabled(false);
+    m_playSharpen->setChecked(false);
+    connect(m_playSharpen, SIGNAL(clicked()),
+            this, SLOT(playSharpenToggled()));
+
+    layout->addWidget(m_paneStack, 0, 0, 1, 4);
     layout->addWidget(m_panner, 1, 0);
     layout->addWidget(m_fader, 1, 1);
     layout->addWidget(m_playSpeed, 1, 2);
+    layout->addWidget(m_playSharpen, 1, 3);
+
+    layout->setColumnStretch(0, 10);
+
     frame->setLayout(layout);
 
     connect(m_viewManager, SIGNAL(outputLevelsChanged(float, float)),
@@ -2870,7 +2882,15 @@
 			    .arg(factor != 1 ?
 				 QString("1/%1").arg(factor) :
 				 tr("Full")));
-    m_playSource->setSlowdownFactor(factor);
+    m_playSharpen->setEnabled(speed != 10);
+    bool sharpen = (speed != 10 && m_playSharpen->isChecked());
+    m_playSource->setSlowdownFactor(factor, sharpen);
+}
+
+void
+MainWindow::playSharpenToggled()
+{
+    playSpeedChanged(m_playSpeed->value());
 }
 
 void