comparison framework/MainWindowBase.cpp @ 483:493f2af85497 recording

Add audio record mode (option to replace session) and support for browsing to record directory
author Chris Cannam
date Tue, 15 Sep 2015 16:34:08 +0100
parents 6f475df6f833
children 01aeda073720 3dbc964f5907
comparison
equal deleted inserted replaced
480:1d4cb8befcfd 483:493f2af85497
155 m_abandoning(false), 155 m_abandoning(false),
156 m_labeller(0), 156 m_labeller(0),
157 m_lastPlayStatusSec(0), 157 m_lastPlayStatusSec(0),
158 m_initialDarkBackground(false), 158 m_initialDarkBackground(false),
159 m_defaultFfwdRwdStep(2, 0), 159 m_defaultFfwdRwdStep(2, 0),
160 m_audioRecordMode(RecordCreateAdditionalModel),
160 m_statusLabel(0), 161 m_statusLabel(0),
161 m_menuShortcutMapper(0) 162 m_menuShortcutMapper(0)
162 { 163 {
163 Profiler profiler("MainWindowBase::MainWindowBase"); 164 Profiler profiler("MainWindowBase::MainWindowBase");
164 165
611 emit canEditLayer(haveCurrentEditableLayer); 612 emit canEditLayer(haveCurrentEditableLayer);
612 emit canEditLayerTabular(haveCurrentEditableLayer || haveTabularLayer); 613 emit canEditLayerTabular(haveCurrentEditableLayer || haveTabularLayer);
613 emit canMeasureLayer(haveCurrentLayer); 614 emit canMeasureLayer(haveCurrentLayer);
614 emit canSelect(haveMainModel && haveCurrentPane); 615 emit canSelect(haveMainModel && haveCurrentPane);
615 emit canPlay(haveMainModel && havePlayTarget); 616 emit canPlay(haveMainModel && havePlayTarget);
616 emit canRecord(m_soundOptions & WithAudioInput); // always possible then 617 emit canRecord(m_recordTarget != 0);
617 emit canFfwd(haveMainModel); 618 emit canFfwd(haveMainModel);
618 emit canRewind(haveMainModel); 619 emit canRewind(haveMainModel);
619 emit canPaste(haveClipboardContents); 620 emit canPaste(haveClipboardContents);
620 emit canInsertInstant(haveCurrentPane); 621 emit canInsertInstant(haveCurrentPane);
621 emit canInsertInstantsAtBoundaries(haveCurrentPane && haveSelection); 622 emit canInsertInstantsAtBoundaries(haveCurrentPane && haveSelection);
2683 m_recordTarget->stopRecording(); 2684 m_recordTarget->stopRecording();
2684 emit audioFileLoaded(); 2685 emit audioFileLoaded();
2685 return; 2686 return;
2686 } 2687 }
2687 2688
2689 if (m_audioRecordMode == RecordReplaceSession) {
2690 if (!checkSaveModified()) return;
2691 }
2692
2688 WritableWaveFileModel *model = m_recordTarget->startRecording(); 2693 WritableWaveFileModel *model = m_recordTarget->startRecording();
2689 if (!model) { 2694 if (!model) {
2690 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl; 2695 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
2691 //!!! report 2696 //!!! report
2692 return; 2697 return;
2698 //!!! ??? 2703 //!!! ???
2699 return; 2704 return;
2700 } 2705 }
2701 2706
2702 PlayParameterRepository::getInstance()->addPlayable(model); 2707 PlayParameterRepository::getInstance()->addPlayable(model);
2703 2708
2704 if (!getMainModel()) { 2709 if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) {
2705 2710
2706 //!!! duplication with openAudio here 2711 //!!! duplication with openAudio here
2707 2712
2708 QString templateName = getDefaultSessionTemplate(); 2713 QString templateName = getDefaultSessionTemplate();
2709 bool loadedTemplate = false; 2714 bool loadedTemplate = false;
3614 } 3619 }
3615 #endif 3620 #endif
3616 #endif 3621 #endif
3617 } 3622 }
3618 3623
3619 3624 void
3625 MainWindowBase::openLocalFolder(QString path)
3626 {
3627 QDir d(path);
3628 if (d.exists()) {
3629 QStringList args;
3630 QString path = d.canonicalPath();
3631 #if defined Q_OS_WIN32
3632 // Although the Win32 API is quite happy to have
3633 // forward slashes as directory separators, Windows
3634 // Explorer is not
3635 path = path.replace('/', '\\');
3636 args << path;
3637 QProcess::execute("c:/windows/explorer.exe", args);
3638 #else
3639 args << path;
3640 QProcess::execute(
3641 #if defined Q_OS_MAC
3642 "/usr/bin/open",
3643 #else
3644 "/usr/bin/xdg-open",
3645 #endif
3646 args);
3647 #endif
3648 }
3649 }
3650