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

Method ImportWithTempoDetection

src/ProjectFileManager.cpp:1441–1469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1439} // namespace
1440
1441bool ProjectFileManager::ImportWithTempoDetection(
1442 const std::vector<FilePath>& fileNames, bool addToHistory)
1443{
1444 const auto projectWasEmpty =
1445 TrackList::Get(mProject).Any<WaveTrack>().empty();
1446 std::vector<std::shared_ptr<ClipMirAudioReader>> resultingReaders;
1447 const auto success = std::all_of(
1448 fileNames.begin(), fileNames.end(), [&](const FilePath& fileName) {
1449 std::shared_ptr<ClipMirAudioReader> resultingReader;
1450 const auto success = DoImport(fileName, addToHistory, &resultingReader);
1451 if (success && resultingReader)
1452 resultingReaders.push_back(std::move(resultingReader));
1453 return success;
1454 });
1455 // At the moment, one failing import doesn't revert the project state, hence
1456 // we still run the analysis on what was successfully imported.
1457 // TODO implement reverting of the project state on failure.
1458 if (!resultingReaders.empty())
1459 {
1460 const auto pProj = mProject.shared_from_this();
1461 BasicUI::CallAfter([=] {
1462 AudacityMirProject mirInterface { *pProj };
1463 const auto analyzedClips =
1464 RunTempoDetection(resultingReaders, mirInterface, projectWasEmpty);
1465 MIR::SynchronizeProject(analyzedClips, mirInterface, projectWasEmpty);
1466 });
1467 }
1468 return success;
1469}
1470
1471bool ProjectFileManager::ImportWithoutTempoDetection(
1472 const std::vector<FilePath>& fileNames, bool addToHistory)

Callers 1

ImportMethod · 0.80

Calls 10

GetFunction · 0.85
DoImportFunction · 0.85
moveFunction · 0.85
CallAfterFunction · 0.85
RunTempoDetectionFunction · 0.85
SynchronizeProjectFunction · 0.85
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected