Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 240:91426a5e4b53 sv1-v1.2pre4
* PortAudio driver: do not specify frames per buffer, let PA decide
* Remove old non-RubberBand time stretcher -- it doesn't work with varying
buffer sizes such as the PA driver may now be using
* Rewrite getCurrentPlayingFrame for greater correctness when using long
buffer sizes (interpolating according to audio stream timestamp)
* Several changes to make the timestretch management RT safe(r)
author | Chris Cannam |
---|---|
date | Fri, 08 Feb 2008 17:51:15 +0000 |
parents | d936e3d77b95 |
children | 9aace07f6082 |
comparison
equal
deleted
inserted
replaced
239:d936e3d77b95 | 240:91426a5e4b53 |
---|---|
220 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | 220 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); |
221 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | 221 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); |
222 | 222 |
223 IconLoader il; | 223 IconLoader il; |
224 | 224 |
225 #ifndef HAVE_RUBBERBAND | |
226 m_playSharpen = new NotifyingPushButton(frame); | |
227 m_playSharpen->setToolTip(tr("Sharpen percussive transients")); | |
228 m_playSharpen->setFixedSize(20, 20); | |
229 m_playSharpen->setEnabled(false); | |
230 m_playSharpen->setCheckable(true); | |
231 m_playSharpen->setChecked(false); | |
232 m_playSharpen->setIcon(il.load("sharpen")); | |
233 connect(m_playSharpen, SIGNAL(clicked()), this, SLOT(playSharpenToggled())); | |
234 connect(m_playSharpen, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | |
235 connect(m_playSharpen, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | |
236 | |
237 m_playMono = new NotifyingPushButton(frame); | |
238 m_playMono->setToolTip(tr("Run time stretcher in mono only")); | |
239 m_playMono->setFixedSize(20, 20); | |
240 m_playMono->setEnabled(false); | |
241 m_playMono->setCheckable(true); | |
242 m_playMono->setChecked(false); | |
243 m_playMono->setIcon(il.load("mono")); | |
244 connect(m_playMono, SIGNAL(clicked()), this, SLOT(playMonoToggled())); | |
245 connect(m_playMono, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | |
246 connect(m_playMono, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | |
247 #endif | |
248 | |
249 QSettings settings; | 225 QSettings settings; |
250 settings.beginGroup("MainWindow"); | 226 settings.beginGroup("MainWindow"); |
251 #ifndef HAVE_RUBBERBAND | |
252 m_playSharpen->setChecked(settings.value("playsharpen", true).toBool()); | |
253 m_playMono->setChecked(settings.value("playmono", false).toBool()); | |
254 #endif | |
255 settings.endGroup(); | 227 settings.endGroup(); |
256 | 228 |
257 m_playControlsSpacer = new QFrame; | 229 m_playControlsSpacer = new QFrame; |
258 | 230 |
259 layout->setSpacing(4); | 231 layout->setSpacing(4); |
260 #ifndef HAVE_RUBBERBAND | |
261 layout->addWidget(scroll, 0, 0, 1, 7); | |
262 layout->addWidget(m_overview, 1, 1); | |
263 layout->addWidget(m_playControlsSpacer, 1, 2); | |
264 layout->addWidget(m_fader, 1, 3); | |
265 layout->addWidget(m_playSpeed, 1, 4); | |
266 layout->addWidget(m_playSharpen, 1, 5); | |
267 layout->addWidget(m_playMono, 1, 6); | |
268 #else | |
269 layout->addWidget(scroll, 0, 0, 1, 5); | 232 layout->addWidget(scroll, 0, 0, 1, 5); |
270 layout->addWidget(m_overview, 1, 1); | 233 layout->addWidget(m_overview, 1, 1); |
271 layout->addWidget(m_playControlsSpacer, 1, 2); | 234 layout->addWidget(m_playControlsSpacer, 1, 2); |
272 layout->addWidget(m_playSpeed, 1, 3); | 235 layout->addWidget(m_playSpeed, 1, 3); |
273 layout->addWidget(m_fader, 1, 4); | 236 layout->addWidget(m_fader, 1, 4); |
274 #endif | |
275 | 237 |
276 m_playControlsWidth = | 238 m_playControlsWidth = |
277 m_fader->width() + m_playSpeed->width() | 239 m_fader->width() + m_playSpeed->width() + layout->spacing() * 2; |
278 #ifndef HAVE_RUBBERBAND | |
279 + m_playSharpen->width() | |
280 + m_playMono->width() | |
281 #endif | |
282 + layout->spacing() * | |
283 #ifndef HAVE_RUBBERBAND | |
284 4 | |
285 #else | |
286 2 | |
287 #endif | |
288 ; | |
289 | 240 |
290 layout->setColumnMinimumWidth(0, 14); | 241 layout->setColumnMinimumWidth(0, 14); |
291 layout->setColumnStretch(0, 0); | 242 layout->setColumnStretch(0, 0); |
292 | 243 |
293 m_paneStack->setPropertyStackMinWidth(m_playControlsWidth | 244 m_paneStack->setPropertyStackMinWidth(m_playControlsWidth |
3132 contextHelpChanged(tr("Playback speed: %1%2%") | 3083 contextHelpChanged(tr("Playback speed: %1%2%") |
3133 .arg(position > 100 ? "+" : "") | 3084 .arg(position > 100 ? "+" : "") |
3134 .arg(pc)); | 3085 .arg(pc)); |
3135 } | 3086 } |
3136 | 3087 |
3137 #ifdef HAVE_RUBBERBAND | 3088 m_playSource->setTimeStretch(factor); |
3138 bool mono = false; | |
3139 bool sharpen = true; | |
3140 #else | |
3141 m_playSharpen->setEnabled(something); | |
3142 bool sharpen = (something && m_playSharpen->isChecked()); | |
3143 m_playMono->setEnabled(something); | |
3144 bool mono = (something && m_playMono->isChecked()); | |
3145 #endif | |
3146 | |
3147 m_playSource->setTimeStretch(factor, sharpen, mono); | |
3148 | 3089 |
3149 updateMenuStates(); | 3090 updateMenuStates(); |
3150 } | 3091 } |
3151 | |
3152 #ifndef HAVE_RUBBERBAND | |
3153 void | |
3154 MainWindow::playSharpenToggled() | |
3155 { | |
3156 QSettings settings; | |
3157 settings.beginGroup("MainWindow"); | |
3158 settings.setValue("playsharpen", m_playSharpen->isChecked()); | |
3159 settings.endGroup(); | |
3160 | |
3161 playSpeedChanged(m_playSpeed->value()); | |
3162 } | |
3163 | |
3164 void | |
3165 MainWindow::playMonoToggled() | |
3166 { | |
3167 QSettings settings; | |
3168 settings.beginGroup("MainWindow"); | |
3169 settings.setValue("playmono", m_playMono->isChecked()); | |
3170 settings.endGroup(); | |
3171 | |
3172 playSpeedChanged(m_playSpeed->value()); | |
3173 } | |
3174 #endif | |
3175 | 3092 |
3176 void | 3093 void |
3177 MainWindow::speedUpPlayback() | 3094 MainWindow::speedUpPlayback() |
3178 { | 3095 { |
3179 int value = m_playSpeed->value(); | 3096 int value = m_playSpeed->value(); |
3495 | 3412 |
3496 if (w == m_fader) { | 3413 if (w == m_fader) { |
3497 contextHelpChanged(tr("Adjust the master playback level")); | 3414 contextHelpChanged(tr("Adjust the master playback level")); |
3498 } else if (w == m_playSpeed) { | 3415 } else if (w == m_playSpeed) { |
3499 contextHelpChanged(tr("Adjust the master playback speed")); | 3416 contextHelpChanged(tr("Adjust the master playback speed")); |
3500 #ifndef HAVE_RUBBERBAND | |
3501 } else if (w == m_playSharpen && w->isEnabled()) { | |
3502 contextHelpChanged(tr("Toggle transient sharpening for playback time scaling")); | |
3503 } else if (w == m_playMono && w->isEnabled()) { | |
3504 contextHelpChanged(tr("Toggle mono mode for playback time scaling")); | |
3505 #endif | |
3506 } | 3417 } |
3507 } | 3418 } |
3508 | 3419 |
3509 void | 3420 void |
3510 MainWindow::mouseLeftWidget() | 3421 MainWindow::mouseLeftWidget() |