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

Function RunTempoDetection

src/ProjectFileManager.cpp:1405–1438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1403namespace
1404{
1405std::vector<std::shared_ptr<MIR::AnalyzedAudioClip>> RunTempoDetection(
1406 const std::vector<std::shared_ptr<ClipMirAudioReader>>& readers,
1407 const MIR::ProjectInterface& project, bool projectWasEmpty)
1408{
1409 const auto isBeatsAndMeasures = project.ViewIsBeatsAndMeasures();
1410 const auto projectTempo = project.GetTempo();
1411
1412 using namespace BasicUI;
1413 auto progress = MakeProgress(
1414 XO("Music Information Retrieval"), XO("Analyzing imported audio"),
1415 ProgressShowCancel);
1416 auto count = 0;
1417 const auto reportProgress = [&](double progressFraction) {
1418 const auto result = progress->Poll(
1419 (count + progressFraction) / readers.size() * 1000, 1000);
1420 if (result != ProgressResult::Success)
1421 throw UserException {};
1422 };
1423
1424 std::vector<std::shared_ptr<MIR::AnalyzedAudioClip>> analyzedClips;
1425 analyzedClips.reserve(readers.size());
1426 std::transform(
1427 readers.begin(), readers.end(), std::back_inserter(analyzedClips),
1428 [&](const std::shared_ptr<ClipMirAudioReader>& reader) {
1429 const MIR::ProjectSyncInfoInput input {
1430 *reader, reader->filename, reader->tags, reportProgress,
1431 projectTempo, projectWasEmpty, isBeatsAndMeasures,
1432 };
1433 auto syncInfo = MIR::GetProjectSyncInfo(input);
1434 ++count;
1435 return std::make_shared<AnalyzedWaveClip>(reader, syncInfo);
1436 });
1437 return analyzedClips;
1438}
1439} // namespace
1440
1441bool ProjectFileManager::ImportWithTempoDetection(

Callers 1

Calls 8

GetProjectSyncInfoFunction · 0.85
MakeProgressFunction · 0.50
GetTempoMethod · 0.45
PollMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected