Audacity 3.2.0
ExportFilePanel.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
5#include <wx/event.h>
6
7#include "Observer.h"
8#include "ExportPlugin.h"
9
10#include "wxPanelWrapper.h"
11
13class ShuttleGui;
14class AudacityProject;
15
16class Exporter;
18
19class wxWindow;
20class wxChoice;
21class wxTextCtrl;
22class wxRadioButton;
23
24wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API,
25 AUDACITY_EXPORT_FORMAT_CHANGE_EVENT, wxCommandEvent);
26
27class ExportFilePanel final : public wxPanelWrapper
28{
29 constexpr static auto MaxExportChannels = 32u;
30public:
31
33 bool monoStereoMode = false,
34 wxWindow* parent = nullptr,
35 wxWindowID winid = wxID_ANY);
36 ~ExportFilePanel() override;
37
39
50 void Init(const wxFileName& filename,
51 int sampleRate,
52 const wxString& format = wxEmptyString,
53 int channels = 0,
54 const ExportProcessor::Parameters& parameters = {},
55 const MixerOptions::Downmix* mixerSpec = nullptr);
56 void SetInitialFocus();
57
58 void SetCustomMappingEnabled(bool enabled);
59
60 wxString GetPath() const;
61 wxString GetFullName();
62
63 const ExportPlugin* GetPlugin() const;
64 int GetFormat() const;
65 int GetSampleRate() const;
66
68 std::optional<ExportProcessor::Parameters> GetParameters() const;
69 int GetChannels() const;
70
72
73private:
74
75 void ValidateAndFixExt();
76
77 void OnFullNameFocusKill(wxFocusEvent& event);
78 void OnFormatChange(wxCommandEvent& event);
79 void OnSampleRateChange(wxCommandEvent& event);
80
81 void OnFolderBrowse(wxCommandEvent& event);
82
83 void OnChannelsChange(wxCommandEvent& event);
84 void OnChannelsConfigure(wxCommandEvent& event);
85
86 void ChangeFormat(int index);
87
89
91 void UpdateMaxChannels(unsigned maxChannels);
92
94
95 bool mMonoStereoMode{false};
96
97 wxChoice* mFormat{};
98 wxChoice* mRates{};
99 wxWindow* mAudioOptionsPanel{};
100
101 wxTextCtrl* mFolder{};
102 wxTextCtrl* mFullName{};
103
104 wxRadioButton* mMono{};
105 wxRadioButton* mStereo{};
106 wxRadioButton* mCustomMapping{};
108
112
113 std::unique_ptr<ExportOptionsHandler> mOptionsHandler;
114 std::unique_ptr<MixerOptions::Downmix> mMixerSpec;
115
117
118 DECLARE_EVENT_TABLE()
119};
wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API, AUDACITY_EXPORT_FORMAT_CHANGE_EVENT, wxCommandEvent)
const auto project
#define S(N)
Definition: ToChars.cpp:64
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
const ExportPlugin * GetPlugin() const
wxChoice * mFormat
std::unique_ptr< MixerOptions::Downmix > mMixerSpec
void OnFullNameFocusKill(wxFocusEvent &event)
std::unique_ptr< ExportOptionsHandler > mOptionsHandler
void OnSampleRateChange(wxCommandEvent &event)
const ExportPlugin * mSelectedPlugin
int GetSampleRate() const
wxString GetPath() const
~ExportFilePanel() override
wxTextCtrl * mFolder
AudacityProject & mProject
void SetCustomMappingEnabled(bool enabled)
static constexpr auto MaxExportChannels
wxString GetFullName()
MixerOptions::Downmix * GetMixerSpec() const
void ChangeFormat(int index)
wxTextCtrl * mFullName
void OnFormatChange(wxCommandEvent &event)
wxRadioButton * mStereo
int GetFormat() const
wxWindow * mAudioOptionsPanel
int GetChannels() const
wxRadioButton * mCustomMapping
void OnFolderBrowse(wxCommandEvent &event)
wxRadioButton * mMono
void OnChannelsConfigure(wxCommandEvent &event)
std::optional< ExportProcessor::Parameters > GetParameters() const
void OnOptionsHandlerEvent(const ExportOptionsHandlerEvent &e)
wxChoice * mRates
Observer::Subscription mOptionsChangeSubscription
void UpdateMaxChannels(unsigned maxChannels)
ExportFilePanel(AudacityProject &project, bool monoStereoMode=false, wxWindow *parent=nullptr, wxWindowID winid=wxID_ANY)
void Init(const wxFileName &filename, int sampleRate, const wxString &format=wxEmptyString, int channels=0, const ExportProcessor::Parameters &parameters={}, const MixerOptions::Downmix *mixerSpec=nullptr)
Initializes panel with export settings provided as arguments. Call is required.
void PopulateOrExchange(ShuttleGui &S)
void OnChannelsChange(wxCommandEvent &event)
wxButton * mCustomizeChannels
std::vector< std::tuple< ExportOptionID, ExportValue > > Parameters
Definition: ExportPlugin.h:93
A matrix of booleans, one row per input channel, column per output.
Definition: MixerOptions.h:32
A move-only handle representing a connection to a Publisher.
Definition: Observer.h:70
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640