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 TrackList &tracks, 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 TrackList tracks,
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.

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

References StretchingSequence::Create(), ExportUtils::FindExportWaveTracks(), GetEffectStages(), Mixer::MapChannels, Mixer::Mixdown, 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 47 of file ExportPluginHelpers.h.

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

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 59 of file ExportPluginHelpers.cpp.

60{
61 delegate.OnProgress(EvalExportProgress(mixer, t0, t1));
62 if(delegate.IsStopped())
64 if(delegate.IsCancelled())
67}
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: