Audacity  2.2.2
Public Member Functions | Public Attributes | List of all members
ExportCommand Class Reference

Command for exporting audio. More...

#include <ImportExportCommands.h>

Inheritance diagram for ExportCommand:
AudacityCommand CommandDefinitionInterface IdentInterface ParamsInterface

Public Member Functions

IdentInterfaceSymbol GetSymbol () override
 
wxString GetDescription () override
 
bool DefineParams (ShuttleParams &S) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
bool Apply (const CommandContext &context) override
 
wxString ManualPage () override
 
- Public Member Functions inherited from AudacityCommand
 AudacityCommand ()
 
virtual ~AudacityCommand ()
 
wxString GetPath () override
 
IdentInterfaceSymbol GetVendor () override
 
wxString GetVersion () override
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
virtual bool Apply ()
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
virtual void SetHostUI (EffectUIHostInterface *WXUNUSED(host))
 
bool PopulateUI (wxWindow *parent)
 
wxDialog * CreateUI (wxWindow *parent, AudacityCommand *client)
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
bool DoAudacityCommand (wxWindow *parent, const CommandContext &context, bool shouldPrompt=true)
 
int MessageBox (const wxString &message, long style=DefaultMessageBoxStyle, const wxString &titleStr=wxString{})
 
virtual bool Init ()
 
virtual bool PromptUser (wxWindow *parent)
 
virtual bool CheckWhetherSkipAudacityCommand ()
 
virtual void End ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
- Public Member Functions inherited from CommandDefinitionInterface
virtual ~CommandDefinitionInterface ()
 
- Public Member Functions inherited from IdentInterface
virtual ~IdentInterface ()
 
const wxString & GetTranslatedName ()
 
- Public Member Functions inherited from ParamsInterface
virtual ~ParamsInterface ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 

Public Attributes

wxString mFileName
 
int mnChannels
 

Additional Inherited Members

- Public Types inherited from AudacityCommand
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Protected Attributes inherited from AudacityCommand
ProgressDialogmProgress
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 

Detailed Description

Command for exporting audio.

Definition at line 46 of file ImportExportCommands.h.

Member Function Documentation

bool ExportCommand::Apply ( const CommandContext context)
override

Definition at line 65 of file ImportExportCommands.cpp.

References CommandContext::Error(), CommandContext::GetProject(), mFileName, mnChannels, AudacityProject::mViewInfo, Exporter::Process(), ViewInfo::selectedRegion, CommandContext::Status(), SelectedRegion::t0(), and SelectedRegion::t1().

66 {
67  double t0, t1;
68  t0 = context.GetProject()->mViewInfo.selectedRegion.t0();
69  t1 = context.GetProject()->mViewInfo.selectedRegion.t1();
70 
71  // Find the extension and check it's valid
72  int splitAt = mFileName.Find(wxUniChar('.'), true);
73  if (splitAt < 0)
74  {
75  context.Error(wxT("Export filename must have an extension!"));
76  return false;
77  }
78  wxString extension = mFileName.Mid(splitAt+1).MakeUpper();
79 
80  Exporter exporter;
81 
82  bool exportSuccess = exporter.Process(context.GetProject(),
83  std::max(0, mnChannels),
84  extension, mFileName,
85  true, t0, t1);
86 
87  if (exportSuccess)
88  {
89  context.Status(wxString::Format(wxT("Exported to %s format: %s"),
90  extension, mFileName));
91  return true;
92  }
93 
94  context.Error(wxString::Format(wxT("Could not export to %s format!"), extension));
95  return false;
96 }
AudacityProject * GetProject() const
double t0() const
SelectedRegion selectedRegion
Definition: ViewInfo.h:160
bool Process(AudacityProject *project, bool selectedOnly, double t0, double t1)
Definition: Export.cpp:338
virtual void Status(const wxString &message, bool bFlush=false) const
double t1() const
ViewInfo mViewInfo
Definition: Project.h:558
virtual void Error(const wxString &message) const
bool ExportCommand::DefineParams ( ShuttleParams S)
override

Definition at line 47 of file ImportExportCommands.cpp.

References ShuttleParams::Define(), mFileName, and mnChannels.

47  {
48  S.Define( mFileName, wxT("Filename"), "exported.wav" );
49  S.Define( mnChannels, wxT("NumChannels"), 1 );
50  return true;
51 }
virtual void Define(bool &var, const wxChar *key, const bool vdefault, const bool vmin=false, const bool vmax=false, const bool vscl=false)
Definition: Shuttle.cpp:339
wxString ExportCommand::GetDescription ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 51 of file ImportExportCommands.h.

References _().

51 {return _("Exports to a file.");};
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
IdentInterfaceSymbol ExportCommand::GetSymbol ( )
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 50 of file ImportExportCommands.h.

References EXPORT_PLUGIN_SYMBOL.

50 {return EXPORT_PLUGIN_SYMBOL;};
#define EXPORT_PLUGIN_SYMBOL
wxString ExportCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 57 of file ImportExportCommands.h.

57 {return wxT("Export");};
void ExportCommand::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 53 of file ImportExportCommands.cpp.

References _(), ShuttleGui::AddSpace(), ShuttleGuiBase::EndMultiColumn(), mFileName, mnChannels, ShuttleGuiBase::StartMultiColumn(), and ShuttleGuiBase::TieTextBox().

54 {
55  S.AddSpace(0, 5);
56 
57  S.StartMultiColumn(2, wxALIGN_CENTER);
58  {
59  S.TieTextBox(_("File Name:"),mFileName);
60  S.TieTextBox(_("Number of Channels:"),mnChannels);
61  }
62  S.EndMultiColumn();
63 }
void EndMultiColumn()
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxSizerItem * AddSpace(int width, int height)
wxTextCtrl * TieTextBox(const wxString &Prompt, WrappedType &WrappedRef, const int nChars)

Member Data Documentation

wxString ExportCommand::mFileName

Definition at line 57 of file ImportExportCommands.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().

int ExportCommand::mnChannels

Definition at line 60 of file ImportExportCommands.h.

Referenced by Apply(), DefineParams(), and PopulateOrExchange().


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