Audacity  2.2.2
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ExportPlugin Class Referenceabstract

#include <Export.h>

Inheritance diagram for ExportPlugin:
ExportCL ExportMP3 ExportPCM

Public Member Functions

 ExportPlugin ()
 
virtual ~ExportPlugin ()
 
int AddFormat ()
 Add a NEW entry to the list of formats this plug-in can export. More...
 
void SetFormat (const wxString &format, int index)
 
void SetDescription (const wxString &description, int index)
 
void AddExtension (const wxString &extension, int index)
 
void SetExtensions (const wxArrayString &extensions, int index)
 
void SetMask (const wxString &mask, int index)
 
void SetMaxChannels (unsigned maxchannels, unsigned index)
 
void SetCanMetaData (bool canmetadata, int index)
 
virtual int GetFormatCount ()
 
virtual wxString GetFormat (int index)
 
virtual wxString GetDescription (int index)
 
virtual wxString GetExtension (int index=0)
 Return the (first) file name extension for the sub-format. More...
 
virtual wxArrayString GetExtensions (int index=0)
 Return all the file name extensions used for the sub-format. More...
 
virtual wxString GetMask (int index)
 
virtual unsigned GetMaxChannels (int index)
 
virtual bool GetCanMetaData (int index)
 
virtual bool IsExtension (const wxString &ext, int index)
 
virtual bool DisplayOptions (wxWindow *parent, int format=0)
 
virtual wxWindow * OptionsCreate (wxWindow *parent, int format)=0
 
virtual bool CheckFileName (wxFileName &filename, int format=0)
 
virtual int SetNumExportChannels ()
 Exporter plug-ins may override this to specify the number of channels in exported file. -1 for unspecified. More...
 
virtual ProgressResult Export (AudacityProject *project, unsigned channels, const wxString &fName, bool selectedOnly, double t0, double t1, MixerSpec *mixerSpec=NULL, const Tags *metadata=NULL, int subformat=0)=0
 called to export audio into a file. More...
 

Protected Member Functions

std::unique_ptr< MixerCreateMixer (const WaveTrackConstArray &inputTracks, const TimeTrack *timeTrack, double startTime, double stopTime, unsigned numOutChannels, size_t outBufferSize, bool outInterleaved, double outRate, sampleFormat outFormat, bool highQuality=true, MixerSpec *mixerSpec=NULL)
 

Private Attributes

FormatInfoArray mFormatInfos
 

Detailed Description

Definition at line 57 of file Export.h.

Constructor & Destructor Documentation

ExportPlugin::ExportPlugin ( )

Definition at line 81 of file Export.cpp.

References mFormatInfos.

82 {
83  mFormatInfos.Empty();
84 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
ExportPlugin::~ExportPlugin ( )
virtual

Definition at line 86 of file Export.cpp.

References mFormatInfos.

87 {
88  mFormatInfos.Clear();
89 }
FormatInfoArray mFormatInfos
Definition: Export.h:131

Member Function Documentation

void ExportPlugin::AddExtension ( const wxString &  extension,
int  index 
)

Definition at line 129 of file Export.cpp.

References mFormatInfos.

Referenced by ExportCL::ExportCL(), ExportMP3::ExportMP3(), and ExportPCM::ExportPCM().

130 {
131  mFormatInfos[index].mExtensions.Add(extension);
132 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
int ExportPlugin::AddFormat ( )

Add a NEW entry to the list of formats this plug-in can export.

To configure the format use SetFormat, SetCanMetaData etc with the index of the format.

Returns
The number of formats currently set up. This is one more than the index of the newly added format.

Definition at line 103 of file Export.cpp.

References mFormatInfos.

Referenced by ExportCL::ExportCL(), ExportMP3::ExportMP3(), and ExportPCM::ExportPCM().

104 {
105  FormatInfo nf;
106  mFormatInfos.Add(nf);
107  return mFormatInfos.Count();
108 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
bool ExportPlugin::CheckFileName ( wxFileName &  filename,
int  format = 0 
)
virtual

Reimplemented in ExportMP3, and ExportPCM.

Definition at line 91 of file Export.cpp.

Referenced by ExportPCM::CheckFileName().

92 {
93  return true;
94 }
std::unique_ptr< Mixer > ExportPlugin::CreateMixer ( const WaveTrackConstArray inputTracks,
const TimeTrack timeTrack,
double  startTime,
double  stopTime,
unsigned  numOutChannels,
size_t  outBufferSize,
bool  outInterleaved,
double  outRate,
sampleFormat  outFormat,
bool  highQuality = true,
MixerSpec mixerSpec = NULL 
)
protected

Definition at line 241 of file Export.cpp.

Referenced by ExportCL::Export(), ExportPCM::Export(), and ExportMP3::Export().

247 {
248  // MB: the stop time should not be warped, this was a bug.
249  return std::make_unique<Mixer>(inputTracks,
250  // Throw, to stop exporting, if read fails:
251  true,
252  Mixer::WarpOptions(timeTrack),
253  startTime, stopTime,
254  numOutChannels, outBufferSize, outInterleaved,
255  outRate, outFormat,
256  highQuality, mixerSpec);
257 }
bool ExportPlugin::DisplayOptions ( wxWindow *  parent,
int  format = 0 
)
virtual

Definition at line 216 of file Export.cpp.

217 {
218  return false;
219 }
virtual ProgressResult ExportPlugin::Export ( AudacityProject project,
unsigned  channels,
const wxString &  fName,
bool  selectedOnly,
double  t0,
double  t1,
MixerSpec mixerSpec = NULL,
const Tags metadata = NULL,
int  subformat = 0 
)
pure virtual

called to export audio into a file.

Parameters
selectedOnlySet to true if all tracks should be mixed, to false if only the selected tracks should be mixed and exported.
metadataA Tags object that will over-ride the one in *project and be used to tag the file that is exported.
subformatControl which of the multiple formats this exporter is capable of exporting should be used. Used where a single export plug-in handles a number of related formats, but they have separate entries in the Format drop-down list box. For example, the options to export to "Other PCM", "AIFF 16 Bit" and "WAV 16 Bit" are all the same libsndfile export plug-in, but with subformat set to 0, 1, and 2 respectively.

Implemented in ExportMP3, ExportPCM, and ExportCL.

bool ExportPlugin::GetCanMetaData ( int  index)
virtual

Definition at line 197 of file Export.cpp.

References mFormatInfos.

198 {
199  return mFormatInfos[index].mCanMetaData;
200 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
wxString ExportPlugin::GetDescription ( int  index)
virtual

Definition at line 159 of file Export.cpp.

References mFormatInfos.

Referenced by GetMask().

160 {
161  return mFormatInfos[index].mDescription;
162 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
wxString ExportPlugin::GetExtension ( int  index = 0)
virtual

Return the (first) file name extension for the sub-format.

Parameters
indexThe sub-format for which the extension is wanted

Reimplemented in ExportPCM.

Definition at line 164 of file Export.cpp.

References mFormatInfos.

Referenced by ExportPCM::GetExtension(), and IsExtension().

165 {
166  return mFormatInfos[index].mExtensions[0];
167 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
wxArrayString ExportPlugin::GetExtensions ( int  index = 0)
virtual

Return all the file name extensions used for the sub-format.

Parameters
indexthe sub-format for which the extension is required

Definition at line 169 of file Export.cpp.

References mFormatInfos.

Referenced by GetMask(), and IsExtension().

170 {
171  return mFormatInfos[index].mExtensions;
172 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
wxString ExportPlugin::GetFormat ( int  index)
virtual

Definition at line 154 of file Export.cpp.

References mFormatInfos.

155 {
156  return mFormatInfos[index].mFormat;
157 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
int ExportPlugin::GetFormatCount ( )
virtual

Definition at line 110 of file Export.cpp.

References mFormatInfos.

Referenced by IsExtension().

111 {
112  return mFormatInfos.Count();
113 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
wxString ExportPlugin::GetMask ( int  index)
virtual

Definition at line 174 of file Export.cpp.

References exts, GetDescription(), GetExtensions(), and mFormatInfos.

175 {
176  if (!mFormatInfos[index].mMask.IsEmpty()) {
177  return mFormatInfos[index].mMask;
178  }
179 
180  wxString mask = GetDescription(index) + wxT("|");
181 
182  // Build the mask
183  // wxString ext = GetExtension(index);
184  wxArrayString exts = GetExtensions(index);
185  for (size_t i = 0; i < exts.GetCount(); i++) {
186  mask += wxT("*.") + exts[i] + wxT(";");
187  }
188 
189  return mask;
190 }
static const wxChar * exts[]
Definition: ImportFLAC.cpp:52
virtual wxString GetDescription(int index)
Definition: Export.cpp:159
virtual wxArrayString GetExtensions(int index=0)
Return all the file name extensions used for the sub-format.
Definition: Export.cpp:169
FormatInfoArray mFormatInfos
Definition: Export.h:131
unsigned ExportPlugin::GetMaxChannels ( int  index)
virtual

Definition at line 192 of file Export.cpp.

References mFormatInfos.

193 {
194  return mFormatInfos[index].mMaxChannels;
195 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
bool ExportPlugin::IsExtension ( const wxString &  ext,
int  index 
)
virtual

Definition at line 202 of file Export.cpp.

References GetExtension(), GetExtensions(), and GetFormatCount().

Referenced by ExportPCM::CheckFileName().

203 {
204  bool isext = false;
205  for (int i = index; i < GetFormatCount(); i = GetFormatCount())
206  {
207  wxString defext = GetExtension(i);
208  wxArrayString defexts = GetExtensions(i);
209  int indofext = defexts.Index(ext, false);
210  if (defext == wxT("") || (indofext != wxNOT_FOUND))
211  isext = true;
212  }
213  return isext;
214 }
virtual int GetFormatCount()
Definition: Export.cpp:110
virtual wxString GetExtension(int index=0)
Return the (first) file name extension for the sub-format.
Definition: Export.cpp:164
virtual wxArrayString GetExtensions(int index=0)
Return all the file name extensions used for the sub-format.
Definition: Export.cpp:169
wxWindow * ExportPlugin::OptionsCreate ( wxWindow *  parent,
int  format 
)
pure virtual

Implemented in ExportMP3, ExportPCM, and ExportCL.

Definition at line 221 of file Export.cpp.

References _(), ShuttleGuiBase::AddTitle(), eIsCreatingFromPrefs, ShuttleGuiBase::EndHorizontalLay(), ShuttleGui::Prop(), safenew, and ShuttleGuiBase::StartHorizontalLay().

Referenced by ExportPCM::OptionsCreate().

222 {
223  wxASSERT(parent); // To justify safenew
224  wxPanel *p = safenew wxPanelWrapper(parent, wxID_ANY);
226 
227  S.StartHorizontalLay(wxCENTER);
228  {
229  S.StartHorizontalLay(wxCENTER, 0);
230  {
231  S.Prop(1).AddTitle(_("No format specific options"));
232  }
233  S.EndHorizontalLay();
234  }
235  S.EndHorizontalLay();
236 
237  return p;
238 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:366
#define safenew
Definition: Audacity.h:223
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
void ExportPlugin::SetCanMetaData ( bool  canmetadata,
int  index 
)

Definition at line 149 of file Export.cpp.

References mFormatInfos.

Referenced by ExportCL::ExportCL(), ExportMP3::ExportMP3(), and ExportPCM::ExportPCM().

150 {
151  mFormatInfos[index].mCanMetaData = canmetadata;
152 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
void ExportPlugin::SetDescription ( const wxString &  description,
int  index 
)

Definition at line 124 of file Export.cpp.

References mFormatInfos.

Referenced by ExportCL::ExportCL(), ExportMP3::ExportMP3(), and ExportPCM::ExportPCM().

125 {
126  mFormatInfos[index].mDescription = description;
127 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
void ExportPlugin::SetExtensions ( const wxArrayString &  extensions,
int  index 
)

Definition at line 134 of file Export.cpp.

References mFormatInfos.

Referenced by ExportPCM::ExportPCM().

135 {
136  mFormatInfos[index].mExtensions = extensions;
137 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
void ExportPlugin::SetFormat ( const wxString &  format,
int  index 
)
Parameters
indexThe plugin to set the format for (range 0 to one less than the count of formats)

Definition at line 119 of file Export.cpp.

References format, and mFormatInfos.

Referenced by ExportCL::ExportCL(), ExportMP3::ExportMP3(), and ExportPCM::ExportPCM().

120 {
121  mFormatInfos[index].mFormat = format;
122 }
int format
Definition: ExportPCM.cpp:56
FormatInfoArray mFormatInfos
Definition: Export.h:131
void ExportPlugin::SetMask ( const wxString &  mask,
int  index 
)

Definition at line 139 of file Export.cpp.

References mFormatInfos.

140 {
141  mFormatInfos[index].mMask = mask;
142 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
void ExportPlugin::SetMaxChannels ( unsigned  maxchannels,
unsigned  index 
)

Definition at line 144 of file Export.cpp.

References mFormatInfos.

Referenced by ExportCL::ExportCL(), ExportMP3::ExportMP3(), and ExportPCM::ExportPCM().

145 {
146  mFormatInfos[index].mMaxChannels = maxchannels;
147 }
FormatInfoArray mFormatInfos
Definition: Export.h:131
virtual int ExportPlugin::SetNumExportChannels ( )
inlinevirtual

Exporter plug-ins may override this to specify the number of channels in exported file. -1 for unspecified.

Reimplemented in ExportMP3.

Definition at line 96 of file Export.h.

96 { return -1; }

Member Data Documentation

FormatInfoArray ExportPlugin::mFormatInfos
private

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