Audacity 3.2.0
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
ExportUtils Class Referencefinal

#include <ExportUtils.h>

Public Types

enum class  ExportHookResult { Handled , Continue , Cancel }
 
using ExportHook = std::function< ExportHookResult(AudacityProject &, const FileExtension &)>
 
using Priority = unsigned
 

Static Public Member Functions

static TrackIterRange< const WaveTrackFindExportWaveTracks (const TrackList &tracks, bool selectedOnly)
 
static ExportProcessor::Parameters ParametersFromEditor (const ExportOptionsEditor &editor)
 
static void RegisterExportHook (ExportHook hook, Priority=DEFAULT_EXPORT_HOOK_PRIORITY)
 
static void PerformInteractiveExport (AudacityProject &project, const FileExtension &format)
 

Static Public Attributes

static constexpr Priority DEFAULT_EXPORT_HOOK_PRIORITY = 0
 

Detailed Description

Definition at line 26 of file ExportUtils.h.

Member Typedef Documentation

◆ ExportHook

Definition at line 41 of file ExportUtils.h.

◆ Priority

using ExportUtils::Priority = unsigned

Definition at line 43 of file ExportUtils.h.

Member Enumeration Documentation

◆ ExportHookResult

enum class ExportUtils::ExportHookResult
strong
Enumerator
Handled 
Continue 
Cancel 

Definition at line 34 of file ExportUtils.h.

35 {
36 Handled,
38 Cancel,
39 };
@ Handled
Save was handled by the extension.

Member Function Documentation

◆ FindExportWaveTracks()

TrackIterRange< const WaveTrack > ExportUtils::FindExportWaveTracks ( const TrackList tracks,
bool  selectedOnly 
)
static

Definition at line 22 of file ExportUtils.cpp.

23{
24 bool anySolo =
25 !(tracks.Any<const WaveTrack>() + &WaveTrack::GetSolo).empty();
26
27 return tracks.Any<const WaveTrack>()
28 + (selectedOnly ? &Track::IsSelected : &Track::Any)
30}
const auto tracks
bool GetNotSolo() const
Definition: PlayableTrack.h:50
bool IsSelected() const
Definition: Track.cpp:258
bool Any() const
Definition: Track.cpp:255
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
bool GetMute() const override
May vary asynchronously.
Definition: WaveTrack.cpp:2318
bool GetSolo() const override
May vary asynchronously.
Definition: WaveTrack.cpp:2323

References Track::Any(), WaveTrack::GetMute(), PlayableTrack::GetNotSolo(), WaveTrack::GetSolo(), Track::IsSelected(), and tracks.

Referenced by ExportPluginHelpers::CreateMixer(), anonymous_namespace{FileMenus.cpp}::DoExport(), TimerRecordDialog::ExecutePostRecordActions(), ExportAudioDialog::ExportAudioDialog(), ExportFilePanel::Init(), and ExportAudioDialog::OnExport().

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

◆ ParametersFromEditor()

ExportProcessor::Parameters ExportUtils::ParametersFromEditor ( const ExportOptionsEditor editor)
static

Definition at line 32 of file ExportUtils.cpp.

33{
35 for(int i = 0, count = editor.GetOptionsCount(); i < count; ++i)
36 {
37 ExportOption option;
38 ExportValue value;
39 if(editor.GetOption(i, option) && editor.GetValue(option.id, value))
40 parameters.emplace_back(option.id, value);
41 }
42 return parameters;
43}
std::variant< bool, int, double, std::string > ExportValue
A type of option values (parameters) used by exporting plugins.
Definition: ExportTypes.h:38
virtual bool GetValue(ExportOptionID id, ExportValue &value) const =0
virtual bool GetOption(int index, ExportOption &option) const =0
virtual int GetOptionsCount() const =0
std::vector< std::tuple< ExportOptionID, ExportValue > > Parameters
Definition: ExportPlugin.h:93
A type that provides a description of an exporting option. Isn't allowed to change except non-type re...
Definition: ExportTypes.h:43
ExportOptionID id
Internal option id.
Definition: ExportTypes.h:56

References ExportOptionsEditor::GetOption(), ExportOptionsEditor::GetOptionsCount(), ExportOptionsEditor::GetValue(), and ExportOption::id.

Referenced by ExportCommand::Apply(), anonymous_namespace{FileMenus.cpp}::DoExport(), and ExportOptionsHandler::GetParameters().

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

◆ PerformInteractiveExport()

void ExportUtils::PerformInteractiveExport ( AudacityProject project,
const FileExtension format 
)
static

Definition at line 71 of file ExportUtils.cpp.

73{
74 auto& hooks = ExportHooks();
75 for (auto& hook : hooks)
76 {
78 return;
79 }
80}
const auto project

References Continue, anonymous_namespace{ExportUtils.cpp}::ExportHooks(), anonymous_namespace{ExportPCM.cpp}::format, and project.

Referenced by anonymous_namespace{FileMenus.cpp}::DoExport().

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

◆ RegisterExportHook()

void ExportUtils::RegisterExportHook ( ExportHook  hook,
Priority  priority = DEFAULT_EXPORT_HOOK_PRIORITY 
)
static

Definition at line 60 of file ExportUtils.cpp.

61{
62 auto& hooks = ExportHooks();
63 hooks.insert(
64 std::upper_bound(
65 hooks.begin(), hooks.end(), priority,
66 [](Priority priority, const ExportHookElement& element)
67 { return priority > element.priority; }),
68 { hook, priority });
69}
unsigned Priority
Definition: ExportUtils.h:43

References anonymous_namespace{ExportUtils.cpp}::ExportHooks().

Here is the call graph for this function:

Member Data Documentation

◆ DEFAULT_EXPORT_HOOK_PRIORITY

constexpr Priority ExportUtils::DEFAULT_EXPORT_HOOK_PRIORITY = 0
staticconstexpr

Definition at line 44 of file ExportUtils.h.


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