Audacity  3.0.3
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
ProjectRate Class Referencefinal

Holds project sample rate. More...

#include <ProjectRate.h>

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

Public Member Functions

 ProjectRate (AudacityProject &project)
 
 ProjectRate (const ProjectRate &) PROHIBITED
 
ProjectRateoperator= (const ProjectRate &) PROHIBITED
 
void SetRate (double rate)
 
double GetRate () const
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static ProjectRateGet (AudacityProject &project)
 
static const ProjectRateGet (const AudacityProject &project)
 

Private Attributes

AudacityProjectmProject
 
double mRate
 

Detailed Description

Holds project sample rate.

Definition at line 25 of file ProjectRate.h.

Constructor & Destructor Documentation

◆ ProjectRate() [1/2]

ProjectRate::ProjectRate ( AudacityProject project)
explicit

Definition at line 52 of file ProjectRate.cpp.

53  : mProject{ project }
54 {
55  int intRate = 0;
56  bool wasDefined = QualitySettings::DefaultSampleRate.Read( &intRate );
57  mRate = intRate;
58  if ( !wasDefined ) {
59  // The default given above can vary with host/devices. So unless there is
60  // an entry for the default sample rate in audacity.cfg, Audacity can open
61  // with a rate which is different from the rate with which it closed.
62  // See bug 1879.
64  gPrefs->Flush();
65  }
66 }

◆ ProjectRate() [2/2]

ProjectRate::ProjectRate ( const ProjectRate )

Member Function Documentation

◆ Get() [1/2]

ProjectRate & ProjectRate::Get ( AudacityProject project)
static

Definition at line 42 of file ProjectRate.cpp.

43 {
44  return project.AttachedObjects::Get< ProjectRate >( sKey );
45 }

References sKey.

Referenced by ProjectFileManager::AddImportedTracks(), ProjectSelectionManager::AS_GetRate(), ProjectSelectionManager::AS_SetRate(), BenchmarkDialog::BenchmarkDialog(), ContrastDialog::ContrastDialog(), DefaultPlayOptions(), DefaultSpeedPlayOptions(), LabelTrackView::DoEditLabels(), EffectUI::DoEffect(), anonymous_namespace{TrackMenus.cpp}::DoMixAndRender(), anonymous_namespace{EditMenus.cpp}::DoPasteNothingSelected(), ExportCL::Export(), ExportFLAC::Export(), ExportMP3::Export(), ExportOGG::Export(), ExportPCM::Export(), Get(), ProjectManager::GetEstimatedRecordingMinsLeftOnDisk(), anonymous_namespace{TimeTrack.cpp}::GetRate(), anonymous_namespace{SelectMenus.cpp}::GridMove(), ImportRaw(), ExportFFmpeg::InitCodecs(), anonymous_namespace{SelectMenus.cpp}::NearestZeroCrossing(), TrackActions::Handler::OnNewStereoTrack(), TrackActions::Handler::OnNewWaveTrack(), TimeToolBar::OnRateChanged(), TrackActions::Handler::OnResample(), SelectUtilities::OnSetRegion(), TransportActions::Handler::OnTimerRecord(), SelectActions::Handler::OnZeroCrossing(), ProjectFileManager::OpenProjectFile(), TimeToolBar::Populate(), NyquistEffect::Process(), SnapManager::Reinit(), EffectToneGen::SetAutomationParameters(), ProjectSelectionManager::SnapSelection(), and ProjectSelectionManager::SSBL_GetRate().

Here is the caller graph for this function:

◆ Get() [2/2]

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

Definition at line 47 of file ProjectRate.cpp.

48 {
49  return Get( const_cast< AudacityProject & >( project ) );
50 }

References Get().

Here is the call graph for this function:

◆ GetRate()

double ProjectRate::GetRate ( ) const

◆ operator=()

ProjectRate& ProjectRate::operator= ( const ProjectRate )

◆ SetRate()

void ProjectRate::SetRate ( double  rate)

Definition at line 73 of file ProjectRate.cpp.

74 {
75  if (rate != mRate) {
76  mRate = rate;
78  }
79 }

References mProject, mRate, and anonymous_namespace{ProjectRate.cpp}::Notify().

Referenced by ProjectFileManager::AddImportedTracks(), and ProjectSelectionManager::AS_SetRate().

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

Member Data Documentation

◆ mProject

AudacityProject& ProjectRate::mProject
private

Definition at line 40 of file ProjectRate.h.

Referenced by SetRate().

◆ mRate

double ProjectRate::mRate
private

Definition at line 41 of file ProjectRate.h.

Referenced by GetRate(), and SetRate().


The documentation for this class was generated from the following files:
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
anonymous_namespace{ProjectRate.cpp}::Notify
void Notify(AudacityProject &project)
Definition: ProjectRate.cpp:27
ProjectRate::Get
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:42
Setting::Write
bool Write(const T &value)
Write value to config and return true if successful.
Definition: Prefs.h:172
ProjectRate::mRate
double mRate
Definition: ProjectRate.h:41
sKey
static const AudacityProject::AttachedObjects::RegisteredFactory sKey
Definition: ProjectRate.cpp:35
Setting::Read
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:128
ProjectRate
Holds project sample rate.
Definition: ProjectRate.h:27
QualitySettings::DefaultSampleRate
PROJECT_RATE_API IntSetting DefaultSampleRate
Definition: QualitySettings.cpp:15
ProjectRate::mProject
AudacityProject & mProject
Definition: ProjectRate.h:40
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92