comparison 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
comparison
equal deleted inserted replaced
15:cc566264c935 16:3715efc38f95
76 #include <QProcess> 76 #include <QProcess>
77 #include <QShortcut> 77 #include <QShortcut>
78 #include <QSettings> 78 #include <QSettings>
79 #include <QDateTime> 79 #include <QDateTime>
80 #include <QProcess> 80 #include <QProcess>
81 #include <QCheckBox>
81 82
82 #include <iostream> 83 #include <iostream>
83 #include <cstdio> 84 #include <cstdio>
84 #include <errno.h> 85 #include <errno.h>
85 86
163 m_playSpeed->setToolTip(tr("Playback speed: Full")); 164 m_playSpeed->setToolTip(tr("Playback speed: Full"));
164 m_playSpeed->setDefaultValue(10); 165 m_playSpeed->setDefaultValue(10);
165 connect(m_playSpeed, SIGNAL(valueChanged(int)), 166 connect(m_playSpeed, SIGNAL(valueChanged(int)),
166 this, SLOT(playSpeedChanged(int))); 167 this, SLOT(playSpeedChanged(int)));
167 168
168 layout->addWidget(m_paneStack, 0, 0, 1, 3); 169 m_playSharpen = new QCheckBox(frame);
170 m_playSharpen->setToolTip(tr("Sharpen"));
171 m_playSharpen->setEnabled(false);
172 m_playSharpen->setChecked(false);
173 connect(m_playSharpen, SIGNAL(clicked()),
174 this, SLOT(playSharpenToggled()));
175
176 layout->addWidget(m_paneStack, 0, 0, 1, 4);
169 layout->addWidget(m_panner, 1, 0); 177 layout->addWidget(m_panner, 1, 0);
170 layout->addWidget(m_fader, 1, 1); 178 layout->addWidget(m_fader, 1, 1);
171 layout->addWidget(m_playSpeed, 1, 2); 179 layout->addWidget(m_playSpeed, 1, 2);
180 layout->addWidget(m_playSharpen, 1, 3);
181
182 layout->setColumnStretch(0, 10);
183
172 frame->setLayout(layout); 184 frame->setLayout(layout);
173 185
174 connect(m_viewManager, SIGNAL(outputLevelsChanged(float, float)), 186 connect(m_viewManager, SIGNAL(outputLevelsChanged(float, float)),
175 this, SLOT(outputLevelsChanged(float, float))); 187 this, SLOT(outputLevelsChanged(float, float)));
176 188
2868 */ 2880 */
2869 m_playSpeed->setToolTip(tr("Playback speed: %1") 2881 m_playSpeed->setToolTip(tr("Playback speed: %1")
2870 .arg(factor != 1 ? 2882 .arg(factor != 1 ?
2871 QString("1/%1").arg(factor) : 2883 QString("1/%1").arg(factor) :
2872 tr("Full"))); 2884 tr("Full")));
2873 m_playSource->setSlowdownFactor(factor); 2885 m_playSharpen->setEnabled(speed != 10);
2886 bool sharpen = (speed != 10 && m_playSharpen->isChecked());
2887 m_playSource->setSlowdownFactor(factor, sharpen);
2888 }
2889
2890 void
2891 MainWindow::playSharpenToggled()
2892 {
2893 playSpeedChanged(m_playSpeed->value());
2874 } 2894 }
2875 2895
2876 void 2896 void
2877 MainWindow::outputLevelsChanged(float left, float right) 2897 MainWindow::outputLevelsChanged(float left, float right)
2878 { 2898 {