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

#include <Export.h>

Collaboration diagram for ExportTaskBuilder:
[legend]

Public Member Functions

 ExportTaskBuilder ()
 
 ~ExportTaskBuilder ()
 
ExportTaskBuilderSetFileName (const wxFileName &filename)
 
ExportTaskBuilderSetRange (double t0, double t1, bool selectedOnly=false) noexcept
 
ExportTaskBuilderSetParameters (ExportProcessor::Parameters parameters) noexcept
 
ExportTaskBuilderSetNumChannels (unsigned numChannels) noexcept
 
ExportTaskBuilderSetPlugin (const ExportPlugin *plugin, int format=0) noexcept
 
ExportTaskBuilderSetTags (const Tags *tags) noexcept
 
ExportTaskBuilderSetSampleRate (double sampleRate) noexcept
 
ExportTaskBuilderSetMixerSpec (MixerOptions::Downmix *mixerSpec) noexcept
 
ExportTask Build (AudacityProject &project)
 

Private Attributes

wxFileName mFileName
 
double mT0 {}
 
double mT1 {}
 
bool mSelectedOnly {}
 
unsigned mNumChannels {1}
 
double mSampleRate {44100}
 
ExportProcessor::Parameters mParameters
 
const ExportPluginmPlugin {}
 
int mFormat {}
 
MixerOptions::DownmixmMixerSpec {}
 
const TagsmTags {}
 

Detailed Description

Definition at line 32 of file Export.h.

Constructor & Destructor Documentation

◆ ExportTaskBuilder()

ExportTaskBuilder::ExportTaskBuilder ( )
default

◆ ~ExportTaskBuilder()

ExportTaskBuilder::~ExportTaskBuilder ( )
default

Member Function Documentation

◆ Build()

ExportTask ExportTaskBuilder::Build ( AudacityProject project)

Definition at line 84 of file Export.cpp.

85{
86 //File rename stuff should be moved out to somewhere else...
87 auto filename = mFileName;
88
89 //For safety, if the file already exists we use temporary filename
90 //and replace original one export succeeded
91 int suffix = 0;
92 while (filename.FileExists()) {
93 filename.SetName(mFileName.GetName() +
94 wxString::Format(wxT("%d"), suffix));
95 suffix++;
96 }
97
98 auto processor = mPlugin->CreateProcessor(mFormat);
99 if(!processor->Initialize(project,
101 mFileName.GetFullPath(),
105 mTags))
106 {
108 }
109
110 return ExportTask([actualFilename = filename,
111 targetFilename = mFileName,
112 processor = std::shared_ptr<ExportProcessor>(processor.release())]
113 (ExportProcessorDelegate& delegate)
114 {
115 auto result = ExportResult::Error;
116 auto cleanup = finally( [&] {
117 if(result == ExportResult::Success || result == ExportResult::Stopped)
118 {
119 if (actualFilename != targetFilename)
120 {
121 //may fail...
122 ::wxRenameFile(actualFilename.GetFullPath(),
123 targetFilename.GetFullPath(),
124 true);
125 }
126 }
127 else
128 ::wxRemoveFile(actualFilename.GetFullPath());
129 } );
130 result = processor->Process(delegate);
131 return result;
132 });
133}
wxT("CloseDown"))
std::packaged_task< ExportResult(ExportProcessorDelegate &)> ExportTask
Definition: ExportTypes.h:31
const auto project
virtual std::unique_ptr< ExportProcessor > CreateProcessor(int format) const =0
bool mSelectedOnly
Definition: Export.h:54
double mSampleRate
Definition: Export.h:56
ExportProcessor::Parameters mParameters
Definition: Export.h:57
MixerOptions::Downmix * mMixerSpec
Definition: Export.h:60
const Tags * mTags
Definition: Export.h:61
double mT1
Definition: Export.h:53
double mT0
Definition: Export.h:52
const ExportPlugin * mPlugin
Definition: Export.h:58
unsigned mNumChannels
Definition: Export.h:55
wxFileName mFileName
Definition: Export.h:51
unsigned GetNumChannels() const
Definition: MixerOptions.h:47

References Cancelled, ExportPlugin::CreateProcessor(), MixerOptions::Downmix::GetNumChannels(), mFileName, mFormat, mMixerSpec, mNumChannels, mParameters, mPlugin, mSampleRate, mSelectedOnly, mT0, mT1, mTags, project, and wxT().

Referenced by ExportAudioDialog::OnExport().

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

◆ SetFileName()

ExportTaskBuilder & ExportTaskBuilder::SetFileName ( const wxFileName &  filename)

Definition at line 33 of file Export.cpp.

34{
35 mFileName = filename;
36 return *this;
37}

References mFileName.

Referenced by ExportCommand::Apply(), anonymous_namespace{FileMenus.cpp}::DoExport(), TimerRecordDialog::ExecutePostRecordActions(), audacity::cloud::audiocom::sync::MixdownUploader::ExportProject(), audacity::cloud::audiocom::ShareAudioDialog::ExportProject(), and ExportAudioDialog::OnExport().

Here is the caller graph for this function:

◆ SetMixerSpec()

ExportTaskBuilder & ExportTaskBuilder::SetMixerSpec ( MixerOptions::Downmix mixerSpec)
noexcept

Definition at line 66 of file Export.cpp.

67{
68 mMixerSpec = mixerSpec;
69 return *this;
70}

Referenced by ExportAudioDialog::OnExport().

Here is the caller graph for this function:

◆ SetNumChannels()

ExportTaskBuilder & ExportTaskBuilder::SetNumChannels ( unsigned  numChannels)
noexcept

Definition at line 53 of file Export.cpp.

54{
55 mNumChannels = numChannels;
56 return *this;
57}

Referenced by ExportCommand::Apply(), anonymous_namespace{FileMenus.cpp}::DoExport(), TimerRecordDialog::ExecutePostRecordActions(), audacity::cloud::audiocom::sync::MixdownUploader::ExportProject(), audacity::cloud::audiocom::ShareAudioDialog::ExportProject(), and ExportAudioDialog::OnExport().

Here is the caller graph for this function:

◆ SetParameters()

ExportTaskBuilder & ExportTaskBuilder::SetParameters ( ExportProcessor::Parameters  parameters)
noexcept

Definition at line 47 of file Export.cpp.

48{
49 mParameters = std::move(parameters);
50 return *this;
51}

Referenced by ExportCommand::Apply(), anonymous_namespace{FileMenus.cpp}::DoExport(), TimerRecordDialog::ExecutePostRecordActions(), audacity::cloud::audiocom::sync::MixdownUploader::ExportProject(), audacity::cloud::audiocom::ShareAudioDialog::ExportProject(), and ExportAudioDialog::OnExport().

Here is the caller graph for this function:

◆ SetPlugin()

ExportTaskBuilder & ExportTaskBuilder::SetPlugin ( const ExportPlugin plugin,
int  format = 0 
)
noexcept

Definition at line 59 of file Export.cpp.

60{
61 mPlugin = plugin;
63 return *this;
64}

References anonymous_namespace{ExportPCM.cpp}::format.

Referenced by ExportCommand::Apply(), anonymous_namespace{FileMenus.cpp}::DoExport(), TimerRecordDialog::ExecutePostRecordActions(), audacity::cloud::audiocom::sync::MixdownUploader::ExportProject(), audacity::cloud::audiocom::ShareAudioDialog::ExportProject(), and ExportAudioDialog::OnExport().

Here is the caller graph for this function:

◆ SetRange()

ExportTaskBuilder & ExportTaskBuilder::SetRange ( double  t0,
double  t1,
bool  selectedOnly = false 
)
noexcept

Definition at line 39 of file Export.cpp.

40{
41 mT0 = t0;
42 mT1 = t1;
43 mSelectedOnly = selectedOnly;
44 return *this;
45}

Referenced by ExportCommand::Apply(), anonymous_namespace{FileMenus.cpp}::DoExport(), TimerRecordDialog::ExecutePostRecordActions(), audacity::cloud::audiocom::sync::MixdownUploader::ExportProject(), audacity::cloud::audiocom::ShareAudioDialog::ExportProject(), and ExportAudioDialog::OnExport().

Here is the caller graph for this function:

◆ SetSampleRate()

ExportTaskBuilder & ExportTaskBuilder::SetSampleRate ( double  sampleRate)
noexcept

Definition at line 72 of file Export.cpp.

73{
75 return *this;
76}

References anonymous_namespace{ClipSegmentTest.cpp}::sampleRate.

Referenced by ExportCommand::Apply(), anonymous_namespace{FileMenus.cpp}::DoExport(), TimerRecordDialog::ExecutePostRecordActions(), audacity::cloud::audiocom::sync::MixdownUploader::ExportProject(), audacity::cloud::audiocom::ShareAudioDialog::ExportProject(), and ExportAudioDialog::OnExport().

Here is the caller graph for this function:

◆ SetTags()

ExportTaskBuilder & ExportTaskBuilder::SetTags ( const Tags tags)
noexcept

Definition at line 78 of file Export.cpp.

79{
80 mTags = tags;
81 return *this;
82}

Member Data Documentation

◆ mFileName

wxFileName ExportTaskBuilder::mFileName
private

Definition at line 51 of file Export.h.

Referenced by Build(), and SetFileName().

◆ mFormat

int ExportTaskBuilder::mFormat {}
private

Definition at line 59 of file Export.h.

Referenced by Build().

◆ mMixerSpec

MixerOptions::Downmix* ExportTaskBuilder::mMixerSpec {}
private

Definition at line 60 of file Export.h.

Referenced by Build().

◆ mNumChannels

unsigned ExportTaskBuilder::mNumChannels {1}
private

Definition at line 55 of file Export.h.

Referenced by Build().

◆ mParameters

ExportProcessor::Parameters ExportTaskBuilder::mParameters
private

Definition at line 57 of file Export.h.

Referenced by Build().

◆ mPlugin

const ExportPlugin* ExportTaskBuilder::mPlugin {}
private

Definition at line 58 of file Export.h.

Referenced by Build().

◆ mSampleRate

double ExportTaskBuilder::mSampleRate {44100}
private

Definition at line 56 of file Export.h.

Referenced by Build().

◆ mSelectedOnly

bool ExportTaskBuilder::mSelectedOnly {}
private

Definition at line 54 of file Export.h.

Referenced by Build().

◆ mT0

double ExportTaskBuilder::mT0 {}
private

Definition at line 52 of file Export.h.

Referenced by Build().

◆ mT1

double ExportTaskBuilder::mT1 {}
private

Definition at line 53 of file Export.h.

Referenced by Build().

◆ mTags

const Tags* ExportTaskBuilder::mTags {}
private

Definition at line 61 of file Export.h.

Referenced by Build().


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