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 &, AudiocomTrace, bool)>
using Priority = unsigned

Static Public Member Functions

static TrackIterRange< const WaveTrackFindExportWaveTracks (const TrackList &tracks, bool selectedOnly)
static bool HasSelectedAudio (const AudacityProject &project)
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, AudiocomTrace trace, bool selectedOnly)

Static Public Attributes

static constexpr Priority DEFAULT_EXPORT_HOOK_PRIORITY = 0

Detailed Description

Definition at line 43 of file ExportUtils.h.

Member Typedef Documentation

◆ ExportHook

Definition at line 60 of file ExportUtils.h.

◆ Priority

using ExportUtils::Priority = unsigned

Definition at line 64 of file ExportUtils.h.

Member Enumeration Documentation

◆ ExportHookResult

enum class ExportUtils::ExportHookResult

Definition at line 53 of file ExportUtils.h.

54 {
55 Handled,
57 Cancel,
58 };
@ Handled
Save was handled by the extension.

Member Function Documentation

◆ FindExportWaveTracks()

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

Definition at line 23 of file ExportUtils.cpp.

25 bool anySolo =
26 !(tracks.Any<const WaveTrack>() + &WaveTrack::GetSolo).empty();
28 return tracks.Any<const WaveTrack>()
29 + (selectedOnly ? &Track::IsSelected : &Track::Any)
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(), HasSelectedAudio(), ExportFilePanel::Init(), and ExportAudioDialog::OnExport().

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

◆ HasSelectedAudio()

bool ExportUtils::HasSelectedAudio ( const AudacityProject project)

Definition at line 33 of file ExportUtils.cpp.

35 return !FindExportWaveTracks(TrackList::Get(project), true).empty() &&
const auto project
static TrackIterRange< const WaveTrack > FindExportWaveTracks(const TrackList &tracks, bool selectedOnly)
Definition: ExportUtils.cpp:23
bool isPoint() const
Definition: ViewInfo.h:40
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:216
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References FindExportWaveTracks(), ViewInfo::Get(), TrackList::Get(), NotifyingSelectedRegion::isPoint(), project, and ViewInfo::selectedRegion.

Referenced by ExportAudioDialog::ExportAudioDialog(), and anonymous_namespace{FileMenus.cpp}::OnExportSelectedAudio().

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

◆ ParametersFromEditor()

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

Definition at line 39 of file ExportUtils.cpp.

42 for(int i = 0, count = editor.GetOptionsCount(); i < count; ++i)
43 {
44 ExportOption option;
45 ExportValue value;
46 if(editor.GetOption(i, option) && editor.GetValue(, value))
47 parameters.emplace_back(, value);
48 }
49 return parameters;
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,
AudiocomTrace  trace,
bool  selectedOnly 

Definition at line 78 of file ExportUtils.cpp.

82 auto& hooks = ExportHooks();
83 for (auto& hook : hooks)
84 {
85 if (
86 hook.hook(project, format, trace, selectedOnly) !=
88 return;
89 }

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

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

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

◆ RegisterExportHook()

void ExportUtils::RegisterExportHook ( ExportHook  hook,

Definition at line 67 of file ExportUtils.cpp.

69 auto& hooks = ExportHooks();
70 hooks.insert(
71 std::upper_bound(
72 hooks.begin(), hooks.end(), priority,
73 [](Priority priority, const ExportHookElement& element)
74 { return priority > element.priority; }),
75 { hook, priority });
unsigned Priority
Definition: ExportUtils.h:64

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

Here is the call graph for this function:

Member Data Documentation


constexpr Priority ExportUtils::DEFAULT_EXPORT_HOOK_PRIORITY = 0

Definition at line 65 of file ExportUtils.h.

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