Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ProjectTimeSignature Class Referencefinal

#include <ProjectTimeSignature.h>

Inheritance diagram for ProjectTimeSignature:
[legend]
Collaboration diagram for ProjectTimeSignature:
[legend]

Public Member Functions

 ProjectTimeSignature ()
 
 ~ProjectTimeSignature () override
 
double GetTempo () const
 
void SetTempo (double tempo)
 
int GetUpperTimeSignature () const
 
void SetUpperTimeSignature (int upperTimeSignature)
 
int GetLowerTimeSignature () const
 
void SetLowerTimeSignature (int lowerTimeSignature)
 
double GetQuarterDuration () const
 
double GetBeatDuration () const
 
double GetBarDuration () const
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 
- Public Member Functions inherited from Observer::Publisher< TimeSignatureChangedMessage >
 Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={})
 Constructor supporting type-erased custom allocation/deletion. More...
 
 Publisher (Publisher &&)=default
 
Publisheroperator= (Publisher &&)=default
 
Subscription Subscribe (Callback callback)
 Connect a callback to the Publisher; later-connected are called earlier. More...
 
Subscription Subscribe (Object &obj, Return(Object::*callback)(Args...))
 Overload of Subscribe takes an object and pointer-to-member-function. More...
 

Static Public Member Functions

static ProjectTimeSignatureGet (AudacityProject &project)
 
static const ProjectTimeSignatureGet (const AudacityProject &project)
 

Private Member Functions

void PublishSignatureChange ()
 

Private Attributes

double mTempo
 
int mUpperTimeSignature
 
int mLowerTimeSignature
 

Additional Inherited Members

- Public Types inherited from Observer::Publisher< TimeSignatureChangedMessage >
using message_type = TimeSignatureChangedMessage
 
using CallbackReturn = std::conditional_t< true, void, bool >
 
using Callback = std::function< CallbackReturn(const TimeSignatureChangedMessage &) >
 Type of functions that can be connected to the Publisher. More...
 
- Static Public Attributes inherited from Observer::Publisher< TimeSignatureChangedMessage >
static constexpr bool notifies_all
 
- Protected Member Functions inherited from Observer::Publisher< TimeSignatureChangedMessage >
CallbackReturn Publish (const TimeSignatureChangedMessage &message)
 Send a message to connected callbacks. More...
 

Detailed Description

Definition at line 25 of file ProjectTimeSignature.h.

Constructor & Destructor Documentation

◆ ProjectTimeSignature()

ProjectTimeSignature::ProjectTimeSignature ( )

Definition at line 35 of file ProjectTimeSignature.cpp.

39{}
IntSetting UpperTimeSignature
The upper time signature of the Beats & Measures ruler.
Definition: Beats.cpp:14
IntSetting LowerTimeSignature
The lower time signature of the Beats & Measures ruler.
Definition: Beats.cpp:15
DoubleSetting BeatsPerMinute
The tempo used for drawing the Beats & Measures ruler.
Definition: Beats.cpp:13
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:207

◆ ~ProjectTimeSignature()

ProjectTimeSignature::~ProjectTimeSignature ( )
overridedefault

Member Function Documentation

◆ Get() [1/2]

ProjectTimeSignature & ProjectTimeSignature::Get ( AudacityProject project)
static

◆ Get() [2/2]

const ProjectTimeSignature & ProjectTimeSignature::Get ( const AudacityProject project)
static

Definition at line 30 of file ProjectTimeSignature.cpp.

31{
32 return Get(const_cast<AudacityProject&>(project));
33}
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
static ProjectTimeSignature & Get(AudacityProject &project)

References Get(), and project.

Here is the call graph for this function:

◆ GetBarDuration()

double ProjectTimeSignature::GetBarDuration ( ) const

Definition at line 107 of file ProjectTimeSignature.cpp.

108{
110}

References GetBeatDuration(), and mUpperTimeSignature.

Here is the call graph for this function:

◆ GetBeatDuration()

double ProjectTimeSignature::GetBeatDuration ( ) const

Definition at line 102 of file ProjectTimeSignature.cpp.

103{
105}
double GetQuarterDuration() const

References GetQuarterDuration(), and mLowerTimeSignature.

Referenced by GetBarDuration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLowerTimeSignature()

int ProjectTimeSignature::GetLowerTimeSignature ( ) const

Definition at line 79 of file ProjectTimeSignature.cpp.

80{
82}

References mLowerTimeSignature.

Referenced by BeatsFormat::BeatsFormat().

Here is the caller graph for this function:

◆ GetQuarterDuration()

double ProjectTimeSignature::GetQuarterDuration ( ) const

Definition at line 97 of file ProjectTimeSignature.cpp.

98{
99 return 60.0 / mTempo;
100}

References mTempo.

Referenced by GetBeatDuration().

Here is the caller graph for this function:

◆ GetTempo()

double ProjectTimeSignature::GetTempo ( ) const

Definition at line 43 of file ProjectTimeSignature.cpp.

44{
45 return mTempo;
46}

References mTempo.

Referenced by BeatsFormat::BeatsFormat(), ProjectFileManager::DoImport(), anonymous_namespace{EditMenus.cpp}::DoPasteNothingSelected(), BenchmarkDialog::OnRun(), and ProjectTempoListener::ProjectTempoListener().

Here is the caller graph for this function:

◆ GetUpperTimeSignature()

int ProjectTimeSignature::GetUpperTimeSignature ( ) const

Definition at line 61 of file ProjectTimeSignature.cpp.

62{
64}

References mUpperTimeSignature.

Referenced by BeatsFormat::BeatsFormat().

Here is the caller graph for this function:

◆ PublishSignatureChange()

void ProjectTimeSignature::PublishSignatureChange ( )
private

Definition at line 112 of file ProjectTimeSignature.cpp.

113{
116}
CallbackReturn Publish(const TimeSignatureChangedMessage &message)
Send a message to connected callbacks.
Definition: Observer.h:207

References mLowerTimeSignature, mTempo, mUpperTimeSignature, and Observer::Publisher< TimeSignatureChangedMessage >::Publish().

Referenced by SetLowerTimeSignature(), SetTempo(), and SetUpperTimeSignature().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetLowerTimeSignature()

void ProjectTimeSignature::SetLowerTimeSignature ( int  lowerTimeSignature)

Definition at line 84 of file ProjectTimeSignature.cpp.

85{
86 if (mLowerTimeSignature != lowerTimeSignature)
87 {
88 mLowerTimeSignature = lowerTimeSignature;
89
90 LowerTimeSignature.Write(lowerTimeSignature);
91 gPrefs->Flush();
92
94 }
95}
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
bool Write(const T &value)
Write value to config and return true if successful.
Definition: Prefs.h:259
virtual bool Flush() noexcept=0

References audacity::BasicSettings::Flush(), gPrefs, LowerTimeSignature, mLowerTimeSignature, PublishSignatureChange(), and Setting< T >::Write().

Referenced by TimeSignatureToolBar::Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTempo()

void ProjectTimeSignature::SetTempo ( double  tempo)

Definition at line 48 of file ProjectTimeSignature.cpp.

49{
50 if (mTempo != tempo)
51 {
52 mTempo = tempo;
53
54 BeatsPerMinute.Write(tempo);
55 gPrefs->Flush();
56
58 }
59}

References BeatsPerMinute, audacity::BasicSettings::Flush(), gPrefs, mTempo, PublishSignatureChange(), and Setting< T >::Write().

Referenced by TimeSignatureToolBar::Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetUpperTimeSignature()

void ProjectTimeSignature::SetUpperTimeSignature ( int  upperTimeSignature)

Definition at line 66 of file ProjectTimeSignature.cpp.

67{
68 if (mUpperTimeSignature != upperTimeSignature)
69 {
70 mUpperTimeSignature = upperTimeSignature;
71
72 UpperTimeSignature.Write(upperTimeSignature);
73 gPrefs->Flush();
74
76 }
77}

References audacity::BasicSettings::Flush(), gPrefs, mUpperTimeSignature, PublishSignatureChange(), UpperTimeSignature, and Setting< T >::Write().

Referenced by TimeSignatureToolBar::Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mLowerTimeSignature

int ProjectTimeSignature::mLowerTimeSignature
private

◆ mTempo

double ProjectTimeSignature::mTempo
private

◆ mUpperTimeSignature

int ProjectTimeSignature::mUpperTimeSignature
private

The documentation for this class was generated from the following files: