Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 218:e6b581c7c246
* Add support for Rubber Band timestretcher
author | Chris Cannam |
---|---|
date | Mon, 26 Nov 2007 13:33:44 +0000 |
parents | 69f83e36b8e5 |
children | 0f635e16881d |
comparison
equal
deleted
inserted
replaced
217:69f83e36b8e5 | 218:e6b581c7c246 |
---|---|
228 m_playSharpen->setIcon(il.load("sharpen")); | 228 m_playSharpen->setIcon(il.load("sharpen")); |
229 connect(m_playSharpen, SIGNAL(clicked()), this, SLOT(playSharpenToggled())); | 229 connect(m_playSharpen, SIGNAL(clicked()), this, SLOT(playSharpenToggled())); |
230 connect(m_playSharpen, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | 230 connect(m_playSharpen, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); |
231 connect(m_playSharpen, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | 231 connect(m_playSharpen, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); |
232 | 232 |
233 #ifndef HAVE_RUBBERBAND | |
233 m_playMono = new NotifyingPushButton(frame); | 234 m_playMono = new NotifyingPushButton(frame); |
234 m_playMono->setToolTip(tr("Run time stretcher in mono only")); | 235 m_playMono->setToolTip(tr("Run time stretcher in mono only")); |
235 m_playMono->setFixedSize(20, 20); | 236 m_playMono->setFixedSize(20, 20); |
236 m_playMono->setEnabled(false); | 237 m_playMono->setEnabled(false); |
237 m_playMono->setCheckable(true); | 238 m_playMono->setCheckable(true); |
238 m_playMono->setChecked(false); | 239 m_playMono->setChecked(false); |
239 m_playMono->setIcon(il.load("mono")); | 240 m_playMono->setIcon(il.load("mono")); |
240 connect(m_playMono, SIGNAL(clicked()), this, SLOT(playMonoToggled())); | 241 connect(m_playMono, SIGNAL(clicked()), this, SLOT(playMonoToggled())); |
241 connect(m_playMono, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | 242 connect(m_playMono, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); |
242 connect(m_playMono, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | 243 connect(m_playMono, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); |
244 #endif | |
243 | 245 |
244 QSettings settings; | 246 QSettings settings; |
245 settings.beginGroup("MainWindow"); | 247 settings.beginGroup("MainWindow"); |
246 m_playSharpen->setChecked(settings.value("playsharpen", true).toBool()); | 248 m_playSharpen->setChecked(settings.value("playsharpen", true).toBool()); |
249 #ifndef HAVE_RUBBERBAND | |
247 m_playMono->setChecked(settings.value("playmono", false).toBool()); | 250 m_playMono->setChecked(settings.value("playmono", false).toBool()); |
251 #endif | |
248 settings.endGroup(); | 252 settings.endGroup(); |
249 | 253 |
250 layout->setSpacing(4); | 254 layout->setSpacing(4); |
251 layout->addWidget(scroll, 0, 0, 1, 5); | 255 layout->addWidget(scroll, 0, 0, 1, 5); |
252 layout->addWidget(m_overview, 1, 0); | 256 layout->addWidget(m_overview, 1, 0); |
253 layout->addWidget(m_fader, 1, 1); | 257 layout->addWidget(m_fader, 1, 1); |
254 layout->addWidget(m_playSpeed, 1, 2); | 258 layout->addWidget(m_playSpeed, 1, 2); |
255 layout->addWidget(m_playSharpen, 1, 3); | 259 layout->addWidget(m_playSharpen, 1, 3); |
260 #ifndef HAVE_RUBBERBAND | |
256 layout->addWidget(m_playMono, 1, 4); | 261 layout->addWidget(m_playMono, 1, 4); |
262 #endif | |
257 | 263 |
258 m_paneStack->setPropertyStackMinWidth | 264 m_paneStack->setPropertyStackMinWidth |
259 (m_fader->width() + m_playSpeed->width() + m_playSharpen->width() + | 265 (m_fader->width() + m_playSpeed->width() + m_playSharpen->width() |
260 m_playMono->width() + layout->spacing() * 4); | 266 #ifndef HAVE_RUBBERBAND |
267 + m_playMono->width() | |
268 #endif | |
269 + layout->spacing() * 4); | |
261 | 270 |
262 layout->setColumnStretch(0, 10); | 271 layout->setColumnStretch(0, 10); |
263 | 272 |
264 frame->setLayout(layout); | 273 frame->setLayout(layout); |
265 | 274 |
2993 .arg(position > 100 ? "+" : "") | 3002 .arg(position > 100 ? "+" : "") |
2994 .arg(pc)); | 3003 .arg(pc)); |
2995 } | 3004 } |
2996 | 3005 |
2997 m_playSharpen->setEnabled(something); | 3006 m_playSharpen->setEnabled(something); |
3007 bool sharpen = (something && m_playSharpen->isChecked()); | |
3008 | |
3009 #ifdef HAVE_RUBBERBAND | |
3010 bool mono = false; | |
3011 #else | |
2998 m_playMono->setEnabled(something); | 3012 m_playMono->setEnabled(something); |
2999 bool sharpen = (something && m_playSharpen->isChecked()); | |
3000 bool mono = (something && m_playMono->isChecked()); | 3013 bool mono = (something && m_playMono->isChecked()); |
3014 #endif | |
3015 | |
3001 m_playSource->setTimeStretch(factor, sharpen, mono); | 3016 m_playSource->setTimeStretch(factor, sharpen, mono); |
3002 | 3017 |
3003 updateMenuStates(); | 3018 updateMenuStates(); |
3004 } | 3019 } |
3005 | 3020 |
3012 settings.endGroup(); | 3027 settings.endGroup(); |
3013 | 3028 |
3014 playSpeedChanged(m_playSpeed->value()); | 3029 playSpeedChanged(m_playSpeed->value()); |
3015 } | 3030 } |
3016 | 3031 |
3032 #ifndef HAVE_RUBBERBAND | |
3017 void | 3033 void |
3018 MainWindow::playMonoToggled() | 3034 MainWindow::playMonoToggled() |
3019 { | 3035 { |
3020 QSettings settings; | 3036 QSettings settings; |
3021 settings.beginGroup("MainWindow"); | 3037 settings.beginGroup("MainWindow"); |
3022 settings.setValue("playmono", m_playMono->isChecked()); | 3038 settings.setValue("playmono", m_playMono->isChecked()); |
3023 settings.endGroup(); | 3039 settings.endGroup(); |
3024 | 3040 |
3025 playSpeedChanged(m_playSpeed->value()); | 3041 playSpeedChanged(m_playSpeed->value()); |
3026 } | 3042 } |
3043 #endif | |
3027 | 3044 |
3028 void | 3045 void |
3029 MainWindow::speedUpPlayback() | 3046 MainWindow::speedUpPlayback() |
3030 { | 3047 { |
3031 int value = m_playSpeed->value(); | 3048 int value = m_playSpeed->value(); |
3286 contextHelpChanged(tr("Adjust the master playback level")); | 3303 contextHelpChanged(tr("Adjust the master playback level")); |
3287 } else if (w == m_playSpeed) { | 3304 } else if (w == m_playSpeed) { |
3288 contextHelpChanged(tr("Adjust the master playback speed")); | 3305 contextHelpChanged(tr("Adjust the master playback speed")); |
3289 } else if (w == m_playSharpen && w->isEnabled()) { | 3306 } else if (w == m_playSharpen && w->isEnabled()) { |
3290 contextHelpChanged(tr("Toggle transient sharpening for playback time scaling")); | 3307 contextHelpChanged(tr("Toggle transient sharpening for playback time scaling")); |
3308 #ifndef HAVE_RUBBERBAND | |
3291 } else if (w == m_playMono && w->isEnabled()) { | 3309 } else if (w == m_playMono && w->isEnabled()) { |
3292 contextHelpChanged(tr("Toggle mono mode for playback time scaling")); | 3310 contextHelpChanged(tr("Toggle mono mode for playback time scaling")); |
3311 #endif | |
3293 } | 3312 } |
3294 } | 3313 } |
3295 | 3314 |
3296 void | 3315 void |
3297 MainWindow::mouseLeftWidget() | 3316 MainWindow::mouseLeftWidget() |