Audacity  3.0.0
Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
TrackFactory Class Referencefinal

#include <TrackFactory.h>

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

Public Member Functions

 TrackFactory (const ProjectSettings &settings, AudacityProject &project, const ZoomInfo *zoomInfo)
 
 TrackFactory (const TrackFactory &) PROHIBITED
 
TrackFactoryoperator= (const TrackFactory &) PROHIBITED
 
std::shared_ptr< WaveTrackDuplicateWaveTrack (const WaveTrack &orig)
 
std::shared_ptr< WaveTrackNewWaveTrack (sampleFormat format=(sampleFormat) 0, double rate=0)
 
std::shared_ptr< LabelTrackNewLabelTrack ()
 
std::shared_ptr< TimeTrackNewTimeTrack ()
 
std::shared_ptr< NoteTrackNewNoteTrack ()
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static TrackFactoryGet (AudacityProject &project)
 
static const TrackFactoryGet (const AudacityProject &project)
 
static TrackFactoryReset (AudacityProject &project)
 
static void Destroy (AudacityProject &project)
 

Private Attributes

const ProjectSettingsmSettings
 
AudacityProjectmProject
 
const ZoomInfo *const mZoomInfo
 

Friends

class AudacityProject
 

Detailed Description

Definition at line 18 of file TrackFactory.h.

Constructor & Destructor Documentation

◆ TrackFactory() [1/2]

TrackFactory::TrackFactory ( const ProjectSettings settings,
AudacityProject project,
const ZoomInfo zoomInfo 
)
inline

Definition at line 27 of file TrackFactory.h.

29  : mSettings{ settings }
30  , mProject(project)
31  , mZoomInfo(zoomInfo)
32  {
33  }

References settings().

Here is the call graph for this function:

◆ TrackFactory() [2/2]

TrackFactory::TrackFactory ( const TrackFactory )

Member Function Documentation

◆ Destroy()

void TrackFactory::Destroy ( AudacityProject project)
static

Definition at line 76 of file TrackFactory.cpp.

77 {
78  project.AttachedObjects::Assign( key2, nullptr );
79 }

References key2.

◆ DuplicateWaveTrack()

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

Definition at line 34 of file TrackFactory.cpp.

35 {
36  return std::static_pointer_cast<WaveTrack>( orig.Duplicate() );
37 }

References Track::Duplicate().

Here is the call graph for this function:

◆ Get() [1/2]

TrackFactory & TrackFactory::Get ( AudacityProject project)
static

Definition at line 59 of file TrackFactory.cpp.

60 {
61  return project.AttachedObjects::Get< TrackFactory >( key2 );
62 }

References key2.

Referenced by Get().

Here is the caller graph for this function:

◆ Get() [2/2]

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

Definition at line 64 of file TrackFactory.cpp.

65 {
66  return Get( const_cast< AudacityProject & >( project ) );
67 }

References Get().

Here is the call graph for this function:

◆ NewLabelTrack()

LabelTrack::Holder TrackFactory::NewLabelTrack ( )

Definition at line 19 of file TrackFactory.cpp.

20 {
21  return std::make_shared<LabelTrack>();
22 }

◆ NewNoteTrack()

NoteTrack::Holder TrackFactory::NewNoteTrack ( )

Definition at line 24 of file TrackFactory.cpp.

25 {
26  return std::make_shared<NoteTrack>();
27 }

◆ NewTimeTrack()

std::shared_ptr< TimeTrack > TrackFactory::NewTimeTrack ( )

Definition at line 29 of file TrackFactory.cpp.

30 {
31  return std::make_shared<TimeTrack>(mZoomInfo);
32 }

References mZoomInfo.

◆ NewWaveTrack()

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

Definition at line 39 of file TrackFactory.cpp.

40 {
41  if (format == (sampleFormat)0)
43  if (rate == 0)
44  rate = mSettings.GetRate();
45  return std::make_shared<WaveTrack> ( &mProject, format, rate );
46 }

References format, ProjectSettings::GetRate(), mProject, mSettings, and QualityPrefs::SampleFormatChoice().

Referenced by GStreamerImportFileHandle::OnNewSample().

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

◆ operator=()

TrackFactory& TrackFactory::operator= ( const TrackFactory )

◆ Reset()

TrackFactory & TrackFactory::Reset ( AudacityProject project)
static

Definition at line 69 of file TrackFactory.cpp.

70 {
71  auto result = TrackFactoryFactory( project );
72  project.AttachedObjects::Assign( key2, result );
73  return *result;
74 }

References key2, and TrackFactoryFactory.

Friends And Related Function Documentation

◆ AudacityProject

friend class AudacityProject
friend

Definition at line 41 of file TrackFactory.h.

Member Data Documentation

◆ mProject

AudacityProject& TrackFactory::mProject
private

Definition at line 39 of file TrackFactory.h.

Referenced by NewWaveTrack().

◆ mSettings

const ProjectSettings& TrackFactory::mSettings
private

Definition at line 38 of file TrackFactory.h.

Referenced by NewWaveTrack().

◆ mZoomInfo

const ZoomInfo* const TrackFactory::mZoomInfo
private

Definition at line 40 of file TrackFactory.h.

Referenced by NewTimeTrack().


The documentation for this class was generated from the following files:
TrackFactoryFactory
static auto TrackFactoryFactory
Definition: TrackFactory.cpp:48
TrackFactory::mSettings
const ProjectSettings & mSettings
Definition: TrackFactory.h:38
Track::Duplicate
virtual Holder Duplicate() const
Definition: Track.cpp:113
key2
static const AudacityProject::AttachedObjects::RegisteredFactory key2
Definition: TrackFactory.cpp:55
sampleFormat
sampleFormat
Definition: Types.h:725
format
int format
Definition: ExportPCM.cpp:54
TrackFactory
Definition: TrackFactory.h:20
QualityPrefs::SampleFormatChoice
static sampleFormat SampleFormatChoice()
Definition: QualityPrefs.cpp:246
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:112
ProjectSettings::GetRate
double GetRate() const
Definition: ProjectSettings.cpp:166
TrackFactory::Get
static TrackFactory & Get(AudacityProject &project)
Definition: TrackFactory.cpp:59
TrackFactory::mProject
AudacityProject & mProject
Definition: TrackFactory.h:39
settings
static Settings & settings()
Definition: TrackInfo.cpp:87
TrackFactory::mZoomInfo
const ZoomInfo *const mZoomInfo
Definition: TrackFactory.h:40