changeset 127:541b3e357979

remove playspeed, sharpen and mono from the MainWindow connect mainWindow to the playspeed changes of the TimeStretchFilter
author lbajardsilogic
date Thu, 08 Nov 2007 10:31:17 +0000
parents c26c73ca6d37
children 247ea6460ec2
files sv/filter/TimeStretchFilter.cpp sv/filter/TimeStretchFilter.h sv/main/MainWindow.cpp sv/main/MainWindow.h
diffstat 4 files changed, 38 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/sv/filter/TimeStretchFilter.cpp	Tue Oct 23 15:24:06 2007 +0000
+++ b/sv/filter/TimeStretchFilter.cpp	Thu Nov 08 10:31:17 2007 +0000
@@ -20,6 +20,7 @@
 #include  "DSP.h"
 
 #include "system/System.h"
+#include "main/MainWindow.h"
 
 /*float *audioframe;
 float *prev_audioframe;
@@ -93,6 +94,9 @@
 
 	hanning(window, m_framesize);
 
+	connect(this, SIGNAL(playSpeedChanged(float)),
+		MainWindow::instance(), SLOT(playSpeedChanged(float)));
+
 	/***************************/
 }
 
@@ -231,6 +235,8 @@
 		if(value == 0){
 			hopfactor=1;
 		}
+		emit playSpeedChanged(hopfactor);
+
 	} else if (name == "Pitch") {
 		if (value > 0){
 			m_interpfactor=1.0+((m_pmaxfactor-1)*(((float)value)/100.0));
--- a/sv/filter/TimeStretchFilter.h	Tue Oct 23 15:24:06 2007 +0000
+++ b/sv/filter/TimeStretchFilter.h	Thu Nov 08 10:31:17 2007 +0000
@@ -40,6 +40,9 @@
 	virtual size_t getRequiredInputSamples(size_t outputSamplesNeeded);
 	size_t getRequiredSkipSamples();
 
+signals: 
+	void playSpeedChanged(float);
+
 protected:
 
 	bool m_bypass;
--- a/sv/main/MainWindow.cpp	Tue Oct 23 15:24:06 2007 +0000
+++ b/sv/main/MainWindow.cpp	Thu Nov 08 10:31:17 2007 +0000
@@ -213,7 +213,7 @@
     connect(m_fader, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
     connect(m_fader, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
 
-    m_playSpeed = new AudioDial(frame);
+  /*  m_playSpeed = new AudioDial(frame);
     m_playSpeed->setMinimum(0);
     m_playSpeed->setMaximum(200);
     m_playSpeed->setValue(100);
@@ -253,12 +253,13 @@
     connect(m_playMono, SIGNAL(clicked()), this, SLOT(playMonoToggled()));
     connect(m_playMono, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
     connect(m_playMono, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
-
-    QSettings settings;
+	*/
+
+    /*QSettings settings;
     settings.beginGroup("MainWindow");
     m_playSharpen->setChecked(settings.value("playsharpen", true).toBool());
     m_playMono->setChecked(settings.value("playmono", false).toBool());
-    settings.endGroup();
+    settings.endGroup();*/
 
 	m_infoWidget = new InfoWidget();
 	m_searchWidget = new SearchWidget();
@@ -274,9 +275,9 @@
 	auxlayout->addWidget(m_paneStack, 0, 0, 1, 5);
     auxlayout->addWidget(m_overview, 1, 0);
     auxlayout->addWidget(m_fader, 1, 1);
-    auxlayout->addWidget(m_playSpeed, 1, 2);
-    auxlayout->addWidget(m_playSharpen, 1, 3);
-    auxlayout->addWidget(m_playMono, 1, 4);
+    //auxlayout->addWidget(m_playSpeed, 1, 2);
+    //auxlayout->addWidget(m_playSharpen, 1, 3);
+    //auxlayout->addWidget(m_playMono, 1, 4);
 	QWidget *auxwidget = new QWidget;
 	auxwidget->setLayout(auxlayout);
 
@@ -316,8 +317,8 @@
 	layout->addWidget(m_rightExpandWidget, 0, 0);
 
     m_paneStack->setPropertyStackMinWidth
-        (m_fader->width() + m_playSpeed->width() + m_playSharpen->width() +
-         m_playMono->width() + layout->spacing() * 4);
+        (m_fader->width() /*+ m_playSpeed->width() + m_playSharpen->width() +
+         m_playMono->width()*/ + layout->spacing() * 4);
 
     layout->setColumnStretch(0, 10);
 
@@ -3988,36 +3989,17 @@
 }
 
 void
-MainWindow::playSpeedChanged(int position)
+MainWindow::playSpeedChanged(float value)
 {
-    PlaySpeedRangeMapper mapper(0, 200);
-
-    float percent = m_playSpeed->mappedValue();
-
-    float factor = mapper.getFactorForValue(percent);
-
-//    float factor = mapper.getFactorForPosition(position);
-//    float percent = mapper.getValueForPosition(position);
-
-    std::cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << std::endl;
-
-//!!!    bool slow = (position < 100);
-    bool something = (position != 100);
-/*!!!
-    int pc = lrintf(percent);
-
-    m_playSpeed->setToolTip(tr("Playback speed: %1%2%")
-                            .arg(!slow ? "+" : "")
-			    .arg(pc));
-*/
-    m_playSharpen->setEnabled(something);
-    m_playMono->setEnabled(something);
-    bool sharpen = (something && m_playSharpen->isChecked());
-    bool mono = (something && m_playMono->isChecked());
-    m_playSource->setTimeStretch(factor, sharpen, mono);
+	/*
+	The value of the speed factor have been changed
+	in the TimeStretchFilter class.
+	The new hopfactor is given by value
+	*/
+
 }
 
-void
+/*void
 MainWindow::playSharpenToggled()
 {
     QSettings settings;
@@ -4038,7 +4020,7 @@
 
     playSpeedChanged(m_playSpeed->value());
 }    
-
+*/
 void
 MainWindow::playbackFrameChanged(unsigned long frame)
 {
@@ -4609,9 +4591,9 @@
                 if (value < 0.0) value = 0.0;
                 m_fader->setValue(value);
                 if (m_playTarget) m_playTarget->setOutputGain(value);
-            } else if (property == "speedup") {
+            } /*else if (property == "speedup") {
                 m_playSpeed->setMappedValue(value);
-            } else if (property == "overlays") {
+            }*/ else if (property == "overlays") {
                 if (value < 0.5) {
                     m_viewManager->setOverlayMode(ViewManager::NoOverlays);
                 } else if (value < 1.5) {
@@ -4845,13 +4827,13 @@
 
     if (w == m_fader) {
         contextHelpChanged(tr("Adjust the master playback level"));
-    } else if (w == m_playSpeed) {
+    } /*else if (w == m_playSpeed) {
         contextHelpChanged(tr("Adjust the master playback speed"));
     } else if (w == m_playSharpen && w->isEnabled()) {
         contextHelpChanged(tr("Toggle transient sharpening for playback time scaling"));
     } else if (w == m_playMono && w->isEnabled()) {
         contextHelpChanged(tr("Toggle mono mode for playback time scaling"));
-    }
+    }*/
 }
 
 void
--- a/sv/main/MainWindow.h	Tue Oct 23 15:24:06 2007 +0000
+++ b/sv/main/MainWindow.h	Thu Nov 08 10:31:17 2007 +0000
@@ -209,9 +209,9 @@
 
     void playLoopToggled();
     void playSelectionToggled();
-    void playSpeedChanged(int);
-    void playSharpenToggled();
-    void playMonoToggled();
+    void playSpeedChanged(float);
+    //void playSharpenToggled();
+    //void playMonoToggled();
     void sampleRateMismatch(size_t, size_t, bool);
     void audioOverloadPluginDisabled();
 
@@ -312,9 +312,9 @@
     ViewManager             *m_viewManager;
     Overview                *m_overview;
     Fader                   *m_fader;
-    AudioDial               *m_playSpeed;
-    QPushButton             *m_playSharpen;
-    QPushButton             *m_playMono;
+    //AudioDial               *m_playSpeed;
+    //QPushButton             *m_playSharpen;
+    //QPushButton             *m_playMono;
     WaveformLayer           *m_panLayer;
     Layer                   *m_timeRulerLayer;