MCPcopy Create free account
hub / github.com/audacity/audacity / ExecutePostRecordActions

Method ExecutePostRecordActions

src/TimerRecordDialog.cpp:602–758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600}
601
602int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) {
603 // MY: We no longer automatically (and silently) call ->Save() when the
604 // timer recording is completed. We can now Save and/or Export depending
605 // on the options selected by the user.
606 // Once completed, we can also close Audacity, restart the system or
607 // shutdown the system.
608 // If there was any error with the auto save or export then we will not do
609 // the actions requested and instead present an error mesasge to the user.
610 // Finally, if there is no post-record action selected then we output
611 // a dialog detailing what has been carried out instead.
612
613 bool bSaveOK = false;
614 bool bExportOK = false;
615 int iPostRecordAction = m_pTimerAfterCompleteChoiceCtrl->GetSelection();
616 int iOverriddenAction = iPostRecordAction;
617 bool bErrorOverride = false;
618
619 // Do Automatic Save?
620 if (m_bAutoSaveEnabled) {
621
622 auto &projectFileManager = ProjectFileManager::Get( mProject );
623 // MY: If this project has already been saved then simply execute a Save here
624 if (m_bProjectAlreadySaved) {
625 bSaveOK = projectFileManager.Save();
626 } else {
627 bSaveOK = projectFileManager.SaveFromTimerRecording(m_fnAutoSaveFile);
628 }
629 }
630
631 // Do Automatic Export?
632 if (m_bAutoExportEnabled) {
633 const auto& tracks = TrackList::Get(mProject);
634 if(ExportUtils::FindExportWaveTracks(tracks, false).empty())
635 {
636 ShowExportErrorDialog(XO("All audio is muted."), XO("Warning"), false);
637 bExportOK = true;
638 }
639 else
640 {
641 const auto t0 = std::max(.0, tracks.GetStartTime());
642
643 auto [exportPlugin, formatIndex] =
644 ExportPluginRegistry::Get().FindFormat(m_sAutoExportFormat);
645
646 if(exportPlugin != nullptr)
647 {
648 auto builder = ExportTaskBuilder {}
649 .SetFileName(m_fnAutoExportFile)
650 .SetParameters(m_AutoExportParameters)
651 .SetRange(t0, tracks.GetEndTime(), false)
652 .SetSampleRate(m_iAutoExportSampleRate)
653 .SetNumChannels(m_iAutoExportChannels)
654 .SetPlugin(exportPlugin, formatIndex);
655
656 ExportProgressUI::ExceptionWrappedCall([&]
657 {
658 const auto result = ExportProgressUI::Show(builder.Build(mProject));
659 bExportOK = result == ExportResult::Success ||

Callers

nothing calls this directly

Calls 15

GetFunction · 0.85
ShowExportErrorDialogFunction · 0.85
maxFunction · 0.85
ExceptionWrappedCallFunction · 0.85
AudacityMessageBoxFunction · 0.85
FindFormatMethod · 0.80
SetNumChannelsMethod · 0.80
SetFileNameMethod · 0.80
BuildMethod · 0.80
GetSelectionMethod · 0.45
SaveMethod · 0.45

Tested by

no test coverage detected