Audacity 3.2.0
Functions | Variables
anonymous_namespace{BeatsSnapFunctions.cpp} Namespace Reference

Functions

double SnapToBar (const AudacityProject &project)
 
MultiplierFunctor SnapToBeat (int divisor)
 
MultiplierFunctor SnapToTriplets (int divisor)
 

Variables

SnapRegistryItemRegistrator beats
 

Detailed Description


Audacity: A Digital Audio Editor

BeatsSnapFunctions.cpp

Dmitry Vedenko

Function Documentation

◆ SnapToBar()

double anonymous_namespace{BeatsSnapFunctions.cpp}::SnapToBar ( const AudacityProject project)

Definition at line 24 of file BeatsSnapFunctions.cpp.

25{
26 auto& timeSignature = ProjectTimeSignature::Get(project);
27
28 const auto barDuration = timeSignature.GetBarDuration();
29 const auto multiplier = 1 / barDuration;
30
31 return multiplier;
32}
const auto project
static ProjectTimeSignature & Get(AudacityProject &project)

References ProjectTimeSignature::Get(), and project.

Here is the call graph for this function:

◆ SnapToBeat()

MultiplierFunctor anonymous_namespace{BeatsSnapFunctions.cpp}::SnapToBeat ( int  divisor)

Definition at line 34 of file BeatsSnapFunctions.cpp.

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}
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90

References ProjectTimeSignature::Get(), and project.

Here is the call graph for this function:

◆ SnapToTriplets()

MultiplierFunctor anonymous_namespace{BeatsSnapFunctions.cpp}::SnapToTriplets ( int  divisor)

Definition at line 51 of file BeatsSnapFunctions.cpp.

52{
53 return [divisor](const AudacityProject& project)
54 {
55 auto& timeSignature = ProjectTimeSignature::Get(project);
56
57 const auto quarterDuration = 60.0 / timeSignature.GetTempo();
58 const auto tripletDivisor = 3 * (divisor / 2);
59 const auto fracDuration = quarterDuration * 4.0 / tripletDivisor;
60 const auto multiplier = 1.0 / fracDuration;
61
62 return multiplier;
63 };
64}

References ProjectTimeSignature::Get(), and project.

Here is the call graph for this function:

Variable Documentation

◆ beats

SnapRegistryItemRegistrator anonymous_namespace{BeatsSnapFunctions.cpp}::beats

Definition at line 66 of file BeatsSnapFunctions.cpp.