Audacity 3.2.0
Static Public Member Functions | List of all members
ExportPluginHelpers Class Referencefinal

Utility class that provides helper functions for ExportPlugin. More...

#include <ExportPluginHelpers.h>

Static Public Member Functions

static std::unique_ptr< MixerCreateMixer (const AudacityProject &project, bool selectionOnly, double startTime, double stopTime, unsigned numOutChannels, size_t outBufferSize, bool outInterleaved, double outRate, sampleFormat outFormat, MixerOptions::Downmix *mixerSpec)
 
static ExportResult UpdateProgress (ExportProcessorDelegate &delegate, Mixer &mixer, double t0, double t1)
 Sends progress update to delegate and retrieves state update from it. Typically used inside each export iteration. More...
 
template<typename T >
static T GetParameterValue (const ExportProcessor::Parameters &parameters, int id, T defaultValue=T())
 

Detailed Description

Utility class that provides helper functions for ExportPlugin.

Definition at line 31 of file ExportPluginHelpers.h.

Member Function Documentation

◆ CreateMixer()

std::unique_ptr< Mixer > ExportPluginHelpers::CreateMixer ( const AudacityProject project,
bool  selectionOnly,
double  startTime,
double  stopTime,
unsigned  numOutChannels,
size_t  outBufferSize,
bool  outInterleaved,
double  outRate,
sampleFormat  outFormat,
MixerOptions::Downmix mixerSpec 
)
static

Definition at line 23 of file ExportPluginHelpers.cpp.

28{
29 Mixer::Inputs inputs;
30 const auto& tracks = TrackList::Get(project);
31 for (auto pTrack: ExportUtils::FindExportWaveTracks(tracks, selectionOnly))
32 inputs.emplace_back(
33 StretchingSequence::Create(*pTrack, pTrack->GetClipInterfaces()),
34 GetEffectStages(*pTrack));
35 // MB: the stop time should not be warped, this was a bug.
36 return std::make_unique<Mixer>(
37 move(inputs), GetMasterEffectStages(project),
38 // Throw, to stop exporting, if read fails:
39 true, Mixer::WarpOptions { tracks.GetOwner() }, startTime, stopTime,
40 numOutChannels, outBufferSize, outInterleaved, outRate, outFormat, true,
41 mixerSpec,
43}
std::vector< MixerOptions::StageSpecification > GetMasterEffectStages(const AudacityProject &project)
std::vector< MixerOptions::StageSpecification > GetEffectStages(const WaveTrack &track)
const auto tracks
const auto project
static TrackIterRange< const WaveTrack > FindExportWaveTracks(const TrackList &tracks, bool selectedOnly)
Definition: ExportUtils.cpp:23
std::vector< Input > Inputs
Definition: Mix.h:47
static std::shared_ptr< StretchingSequence > Create(const PlayableSequence &, const ClipConstHolders &clips)
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
Immutable structure is an argument to Mixer's constructor.
Definition: MixerOptions.h:56

References StretchingSequence::Create(), ExportUtils::FindExportWaveTracks(), TrackList::Get(), GetEffectStages(), GetMasterEffectStages(), Mixer::MapChannels, Mixer::Mixdown, project, and tracks.

Referenced by FFmpegExporter::CreateMixer(), CLExportProcessor::Initialize(), FLACExportProcessor::Initialize(), MP2ExportProcessor::Initialize(), MP3ExportProcessor::Initialize(), OGGExportProcessor::Initialize(), OpusExportProcessor::Initialize(), PCMExportProcessor::Initialize(), and WavPackExportProcessor::Initialize().

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

◆ GetParameterValue()

template<typename T >
static T ExportPluginHelpers::GetParameterValue ( const ExportProcessor::Parameters parameters,
int  id,
defaultValue = T() 
)
inlinestatic

Definition at line 45 of file ExportPluginHelpers.h.

46 {
47 auto it = std::find_if(
48 parameters.begin(),
49 parameters.end(),
50 [=](const auto& t) { return std::get<0>(t) == id; });
51 if(it != parameters.end())
52 {
53 if(auto value = std::get_if<T>(&std::get<1>(*it)))
54 return *value;
55 }
56 return defaultValue;
57 }

Referenced by FFmpegExporter::InitCodecs(), CLExportProcessor::Initialize(), MP2ExportProcessor::Initialize(), MP3ExportProcessor::Initialize(), OGGExportProcessor::Initialize(), and PCMExportProcessor::Initialize().

Here is the caller graph for this function:

◆ UpdateProgress()

ExportResult ExportPluginHelpers::UpdateProgress ( ExportProcessorDelegate delegate,
Mixer mixer,
double  t0,
double  t1 
)
static

Sends progress update to delegate and retrieves state update from it. Typically used inside each export iteration.

Definition at line 56 of file ExportPluginHelpers.cpp.

57{
58 delegate.OnProgress(EvalExportProgress(mixer, t0, t1));
59 if(delegate.IsStopped())
61 if(delegate.IsCancelled())
64}
virtual bool IsCancelled() const =0
virtual void OnProgress(double progress)=0
virtual bool IsStopped() const =0
double EvalExportProgress(Mixer &mixer, double t0, double t1)

References Cancelled, anonymous_namespace{ExportPluginHelpers.cpp}::EvalExportProgress(), ExportProcessorDelegate::IsCancelled(), ExportProcessorDelegate::IsStopped(), ExportProcessorDelegate::OnProgress(), Stopped, and Success.

Referenced by CLExportProcessor::Process(), FFmpegExportProcessor::Process(), FLACExportProcessor::Process(), MP2ExportProcessor::Process(), MP3ExportProcessor::Process(), OGGExportProcessor::Process(), OpusExportProcessor::Process(), PCMExportProcessor::Process(), and WavPackExportProcessor::Process().

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

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