Audacity  2.2.2
BatchCommands.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  BatchCommands.h
6 
7  Dominic Mazzoni
8  James Crook
9 
10 **********************************************************************/
11 
12 #ifndef __AUDACITY_BATCH_COMMANDS_DIALOG__
13 #define __AUDACITY_BATCH_COMMANDS_DIALOG__
14 
15 #include <wx/defs.h>
16 #include <wx/string.h>
17 
18 #include "export/Export.h"
19 
20 class Effect;
21 
22 class BatchCommands final {
23  public:
24  // constructors and destructors
25  BatchCommands();
26  public:
27  bool ApplyChain(const wxString & filename = wxT(""));
28  bool ApplyCommand( const wxString & command, const wxString & params );
29  bool ApplyCommandInBatchMode(const wxString & command, const wxString &params);
30  bool ApplySpecialCommand(int iCommand, const wxString & command,const wxString & params);
31  bool ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params);
32  bool ReportAndSkip( const wxString & command, const wxString & params );
33  void AbortBatch();
34 
35  // Utility functions for the special commands.
36  wxString BuildCleanFileName(const wxString &fileName, const wxString &extension);
37  bool WriteMp3File( const wxString & Name, int bitrate );
38  double GetEndTime();
39  bool IsMono();
40 
41  // These commands do not depend on the command list.
42  static wxArrayString GetNames();
43 
44  // A pair of user-visible name, and internal string identifier
45  using CommandName = std::pair<wxString, wxString>;
46  using CommandNameVector = std::vector<CommandName>;
47  // Result is sorted by user-visible name
49 
50  static wxString GetCurrentParamsFor(const wxString & command);
51  static wxString PromptForParamsFor(const wxString & command, const wxString & params, wxWindow *parent);
52  static wxString PromptForPresetFor(const wxString & command, const wxString & params, wxWindow *parent);
53 
54  // These commands do depend on the command list.
55  void ResetChain();
56 
57  bool ReadChain(const wxString & chain);
58  bool WriteChain(const wxString & chain);
59  bool AddChain(const wxString & chain);
60  bool DeleteChain(const wxString & name);
61  bool RenameChain(const wxString & oldchain, const wxString & newchain);
62 
63  void AddToChain(const wxString & command, int before = -1);
64  void AddToChain(const wxString & command, const wxString & params, int before = -1);
65  void DeleteFromChain(int index);
66  wxString GetCommand(int index);
67  wxString GetParams(int index);
68  int GetCount();
69  wxString GetMessage(){ return mMessage;};
70  void AddToMessage(const wxString & msgIn ){ mMessage += msgIn;};
71 
72  void SetWavToMp3Chain();
73 
74  bool IsFixed(const wxString & name);
75 
76  void RestoreChain(const wxString & name);
77 
78  void Split(const wxString & str, wxString & command, wxString & param);
79  wxString Join(const wxString & command, const wxString & param);
80 
81  wxArrayString mCommandChain;
82  wxArrayString mParamsChain;
83  bool mAbort;
84  wxString mMessage;
85 
87  wxString mFileName;
88 };
89 
90 #endif
wxArrayString mParamsChain
Definition: BatchCommands.h:82
bool ReadChain(const wxString &chain)
static wxString PromptForParamsFor(const wxString &command, const wxString &params, wxWindow *parent)
wxString GetCommand(int index)
bool ApplyCommand(const wxString &command, const wxString &params)
void SetWavToMp3Chain()
void AddToMessage(const wxString &msgIn)
Definition: BatchCommands.h:70
Exporter mExporter
Definition: BatchCommands.h:86
void AddToChain(const wxString &command, int before=-1)
std::vector< CommandName > CommandNameVector
Definition: BatchCommands.h:46
double GetEndTime()
Base class for many of the effects in Audacity.
Definition: Effect.h:62
bool WriteChain(const wxString &chain)
wxString mFileName
Definition: BatchCommands.h:87
static wxString PromptForPresetFor(const wxString &command, const wxString &params, wxWindow *parent)
bool RenameChain(const wxString &oldchain, const wxString &newchain)
bool ApplyCommandInBatchMode(const wxString &command, const wxString &params)
wxString mMessage
Definition: BatchCommands.h:84
wxString Join(const wxString &command, const wxString &param)
wxString GetParams(int index)
bool ApplyEffectCommand(const PluginID &ID, const wxString &command, const wxString &params)
bool ApplySpecialCommand(int iCommand, const wxString &command, const wxString &params)
wxString BuildCleanFileName(const wxString &fileName, const wxString &extension)
static wxArrayString GetNames()
static CommandNameVector GetAllCommands()
Maintains the chain of commands used in batch processing. See also BatchCommandDialog and BatchProces...
Definition: BatchCommands.h:22
void Split(const wxString &str, wxString &command, wxString &param)
bool DeleteChain(const wxString &name)
bool ApplyChain(const wxString &filename=wxT(""))
wxArrayString mCommandChain
Definition: BatchCommands.h:81
bool ReportAndSkip(const wxString &command, const wxString &params)
const wxChar * name
Definition: Distortion.cpp:94
void DeleteFromChain(int index)
bool IsFixed(const wxString &name)
wxString GetMessage()
Definition: BatchCommands.h:69
void RestoreChain(const wxString &name)
bool WriteMp3File(const wxString &Name, int bitrate)
EffectDistortion::Params params
Definition: Distortion.cpp:95
static wxString GetCurrentParamsFor(const wxString &command)
bool AddChain(const wxString &chain)
std::pair< wxString, wxString > CommandName
Definition: BatchCommands.h:45