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

Used to create or clone a WaveTrack, with appropriate context from the project that will own the track. More...

#include <WaveTrack.h>

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

Public Member Functions

 WaveTrackFactory (const ProjectRate &rate, const SampleBlockFactoryPtr &pFactory)
 
 WaveTrackFactory (const WaveTrackFactory &) PROHIBITED
 
WaveTrackFactoryoperator= (const WaveTrackFactory &) PROHIBITED
 
const SampleBlockFactoryPtrGetSampleBlockFactory () const
 
std::shared_ptr< WaveTrackDuplicateWaveTrack (const WaveTrack &orig)
 
std::shared_ptr< WaveTrackNewWaveTrack (sampleFormat format=(sampleFormat) 0, double rate=0)
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static WaveTrackFactoryGet (AudacityProject &project)
 
static const WaveTrackFactoryGet (const AudacityProject &project)
 
static WaveTrackFactoryReset (AudacityProject &project)
 
static void Destroy (AudacityProject &project)
 

Private Attributes

const ProjectRatemRate
 
SampleBlockFactoryPtr mpFactory
 

Detailed Description

Used to create or clone a WaveTrack, with appropriate context from the project that will own the track.

Definition at line 607 of file WaveTrack.h.

Constructor & Destructor Documentation

◆ WaveTrackFactory() [1/2]

WaveTrackFactory::WaveTrackFactory ( const ProjectRate rate,
const SampleBlockFactoryPtr pFactory 
)
inline

Definition at line 616 of file WaveTrack.h.

619  : mRate{ rate }
620  , mpFactory(pFactory)
621  {
622  }

◆ WaveTrackFactory() [2/2]

WaveTrackFactory::WaveTrackFactory ( const WaveTrackFactory )

Member Function Documentation

◆ Destroy()

void WaveTrackFactory::Destroy ( AudacityProject project)
static

Definition at line 2816 of file WaveTrack.cpp.

2817 {
2818  project.AttachedObjects::Assign( key2, nullptr );
2819 }

References key2.

Referenced by ProjectManager::OnCloseWindow().

Here is the caller graph for this function:

◆ DuplicateWaveTrack()

WaveTrack::Holder WaveTrackFactory::DuplicateWaveTrack ( const WaveTrack orig)

Definition at line 118 of file WaveTrack.cpp.

119 {
120  auto waveTrack = std::static_pointer_cast<WaveTrack>( orig.Duplicate() );
121 
122  return waveTrack;
123 }

References Track::Duplicate().

Here is the call graph for this function:

◆ Get() [1/2]

WaveTrackFactory & WaveTrackFactory::Get ( AudacityProject project)
static

◆ Get() [2/2]

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

Definition at line 2804 of file WaveTrack.cpp.

2805 {
2806  return Get( const_cast< AudacityProject & >( project ) );
2807 }

References WaveTrack::Get().

Here is the call graph for this function:

◆ GetSampleBlockFactory()

const SampleBlockFactoryPtr& WaveTrackFactory::GetSampleBlockFactory ( ) const
inline

Definition at line 626 of file WaveTrack.h.

627  { return mpFactory; }

Referenced by ProjectFileIO::LoadProject().

Here is the caller graph for this function:

◆ NewWaveTrack()

WaveTrack::Holder WaveTrackFactory::NewWaveTrack ( sampleFormat  format = (sampleFormat)0,
double  rate = 0 
)

Definition at line 126 of file WaveTrack.cpp.

127 {
128  if (format == (sampleFormat)0)
130  if (rate == 0)
131  rate = mRate.GetRate();
132 
133  auto waveTrack = std::make_shared<WaveTrack> ( mpFactory, format, rate );
134 
135  return waveTrack;
136 }

References format, ProjectRate::GetRate(), mpFactory, mRate, and QualitySettings::SampleFormatChoice().

Referenced by Effect::DoEffect(), ProjectAudioManager::DoRecord(), ImportRaw(), MixAndRender(), and ImportFileHandle::NewWaveTrack().

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

◆ operator=()

WaveTrackFactory& WaveTrackFactory::operator= ( const WaveTrackFactory )

◆ Reset()

WaveTrackFactory & WaveTrackFactory::Reset ( AudacityProject project)
static

Definition at line 2809 of file WaveTrack.cpp.

2810 {
2811  auto result = TrackFactoryFactory( project );
2812  project.AttachedObjects::Assign( key2, result );
2813  return *result;
2814 }

References key2, and TrackFactoryFactory.

Referenced by ProjectManager::ResetProjectToEmpty().

Here is the caller graph for this function:

Member Data Documentation

◆ mpFactory

SampleBlockFactoryPtr WaveTrackFactory::mpFactory
private

Definition at line 631 of file WaveTrack.h.

Referenced by NewWaveTrack().

◆ mRate

const ProjectRate& WaveTrackFactory::mRate
private

Definition at line 630 of file WaveTrack.h.

Referenced by NewWaveTrack().


The documentation for this class was generated from the following files:
WaveTrackFactory::Get
static WaveTrackFactory & Get(AudacityProject &project)
Definition: WaveTrack.cpp:2799
WaveTrackFactory::mRate
const ProjectRate & mRate
Definition: WaveTrack.h:630
Track::Duplicate
virtual Holder Duplicate() const
Definition: Track.cpp:107
WaveTrackFactory::mpFactory
SampleBlockFactoryPtr mpFactory
Definition: WaveTrack.h:631
key2
static const AudacityProject::AttachedObjects::RegisteredFactory key2
Definition: WaveTrack.cpp:2795
format
int format
Definition: ExportPCM.cpp:56
ProjectRate::GetRate
double GetRate() const
Definition: ProjectRate.cpp:53
WaveTrackFactory
Used to create or clone a WaveTrack, with appropriate context from the project that will own the trac...
Definition: WaveTrack.h:609
sampleFormat
sampleFormat
Definition: SampleFormat.h:29
QualitySettings::SampleFormatChoice
PROJECT_RATE_API sampleFormat SampleFormatChoice()
Definition: QualitySettings.cpp:38
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
TrackFactoryFactory
static auto TrackFactoryFactory
Definition: WaveTrack.cpp:2789