Mercurial > hg > tony
comparison src/MainWindow.cpp @ 507:fc726260b29b
Merge from branch "2.0-integration"
author | Chris Cannam |
---|---|
date | Mon, 19 Oct 2015 11:38:17 +0100 |
parents | 487fb37f2106 |
children | d8013f97df3c |
comparison
equal
deleted
inserted
replaced
473:ceecc71eeb20 | 507:fc726260b29b |
---|---|
40 #include "view/Overview.h" | 40 #include "view/Overview.h" |
41 #include "widgets/AudioDial.h" | 41 #include "widgets/AudioDial.h" |
42 #include "widgets/IconLoader.h" | 42 #include "widgets/IconLoader.h" |
43 #include "widgets/KeyReference.h" | 43 #include "widgets/KeyReference.h" |
44 #include "widgets/LevelPanToolButton.h" | 44 #include "widgets/LevelPanToolButton.h" |
45 #include "audioio/AudioCallbackPlaySource.h" | 45 #include "audio/AudioCallbackPlaySource.h" |
46 #include "audioio/AudioCallbackPlayTarget.h" | 46 #include "audio/AudioRecordTarget.h" |
47 #include "audioio/PlaySpeedRangeMapper.h" | 47 #include "audio/PlaySpeedRangeMapper.h" |
48 #include "base/Profiler.h" | 48 #include "base/Profiler.h" |
49 #include "base/UnitDatabase.h" | 49 #include "base/UnitDatabase.h" |
50 #include "layer/ColourDatabase.h" | 50 #include "layer/ColourDatabase.h" |
51 #include "base/Selection.h" | 51 #include "base/Selection.h" |
52 | 52 |
63 // For version information | 63 // For version information |
64 #include "vamp/vamp.h" | 64 #include "vamp/vamp.h" |
65 #include "vamp-sdk/PluginBase.h" | 65 #include "vamp-sdk/PluginBase.h" |
66 #include "plugin/api/ladspa.h" | 66 #include "plugin/api/ladspa.h" |
67 #include "plugin/api/dssi.h" | 67 #include "plugin/api/dssi.h" |
68 | |
69 #include <bqaudioio/SystemPlaybackTarget.h> | |
70 #include <bqaudioio/SystemAudioIO.h> | |
68 | 71 |
69 #include <QApplication> | 72 #include <QApplication> |
70 #include <QMessageBox> | 73 #include <QMessageBox> |
71 #include <QGridLayout> | 74 #include <QGridLayout> |
72 #include <QLabel> | 75 #include <QLabel> |
89 #include <errno.h> | 92 #include <errno.h> |
90 | 93 |
91 using std::vector; | 94 using std::vector; |
92 | 95 |
93 | 96 |
94 MainWindow::MainWindow(bool withAudioOutput, bool withSonification, bool withSpectrogram) : | 97 MainWindow::MainWindow(SoundOptions options, bool withSonification, bool withSpectrogram) : |
95 MainWindowBase(withAudioOutput, false), | 98 MainWindowBase(options), |
96 m_overview(0), | 99 m_overview(0), |
97 m_mainMenusCreated(false), | 100 m_mainMenusCreated(false), |
98 m_playbackMenu(0), | 101 m_playbackMenu(0), |
99 m_recentFilesMenu(0), | 102 m_recentFilesMenu(0), |
100 m_rightButtonMenu(0), | 103 m_rightButtonMenu(0), |
224 connect(m_fader, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | 227 connect(m_fader, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); |
225 | 228 |
226 m_playSpeed = new AudioDial(frame); | 229 m_playSpeed = new AudioDial(frame); |
227 m_playSpeed->setMeterColor(Qt::darkBlue); | 230 m_playSpeed->setMeterColor(Qt::darkBlue); |
228 m_playSpeed->setMinimum(0); | 231 m_playSpeed->setMinimum(0); |
229 m_playSpeed->setMaximum(200); | 232 m_playSpeed->setMaximum(120); |
230 m_playSpeed->setValue(100); | 233 m_playSpeed->setValue(60); |
231 m_playSpeed->setFixedWidth(24); | 234 m_playSpeed->setFixedWidth(24); |
232 m_playSpeed->setFixedHeight(24); | 235 m_playSpeed->setFixedHeight(24); |
233 m_playSpeed->setNotchesVisible(true); | 236 m_playSpeed->setNotchesVisible(true); |
234 m_playSpeed->setPageStep(10); | 237 m_playSpeed->setPageStep(10); |
235 m_playSpeed->setObjectName(tr("Playback Speedup")); | 238 m_playSpeed->setObjectName(tr("Playback Speed")); |
236 m_playSpeed->setDefaultValue(100); | 239 m_playSpeed->setDefaultValue(60); |
237 m_playSpeed->setRangeMapper(new PlaySpeedRangeMapper(0, 200)); | 240 m_playSpeed->setRangeMapper(new PlaySpeedRangeMapper); |
238 m_playSpeed->setShowToolTip(true); | 241 m_playSpeed->setShowToolTip(true); |
239 connect(m_playSpeed, SIGNAL(valueChanged(int)), | 242 connect(m_playSpeed, SIGNAL(valueChanged(int)), |
240 this, SLOT(playSpeedChanged(int))); | 243 this, SLOT(playSpeedChanged(int))); |
241 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | 244 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); |
242 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | 245 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); |
295 connect(this, SIGNAL(replacedDocument()), this, SLOT(documentReplaced())); | 298 connect(this, SIGNAL(replacedDocument()), this, SLOT(documentReplaced())); |
296 connect(this, SIGNAL(sessionLoaded()), this, SLOT(analyseNewMainModel())); | 299 connect(this, SIGNAL(sessionLoaded()), this, SLOT(analyseNewMainModel())); |
297 connect(this, SIGNAL(audioFileLoaded()), this, SLOT(analyseNewMainModel())); | 300 connect(this, SIGNAL(audioFileLoaded()), this, SLOT(analyseNewMainModel())); |
298 m_activityLog->hide(); | 301 m_activityLog->hide(); |
299 | 302 |
303 setAudioRecordMode(RecordReplaceSession); | |
304 | |
300 newSession(); | 305 newSession(); |
301 | 306 |
302 settings.beginGroup("MainWindow"); | 307 settings.beginGroup("MainWindow"); |
303 settings.setValue("zoom-default", 512); | 308 settings.setValue("zoom-default", 512); |
304 settings.endGroup(); | 309 settings.endGroup(); |
368 IconLoader il; | 373 IconLoader il; |
369 QIcon icon; | 374 QIcon icon; |
370 QAction *action; | 375 QAction *action; |
371 | 376 |
372 icon = il.load("fileopen"); | 377 icon = il.load("fileopen"); |
373 icon.addPixmap(il.loadPixmap("fileopen-22")); | |
374 action = new QAction(icon, tr("&Open..."), this); | 378 action = new QAction(icon, tr("&Open..."), this); |
375 action->setShortcut(tr("Ctrl+O")); | 379 action->setShortcut(tr("Ctrl+O")); |
376 action->setStatusTip(tr("Open a session or audio file")); | 380 action->setStatusTip(tr("Open a session or audio file")); |
377 connect(action, SIGNAL(triggered()), this, SLOT(openFile())); | 381 connect(action, SIGNAL(triggered()), this, SLOT(openFile())); |
378 m_keyReference->registerShortcut(action); | 382 m_keyReference->registerShortcut(action); |
393 this, SLOT(setupRecentFilesMenu())); | 397 this, SLOT(setupRecentFilesMenu())); |
394 | 398 |
395 menu->addSeparator(); | 399 menu->addSeparator(); |
396 | 400 |
397 icon = il.load("filesave"); | 401 icon = il.load("filesave"); |
398 icon.addPixmap(il.loadPixmap("filesave-22")); | |
399 action = new QAction(icon, tr("&Save Session"), this); | 402 action = new QAction(icon, tr("&Save Session"), this); |
400 action->setShortcut(tr("Ctrl+S")); | 403 action->setShortcut(tr("Ctrl+S")); |
401 action->setStatusTip(tr("Save the current session into a %1 session file").arg(QApplication::applicationName())); | 404 action->setStatusTip(tr("Save the current session into a %1 session file").arg(QApplication::applicationName())); |
402 connect(action, SIGNAL(triggered()), this, SLOT(saveSession())); | 405 connect(action, SIGNAL(triggered()), this, SLOT(saveSession())); |
403 connect(this, SIGNAL(canSave(bool)), action, SLOT(setEnabled(bool))); | 406 connect(this, SIGNAL(canSave(bool)), action, SLOT(setEnabled(bool))); |
404 m_keyReference->registerShortcut(action); | 407 m_keyReference->registerShortcut(action); |
405 menu->addAction(action); | 408 menu->addAction(action); |
406 toolbar->addAction(action); | 409 toolbar->addAction(action); |
407 | 410 |
408 icon = il.load("filesaveas"); | 411 icon = il.load("filesaveas"); |
409 icon.addPixmap(il.loadPixmap("filesaveas-22")); | |
410 action = new QAction(icon, tr("Save Session &As..."), this); | 412 action = new QAction(icon, tr("Save Session &As..."), this); |
411 action->setShortcut(tr("Ctrl+Shift+S")); | 413 action->setShortcut(tr("Ctrl+Shift+S")); |
412 action->setStatusTip(tr("Save the current session into a new %1 session file").arg(QApplication::applicationName())); | 414 action->setStatusTip(tr("Save the current session into a new %1 session file").arg(QApplication::applicationName())); |
413 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionAs())); | 415 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionAs())); |
414 connect(this, SIGNAL(canSaveAs(bool)), action, SLOT(setEnabled(bool))); | 416 connect(this, SIGNAL(canSaveAs(bool)), action, SLOT(setEnabled(bool))); |
415 menu->addAction(action); | 417 menu->addAction(action); |
416 toolbar->addAction(action); | 418 toolbar->addAction(action); |
417 | 419 |
418 action = new QAction(tr("Save Session to Audio &Path"), this); | 420 action = new QAction(tr("Save Session to Audio File &Path"), this); |
419 action->setShortcut(tr("Ctrl+Alt+S")); | 421 action->setShortcut(tr("Ctrl+Alt+S")); |
420 action->setStatusTip(tr("Save the current session into a %1 session file with the same filename as the audio but a .ton extension.").arg(QApplication::applicationName())); | 422 action->setStatusTip(tr("Save the current session into a %1 session file with the same filename as the audio but a .ton extension.").arg(QApplication::applicationName())); |
421 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionInAudioPath())); | 423 connect(action, SIGNAL(triggered()), this, SLOT(saveSessionInAudioPath())); |
422 connect(this, SIGNAL(canSaveAs(bool)), action, SLOT(setEnabled(bool))); | 424 connect(this, SIGNAL(canSaveAs(bool)), action, SLOT(setEnabled(bool))); |
423 menu->addAction(action); | 425 menu->addAction(action); |
441 connect(action, SIGNAL(triggered()), this, SLOT(exportNoteLayer())); | 443 connect(action, SIGNAL(triggered()), this, SLOT(exportNoteLayer())); |
442 connect(this, SIGNAL(canExportNotes(bool)), action, SLOT(setEnabled(bool))); | 444 connect(this, SIGNAL(canExportNotes(bool)), action, SLOT(setEnabled(bool))); |
443 menu->addAction(action); | 445 menu->addAction(action); |
444 | 446 |
445 menu->addSeparator(); | 447 menu->addSeparator(); |
448 | |
449 action = new QAction(tr("Browse Recorded Audio"), this); | |
450 action->setStatusTip(tr("Open the Recorded Audio folder in the system file browser")); | |
451 connect(action, SIGNAL(triggered()), this, SLOT(browseRecordedAudio())); | |
452 menu->addAction(action); | |
453 | |
454 menu->addSeparator(); | |
455 | |
446 action = new QAction(il.load("exit"), tr("&Quit"), this); | 456 action = new QAction(il.load("exit"), tr("&Quit"), this); |
447 action->setShortcut(tr("Ctrl+Q")); | 457 action->setShortcut(tr("Ctrl+Q")); |
448 action->setStatusTip(tr("Exit %1").arg(QApplication::applicationName())); | 458 action->setStatusTip(tr("Exit %1").arg(QApplication::applicationName())); |
449 connect(action, SIGNAL(triggered()), this, SLOT(close())); | 459 connect(action, SIGNAL(triggered()), this, SLOT(close())); |
450 m_keyReference->registerShortcut(action); | 460 m_keyReference->registerShortcut(action); |
1019 ffwdEndAction->setShortcut(tr("End")); | 1029 ffwdEndAction->setShortcut(tr("End")); |
1020 ffwdEndAction->setStatusTip(tr("Fast-forward to the end")); | 1030 ffwdEndAction->setStatusTip(tr("Fast-forward to the end")); |
1021 connect(ffwdEndAction, SIGNAL(triggered()), this, SLOT(ffwdEnd())); | 1031 connect(ffwdEndAction, SIGNAL(triggered()), this, SLOT(ffwdEnd())); |
1022 connect(this, SIGNAL(canPlay(bool)), ffwdEndAction, SLOT(setEnabled(bool))); | 1032 connect(this, SIGNAL(canPlay(bool)), ffwdEndAction, SLOT(setEnabled(bool))); |
1023 | 1033 |
1034 QAction *recordAction = toolbar->addAction(il.load("record"), | |
1035 tr("Record")); | |
1036 recordAction->setCheckable(true); | |
1037 recordAction->setShortcut(tr("Ctrl+Space")); | |
1038 recordAction->setStatusTip(tr("Record a new audio file")); | |
1039 connect(recordAction, SIGNAL(triggered()), this, SLOT(record())); | |
1040 connect(m_recordTarget, SIGNAL(recordStatusChanged(bool)), | |
1041 recordAction, SLOT(setChecked(bool))); | |
1042 connect(m_recordTarget, SIGNAL(recordCompleted()), | |
1043 this, SLOT(analyseNow())); | |
1044 connect(this, SIGNAL(canRecord(bool)), | |
1045 recordAction, SLOT(setEnabled(bool))); | |
1046 | |
1024 toolbar = addToolBar(tr("Play Mode Toolbar")); | 1047 toolbar = addToolBar(tr("Play Mode Toolbar")); |
1025 | 1048 |
1026 QAction *psAction = toolbar->addAction(il.load("playselection"), | 1049 QAction *psAction = toolbar->addAction(il.load("playselection"), |
1027 tr("Constrain Playback to Selection")); | 1050 tr("Constrain Playback to Selection")); |
1028 psAction->setCheckable(true); | 1051 psAction->setCheckable(true); |
1070 connect(this, SIGNAL(canScroll(bool)), selectOneRightAction, SLOT(setEnabled(bool))); | 1093 connect(this, SIGNAL(canScroll(bool)), selectOneRightAction, SLOT(setEnabled(bool))); |
1071 | 1094 |
1072 m_keyReference->registerShortcut(psAction); | 1095 m_keyReference->registerShortcut(psAction); |
1073 m_keyReference->registerShortcut(plAction); | 1096 m_keyReference->registerShortcut(plAction); |
1074 m_keyReference->registerShortcut(playAction); | 1097 m_keyReference->registerShortcut(playAction); |
1098 m_keyReference->registerShortcut(recordAction); | |
1075 m_keyReference->registerShortcut(m_rwdAction); | 1099 m_keyReference->registerShortcut(m_rwdAction); |
1076 m_keyReference->registerShortcut(m_ffwdAction); | 1100 m_keyReference->registerShortcut(m_ffwdAction); |
1077 m_keyReference->registerShortcut(rwdStartAction); | 1101 m_keyReference->registerShortcut(rwdStartAction); |
1078 m_keyReference->registerShortcut(ffwdEndAction); | 1102 m_keyReference->registerShortcut(ffwdEndAction); |
1103 m_keyReference->registerShortcut(recordAction); | |
1079 m_keyReference->registerShortcut(oneLeftAction); | 1104 m_keyReference->registerShortcut(oneLeftAction); |
1080 m_keyReference->registerShortcut(oneRightAction); | 1105 m_keyReference->registerShortcut(oneRightAction); |
1081 m_keyReference->registerShortcut(selectOneLeftAction); | 1106 m_keyReference->registerShortcut(selectOneLeftAction); |
1082 m_keyReference->registerShortcut(selectOneRightAction); | 1107 m_keyReference->registerShortcut(selectOneRightAction); |
1083 | 1108 |
1094 menu->addAction(oneLeftAction); | 1119 menu->addAction(oneLeftAction); |
1095 menu->addAction(oneRightAction); | 1120 menu->addAction(oneRightAction); |
1096 menu->addAction(selectOneLeftAction); | 1121 menu->addAction(selectOneLeftAction); |
1097 menu->addAction(selectOneRightAction); | 1122 menu->addAction(selectOneRightAction); |
1098 menu->addSeparator(); | 1123 menu->addSeparator(); |
1124 menu->addAction(recordAction); | |
1125 menu->addSeparator(); | |
1099 | 1126 |
1100 m_rightButtonPlaybackMenu->addAction(playAction); | 1127 m_rightButtonPlaybackMenu->addAction(playAction); |
1101 m_rightButtonPlaybackMenu->addAction(psAction); | 1128 m_rightButtonPlaybackMenu->addAction(psAction); |
1102 m_rightButtonPlaybackMenu->addAction(plAction); | 1129 m_rightButtonPlaybackMenu->addAction(plAction); |
1103 m_rightButtonPlaybackMenu->addSeparator(); | 1130 m_rightButtonPlaybackMenu->addSeparator(); |
1110 m_rightButtonPlaybackMenu->addAction(oneLeftAction); | 1137 m_rightButtonPlaybackMenu->addAction(oneLeftAction); |
1111 m_rightButtonPlaybackMenu->addAction(oneRightAction); | 1138 m_rightButtonPlaybackMenu->addAction(oneRightAction); |
1112 m_rightButtonPlaybackMenu->addAction(selectOneLeftAction); | 1139 m_rightButtonPlaybackMenu->addAction(selectOneLeftAction); |
1113 m_rightButtonPlaybackMenu->addAction(selectOneRightAction); | 1140 m_rightButtonPlaybackMenu->addAction(selectOneRightAction); |
1114 m_rightButtonPlaybackMenu->addSeparator(); | 1141 m_rightButtonPlaybackMenu->addSeparator(); |
1142 m_rightButtonPlaybackMenu->addAction(recordAction); | |
1143 m_rightButtonPlaybackMenu->addSeparator(); | |
1115 | 1144 |
1116 QAction *fastAction = menu->addAction(tr("Speed Up")); | 1145 QAction *fastAction = menu->addAction(tr("Speed Up")); |
1117 fastAction->setShortcut(tr("Ctrl+PgUp")); | 1146 fastAction->setShortcut(tr("Ctrl+PgUp")); |
1118 fastAction->setStatusTip(tr("Time-stretch playback to speed it up without changing pitch")); | 1147 fastAction->setStatusTip(tr("Time-stretch playback to speed it up without changing pitch")); |
1119 connect(fastAction, SIGNAL(triggered()), this, SLOT(speedUpPlayback())); | 1148 connect(fastAction, SIGNAL(triggered()), this, SLOT(speedUpPlayback())); |
1360 if (currentPane) currentLayer = currentPane->getSelectedLayer(); | 1389 if (currentPane) currentLayer = currentPane->getSelectedLayer(); |
1361 | 1390 |
1362 bool haveMainModel = | 1391 bool haveMainModel = |
1363 (getMainModel() != 0); | 1392 (getMainModel() != 0); |
1364 bool havePlayTarget = | 1393 bool havePlayTarget = |
1365 (m_playTarget != 0); | 1394 (m_playTarget != 0 || m_audioIO != 0); |
1366 bool haveCurrentPane = | 1395 bool haveCurrentPane = |
1367 (currentPane != 0); | 1396 (currentPane != 0); |
1368 bool haveCurrentLayer = | 1397 bool haveCurrentLayer = |
1369 (haveCurrentPane && | 1398 (haveCurrentPane && |
1370 (currentLayer != 0)); | 1399 (currentLayer != 0)); |
1399 | 1428 |
1400 emit canExportPitchTrack(havePitchTrack); | 1429 emit canExportPitchTrack(havePitchTrack); |
1401 emit canExportNotes(haveNotes); | 1430 emit canExportNotes(haveNotes); |
1402 emit canSnapNotes(haveSelection && haveNotes); | 1431 emit canSnapNotes(haveSelection && haveNotes); |
1403 | 1432 |
1433 cerr << "haveWaveform = " << haveWaveform << endl; | |
1434 cerr << "haveMainModel = " << haveMainModel << endl; | |
1435 cerr << "havePlayTarget = " << havePlayTarget << endl; | |
1436 | |
1404 emit canPlayWaveform(haveWaveform && haveMainModel && havePlayTarget); | 1437 emit canPlayWaveform(haveWaveform && haveMainModel && havePlayTarget); |
1405 emit canPlayPitch(havePitchTrack && haveMainModel && havePlayTarget); | 1438 emit canPlayPitch(havePitchTrack && haveMainModel && havePlayTarget); |
1406 emit canPlayNotes(haveNotes && haveMainModel && havePlayTarget); | 1439 emit canPlayNotes(haveNotes && haveMainModel && havePlayTarget); |
1407 | 1440 |
1408 if (pitchCandidatesVisible) { | 1441 if (pitchCandidatesVisible) { |
2318 emit activity(tr("Export layer to \"%1\"").arg(path)); | 2351 emit activity(tr("Export layer to \"%1\"").arg(path)); |
2319 } | 2352 } |
2320 } | 2353 } |
2321 | 2354 |
2322 void | 2355 void |
2356 MainWindow::browseRecordedAudio() | |
2357 { | |
2358 if (!m_recordTarget) return; | |
2359 | |
2360 QString path = m_recordTarget->getRecordContainerFolder(); | |
2361 if (path == "") return; | |
2362 | |
2363 openLocalFolder(path); | |
2364 } | |
2365 | |
2366 void | |
2323 MainWindow::doubleClickSelectInvoked(sv_frame_t frame) | 2367 MainWindow::doubleClickSelectInvoked(sv_frame_t frame) |
2324 { | 2368 { |
2325 sv_frame_t f0, f1; | 2369 sv_frame_t f0, f1; |
2326 m_analyser->getEnclosingSelectionScope(frame, f0, f1); | 2370 m_analyser->getEnclosingSelectionScope(frame, f0, f1); |
2327 | 2371 |
2638 } | 2682 } |
2639 | 2683 |
2640 void | 2684 void |
2641 MainWindow::playSpeedChanged(int position) | 2685 MainWindow::playSpeedChanged(int position) |
2642 { | 2686 { |
2643 PlaySpeedRangeMapper mapper(0, 200); | 2687 PlaySpeedRangeMapper mapper; |
2644 | 2688 |
2645 double percent = m_playSpeed->mappedValue(); | 2689 double percent = m_playSpeed->mappedValue(); |
2646 double factor = mapper.getFactorForValue(percent); | 2690 double factor = mapper.getFactorForValue(percent); |
2647 | 2691 |
2648 cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << endl; | 2692 int centre = m_playSpeed->defaultValue(); |
2649 | 2693 |
2650 bool something = (position != 100); | 2694 // Percentage is shown to 0dp if >100, to 1dp if <100; factor is |
2651 | 2695 // shown to 3sf |
2652 int pc = int(lrint(percent)); | 2696 |
2653 | 2697 char pcbuf[30]; |
2654 if (!something) { | 2698 char facbuf[30]; |
2699 | |
2700 if (position == centre) { | |
2655 contextHelpChanged(tr("Playback speed: Normal")); | 2701 contextHelpChanged(tr("Playback speed: Normal")); |
2702 } else if (position < centre) { | |
2703 sprintf(pcbuf, "%.1f", percent); | |
2704 sprintf(facbuf, "%.3g", 1.0 / factor); | |
2705 contextHelpChanged(tr("Playback speed: %1% (%2x slower)") | |
2706 .arg(pcbuf) | |
2707 .arg(facbuf)); | |
2656 } else { | 2708 } else { |
2657 contextHelpChanged(tr("Playback speed: %1%2%") | 2709 sprintf(pcbuf, "%.0f", percent); |
2658 .arg(position > 100 ? "+" : "") | 2710 sprintf(facbuf, "%.3g", factor); |
2659 .arg(pc)); | 2711 contextHelpChanged(tr("Playback speed: %1% (%2x faster)") |
2660 } | 2712 .arg(pcbuf) |
2661 | 2713 .arg(facbuf)); |
2662 m_playSource->setTimeStretch(factor); | 2714 } |
2715 | |
2716 m_playSource->setTimeStretch(1.0 / factor); // factor is a speedup | |
2663 | 2717 |
2664 updateMenuStates(); | 2718 updateMenuStates(); |
2665 } | 2719 } |
2666 | 2720 |
2667 void | 2721 void |
2906 { | 2960 { |
2907 m_panLayer->setModel(model); | 2961 m_panLayer->setModel(model); |
2908 | 2962 |
2909 MainWindowBase::mainModelChanged(model); | 2963 MainWindowBase::mainModelChanged(model); |
2910 | 2964 |
2965 if (m_playTarget || m_audioIO) { | |
2966 connect(m_fader, SIGNAL(valueChanged(float)), | |
2967 this, SLOT(mainModelGainChanged(float))); | |
2968 } | |
2969 } | |
2970 | |
2971 void | |
2972 MainWindow::mainModelGainChanged(float gain) | |
2973 { | |
2911 if (m_playTarget) { | 2974 if (m_playTarget) { |
2912 connect(m_fader, SIGNAL(valueChanged(float)), | 2975 m_playTarget->setOutputGain(gain); |
2913 m_playTarget, SLOT(setOutputGain(float))); | 2976 } else if (m_audioIO) { |
2977 m_audioIO->setOutputGain(gain); | |
2914 } | 2978 } |
2915 } | 2979 } |
2916 | 2980 |
2917 void | 2981 void |
2918 MainWindow::analyseNow() | 2982 MainWindow::analyseNow() |
3009 m_analyser->setAudible(Analyser::PitchTrack, false); | 3073 m_analyser->setAudible(Analyser::PitchTrack, false); |
3010 m_analyser->setAudible(Analyser::Notes, false); | 3074 m_analyser->setAudible(Analyser::Notes, false); |
3011 } | 3075 } |
3012 | 3076 |
3013 updateLayerStatuses(); | 3077 updateLayerStatuses(); |
3078 documentRestored(); | |
3014 } | 3079 } |
3015 | 3080 |
3016 void | 3081 void |
3017 MainWindow::modelGenerationFailed(QString transformName, QString message) | 3082 MainWindow::modelGenerationFailed(QString transformName, QString message) |
3018 { | 3083 { |