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

Function SnapToBeat

libraries/lib-snapping/details/BeatsSnapFunctions.cpp:34–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34MultiplierFunctor SnapToBeat(int divisor)
35{
36 return [divisor](const AudacityProject& project)
37 {
38 auto& timeSignature = ProjectTimeSignature::Get(project);
39
40 const auto quarterDuration = timeSignature.GetQuarterDuration();
41 // DV: It was decided that for the time being,
42 // BPM sets the duration for quarter notes.
43 // For this reason, `cfg.timeSignature.second` is ignored
44 const auto fracDuration = quarterDuration * 4.0 / divisor;
45 const auto multiplier = 1.0 / fracDuration;
46
47 return multiplier;
48 };
49}
50
51MultiplierFunctor SnapToTriplets(int divisor)
52{

Callers 1

Calls 2

GetFunction · 0.85
GetQuarterDurationMethod · 0.80

Tested by

no test coverage detected