Audacity 3.2.0
ExportPluginHelpers.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 ExportPluginHelpers.h
6
7 Dominic Mazzoni
8
9 Vitaly Sverchinsky split from ExportPlugin.h
10
11**********************************************************************/
12
13#pragma once
14
15#include <memory>
16
17#include "ExportPlugin.h"
18#include "ExportTypes.h"
19#include "SampleFormat.h"
20
21class TrackList;
22class WaveTrack;
23class Mixer;
24
25namespace MixerOptions
26{
27class Downmix;
28}
29
31class IMPORT_EXPORT_API ExportPluginHelpers final
32{
33public:
34
35 static std::unique_ptr<Mixer> CreateMixer(const TrackList &tracks,
36 bool selectionOnly,
37 double startTime, double stopTime,
38 unsigned numOutChannels, size_t outBufferSize, bool outInterleaved,
39 double outRate, sampleFormat outFormat,
40 MixerOptions::Downmix *mixerSpec);
41
44 static ExportResult UpdateProgress(ExportProcessorDelegate& delegate, Mixer& mixer, double t0, double t1);
45
46 template<typename T>
47 static T GetParameterValue(const ExportProcessor::Parameters& parameters, int id, T defaultValue = T())
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 }
60};
ExportResult
Definition: ExportTypes.h:24
sampleFormat
The ordering of these values with operator < agrees with the order of increasing bit width.
Definition: SampleFormat.h:30
const auto tracks
Utility class that provides helper functions for ExportPlugin.
static T GetParameterValue(const ExportProcessor::Parameters &parameters, int id, T defaultValue=T())
std::vector< std::tuple< ExportOptionID, ExportValue > > Parameters
Definition: ExportPlugin.h:93
Functions for doing the mixdown of the tracks.
Definition: Mix.h:27
A matrix of booleans, one row per input channel, column per output.
Definition: MixerOptions.h:32
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:850
A Track that contains audio waveform data.
Definition: WaveTrack.h:203