Audacity  2.2.2
Classes | Macros | Typedefs | Functions | Variables
ExportMP3.cpp File Reference
#include "../Audacity.h"
#include "ExportMP3.h"
#include <wx/app.h>
#include <wx/defs.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
#include <wx/dynlib.h>
#include <wx/ffile.h>
#include <wx/filedlg.h>
#include <wx/intl.h>
#include <wx/log.h>
#include <wx/mimetype.h>
#include <wx/radiobut.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/timer.h>
#include <wx/utils.h>
#include <wx/window.h>
#include "../FileNames.h"
#include "../float_cast.h"
#include "../Internat.h"
#include "../Mix.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "../Tags.h"
#include "../Track.h"
#include "../widgets/HelpSystem.h"
#include "../widgets/LinkingHtmlWindow.h"
#include "../widgets/ErrorDialog.h"
#include "Export.h"
#include <lame/lame.h>

Go to the source code of this file.

Classes

struct  CHOICES
 
class  ExportMP3Options
 
class  FindDialog
 
class  MP3Exporter
 Class used to export MP3 files. More...
 
class  ExportMP3
 

Macros

#define MODE_SET   0
 
#define MODE_VBR   1
 
#define MODE_ABR   2
 
#define MODE_CBR   3
 
#define CHANNEL_JOINT   0
 
#define CHANNEL_STEREO   1
 
#define CHANNEL_MONO   2
 
#define QUALITY_0   0
 
#define QUALITY_1   1
 
#define QUALITY_2   2
 
#define QUALITY_3   3
 
#define QUALITY_4   4
 
#define QUALITY_5   5
 
#define QUALITY_6   6
 
#define QUALITY_7   7
 
#define QUALITY_8   8
 
#define QUALITY_9   9
 
#define ROUTINE_FAST   0
 
#define ROUTINE_STANDARD   1
 
#define PRESET_INSANE   0
 
#define PRESET_EXTREME   1
 
#define PRESET_STANDARD   2
 
#define PRESET_MEDIUM   3
 
#define ID_SET   7000
 
#define ID_VBR   7001
 
#define ID_ABR   7002
 
#define ID_CBR   7003
 
#define ID_QUALITY   7004
 
#define ID_MONO   7005
 
#define ID_BROWSE   5000
 
#define ID_DLOAD   5001
 

Typedefs

typedef lame_global_flagslame_init_t (void)
 
typedef int lame_init_params_t (lame_global_flags *)
 
typedef const char * get_lame_version_t (void)
 
typedef int lame_encode_buffer_t (lame_global_flags *gf, const short int buffer_l[], const short int buffer_r[], const int nsamples, unsigned char *mp3buf, const int mp3buf_size)
 
typedef int lame_encode_buffer_interleaved_t (lame_global_flags *gf, short int pcm[], int num_samples, unsigned char *mp3buf, int mp3buf_size)
 
typedef int lame_encode_flush_t (lame_global_flags *gf, unsigned char *mp3buf, int size)
 
typedef int lame_close_t (lame_global_flags *)
 
typedef int lame_set_in_samplerate_t (lame_global_flags *, int)
 
typedef int lame_set_out_samplerate_t (lame_global_flags *, int)
 
typedef int lame_set_num_channels_t (lame_global_flags *, int)
 
typedef int lame_set_quality_t (lame_global_flags *, int)
 
typedef int lame_set_brate_t (lame_global_flags *, int)
 
typedef int lame_set_VBR_t (lame_global_flags *, vbr_mode)
 
typedef int lame_set_VBR_q_t (lame_global_flags *, int)
 
typedef int lame_set_VBR_min_bitrate_kbps_t (lame_global_flags *, int)
 
typedef int lame_set_mode_t (lame_global_flags *, MPEG_mode)
 
typedef int lame_set_preset_t (lame_global_flags *, int)
 
typedef int lame_set_error_protection_t (lame_global_flags *, int)
 
typedef int lame_set_disable_reservoir_t (lame_global_flags *, int)
 
typedef int lame_set_padding_type_t (lame_global_flags *, Padding_type)
 
typedef int lame_set_bWriteVbrTag_t (lame_global_flags *, int)
 
typedef size_t lame_get_lametag_frame_t (const lame_global_flags *, unsigned char *buffer, size_t size)
 
typedef void lame_mp3_tags_fid_t (lame_global_flags *, FILE *)
 

Functions

static void InitMP3_Statics ()
 
movable_ptr< ExportPluginNew_ExportMP3 ()
 
wxString GetMP3Version (wxWindow *parent, bool prompt)
 

Variables

static CHOICES fixRates []
 
static CHOICES varRates []
 
static CHOICES varModes []
 
static CHOICES setRates []
 
static CHOICES sampRates []
 

Macro Definition Documentation

#define CHANNEL_JOINT   0
#define CHANNEL_MONO   2

Definition at line 115 of file ExportMP3.cpp.

Referenced by ExportMP3::Export(), and MP3Exporter::InitializeStream().

#define CHANNEL_STEREO   1
#define ID_ABR   7002

Definition at line 214 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

#define ID_BROWSE   5000

Definition at line 581 of file ExportMP3.cpp.

Referenced by FindDialog::PopulateOrExchange().

#define ID_CBR   7003

Definition at line 215 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

#define ID_DLOAD   5001

Definition at line 582 of file ExportMP3.cpp.

Referenced by FindDialog::PopulateOrExchange().

#define ID_MONO   7005

Definition at line 217 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

#define ID_QUALITY   7004

Definition at line 216 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

#define ID_SET   7000

Definition at line 212 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

#define ID_VBR   7001

Definition at line 213 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

#define MODE_ABR   2
#define MODE_CBR   3
#define MODE_SET   0
#define MODE_VBR   1
#define PRESET_EXTREME   1

Definition at line 132 of file ExportMP3.cpp.

Referenced by MP3Exporter::InitializeStream().

#define PRESET_INSANE   0

Definition at line 131 of file ExportMP3.cpp.

Referenced by MP3Exporter::InitializeStream().

#define PRESET_MEDIUM   3

Definition at line 134 of file ExportMP3.cpp.

#define PRESET_STANDARD   2
#define QUALITY_0   0

Definition at line 117 of file ExportMP3.cpp.

#define QUALITY_1   1

Definition at line 118 of file ExportMP3.cpp.

#define QUALITY_2   2
#define QUALITY_3   3

Definition at line 120 of file ExportMP3.cpp.

#define QUALITY_4   4

Definition at line 121 of file ExportMP3.cpp.

#define QUALITY_5   5

Definition at line 122 of file ExportMP3.cpp.

#define QUALITY_6   6

Definition at line 123 of file ExportMP3.cpp.

#define QUALITY_7   7

Definition at line 124 of file ExportMP3.cpp.

#define QUALITY_8   8

Definition at line 125 of file ExportMP3.cpp.

#define QUALITY_9   9

Definition at line 126 of file ExportMP3.cpp.

#define ROUTINE_FAST   0
#define ROUTINE_STANDARD   1

Definition at line 129 of file ExportMP3.cpp.

Referenced by MP3Exporter::InitializeStream().

Typedef Documentation

typedef const char* get_lame_version_t(void)

Definition at line 720 of file ExportMP3.cpp.

typedef int lame_close_t(lame_global_flags *)

Definition at line 742 of file ExportMP3.cpp.

typedef int lame_encode_buffer_interleaved_t(lame_global_flags *gf, short int pcm[], int num_samples,unsigned char *mp3buf, int mp3buf_size)

Definition at line 730 of file ExportMP3.cpp.

typedef int lame_encode_buffer_t(lame_global_flags *gf, const short int buffer_l[], const short int buffer_r[], const int nsamples, unsigned char *mp3buf, const int mp3buf_size)

Definition at line 722 of file ExportMP3.cpp.

typedef int lame_encode_flush_t(lame_global_flags *gf, unsigned char *mp3buf, int size)

Definition at line 737 of file ExportMP3.cpp.

typedef size_t lame_get_lametag_frame_t(const lame_global_flags *, unsigned char *buffer, size_t size)

Definition at line 758 of file ExportMP3.cpp.

typedef int lame_init_params_t(lame_global_flags *)

Definition at line 719 of file ExportMP3.cpp.

typedef lame_global_flags* lame_init_t(void)

Definition at line 718 of file ExportMP3.cpp.

typedef void lame_mp3_tags_fid_t(lame_global_flags *, FILE *)

Definition at line 759 of file ExportMP3.cpp.

typedef int lame_set_brate_t(lame_global_flags *, int)

Definition at line 748 of file ExportMP3.cpp.

typedef int lame_set_bWriteVbrTag_t(lame_global_flags *, int)

Definition at line 757 of file ExportMP3.cpp.

typedef int lame_set_disable_reservoir_t(lame_global_flags *, int)

Definition at line 755 of file ExportMP3.cpp.

typedef int lame_set_error_protection_t(lame_global_flags *, int)

Definition at line 754 of file ExportMP3.cpp.

typedef int lame_set_in_samplerate_t(lame_global_flags *, int)

Definition at line 744 of file ExportMP3.cpp.

typedef int lame_set_mode_t(lame_global_flags *, MPEG_mode)

Definition at line 752 of file ExportMP3.cpp.

typedef int lame_set_num_channels_t(lame_global_flags *, int)

Definition at line 746 of file ExportMP3.cpp.

typedef int lame_set_out_samplerate_t(lame_global_flags *, int)

Definition at line 745 of file ExportMP3.cpp.

typedef int lame_set_padding_type_t(lame_global_flags *, Padding_type)

Definition at line 756 of file ExportMP3.cpp.

typedef int lame_set_preset_t(lame_global_flags *, int)

Definition at line 753 of file ExportMP3.cpp.

typedef int lame_set_quality_t(lame_global_flags *, int)

Definition at line 747 of file ExportMP3.cpp.

typedef int lame_set_VBR_min_bitrate_kbps_t(lame_global_flags *, int)

Definition at line 751 of file ExportMP3.cpp.

typedef int lame_set_VBR_q_t(lame_global_flags *, int)

Definition at line 750 of file ExportMP3.cpp.

typedef int lame_set_VBR_t(lame_global_flags *, vbr_mode)

Definition at line 749 of file ExportMP3.cpp.

Function Documentation

wxString GetMP3Version ( wxWindow *  parent,
bool  prompt 
)

Definition at line 2135 of file ExportMP3.cpp.

References _(), MP3Exporter::FindLibrary(), MP3Exporter::GetLibraryVersion(), MP3Exporter::LoadLibrary(), MP3Exporter::No, and MP3Exporter::Yes.

Referenced by LibraryPrefs::SetMP3VersionText().

2136 {
2137  MP3Exporter exporter;
2138  wxString versionString = _("MP3 export library not found");
2139 
2140 #ifndef DISABLE_DYNAMIC_LOADING_LAME
2141  if (prompt) {
2142  exporter.FindLibrary(parent);
2143  }
2144 
2145  if (exporter.LoadLibrary(parent, prompt ? MP3Exporter::Yes : MP3Exporter::No)) {
2146 #endif // DISABLE_DYNAMIC_LOADING_LAME
2147  versionString = exporter.GetLibraryVersion();
2148 #ifndef DISABLE_DYNAMIC_LOADING_LAME
2149  }
2150 #endif // DISABLE_DYNAMIC_LOADING_LAME
2151 
2152  return versionString;
2153 }
bool LoadLibrary(wxWindow *parent, AskUser askuser)
Definition: ExportMP3.cpp:986
wxString GetLibraryVersion()
Definition: ExportMP3.cpp:1203
_("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 &)
bool FindLibrary(wxWindow *parent)
Definition: ExportMP3.cpp:951
Class used to export MP3 files.
Definition: ExportMP3.cpp:802
static void InitMP3_Statics ( )
static

Definition at line 219 of file ExportMP3.cpp.

References _(), CHOICES::label, name, and CHOICES::name.

Referenced by ExportMP3::ExportMP3(), and ExportMP3Options::ExportMP3Options().

220 {
221  for (size_t i=0; i < WXSIZEOF(fixRates); i++)
222  {
223  fixRates[i].name = wxT("");
224  fixRates[i].name << fixRates[i].label << wxT(" ") << _("kbps");
225  }
226  for (size_t i=0; i < WXSIZEOF(varRates); i++)
227  {
228  varRates[i].name = wxT("");
229  varRates[i].name << i << wxT(", ");
230  }
231  varRates[0].name << wxT("220-260");
232  varRates[1].name << wxT("200-250");
233  varRates[2].name << wxT("170-210");
234  varRates[3].name << wxT("155-195");
235  varRates[4].name << wxT("145-185");
236  varRates[5].name << wxT("110-150");
237  varRates[6].name << wxT("95-135");
238  varRates[7].name << wxT("80-120");
239  varRates[8].name << wxT("65-105");
240  varRates[9].name << wxT("45-85");
241  for (size_t i=0; i < WXSIZEOF(varRates); i++)
242  varRates[i].name << wxT(" ") << _("kbps");
243  varRates[0].name << wxT(" ") << _("(Best Quality)");
244  varRates[9].name << wxT(" ") << _("(Smaller files)");
245 
246  varModes[0].name = _("Fast");
247  varModes[1].name = _("Standard");
248 
249  for (size_t i=0; i < WXSIZEOF(setRates); i++)
250  setRates[i].name = wxT("");
251  /* i18n-hint: Slightly humorous - as in use an insane precision with MP3.*/
252  setRates[0].name << _("Insane" ) << wxT(", ") << 320;
253  setRates[1].name << _("Extreme" ) << wxT(", ") << 220 << wxT("-") << 260;
254  setRates[2].name << _("Standard") << wxT(", ") << 170 << wxT("-") << 210;
255  setRates[3].name << _("Medium" ) << wxT(", ") << 145 << wxT("-") << 185;
256  for (size_t i=0; i < WXSIZEOF(setRates); i++)
257  setRates[i].name << wxT(" ") << _("kbps");
258 
259  for (size_t i=0; i < WXSIZEOF(sampRates); i++)
260  {
261  sampRates[i].name = wxT("");
262  sampRates[i].name << sampRates[i].label;
263  }
264 }
static CHOICES varRates[]
Definition: ExportMP3.cpp:171
static CHOICES sampRates[]
Definition: ExportMP3.cpp:199
static CHOICES varModes[]
Definition: ExportMP3.cpp:185
_("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 &)
const wxChar * name
Definition: Distortion.cpp:94
static CHOICES setRates[]
Definition: ExportMP3.cpp:191
static CHOICES fixRates[]
Definition: ExportMP3.cpp:148
wxString name
Definition: ExportMP3.cpp:144
int label
Definition: ExportMP3.cpp:145
movable_ptr<ExportPlugin> New_ExportMP3 ( )

Factory method New_ExportMP3() which creates a NEW ExportMP3 object and returns a pointer to it. The rest of the class declaration is in ExportMP3.cpp

Definition at line 2126 of file ExportMP3.cpp.

Referenced by Exporter::Exporter().

2127 {
2128  return make_movable<ExportMP3>();
2129 }

Variable Documentation

CHOICES fixRates[]
static
Initial value:
=
{
{wxT(""), 320},
{wxT(""), 256},
{wxT(""), 224},
{wxT(""), 192},
{wxT(""), 160},
{wxT(""), 144},
{wxT(""), 128},
{wxT(""), 112},
{wxT(""), 96},
{wxT(""), 80},
{wxT(""), 64},
{wxT(""), 56},
{wxT(""), 48},
{wxT(""), 40},
{wxT(""), 32},
{wxT(""), 24},
{wxT(""), 16},
{wxT(""), 8}
}

Definition at line 148 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

CHOICES sampRates[]
static
Initial value:
=
{
{wxT(""), 8000 },
{wxT(""), 11025 },
{wxT(""), 12000 },
{wxT(""), 16000 },
{wxT(""), 22050 },
{wxT(""), 24000 },
{wxT(""), 32000 },
{wxT(""), 44100 },
{wxT(""), 48000 }
}

Definition at line 199 of file ExportMP3.cpp.

CHOICES setRates[]
static
Initial value:
=
{
{wxT(""), PRESET_INSANE },
{wxT(""), PRESET_EXTREME },
{wxT(""), PRESET_STANDARD},
{wxT(""), PRESET_MEDIUM }
}
#define PRESET_MEDIUM
Definition: ExportMP3.cpp:134
#define PRESET_INSANE
Definition: ExportMP3.cpp:131
#define PRESET_EXTREME
Definition: ExportMP3.cpp:132
#define PRESET_STANDARD
Definition: ExportMP3.cpp:133

Definition at line 191 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

CHOICES varModes[]
static
Initial value:
=
{
{wxT(""), ROUTINE_FAST },
{wxT(""), ROUTINE_STANDARD}
}
#define ROUTINE_FAST
Definition: ExportMP3.cpp:128
#define ROUTINE_STANDARD
Definition: ExportMP3.cpp:129

Definition at line 185 of file ExportMP3.cpp.

CHOICES varRates[]
static
Initial value:
=
{
{wxT(""), QUALITY_0},
{wxT(""), QUALITY_1},
{wxT(""), QUALITY_2},
{wxT(""), QUALITY_3},
{wxT(""), QUALITY_4},
{wxT(""), QUALITY_5},
{wxT(""), QUALITY_6},
{wxT(""), QUALITY_7},
{wxT(""), QUALITY_8},
{wxT(""), QUALITY_9}
}
#define QUALITY_2
Definition: ExportMP3.cpp:119
#define QUALITY_8
Definition: ExportMP3.cpp:125
#define QUALITY_7
Definition: ExportMP3.cpp:124
#define QUALITY_0
Definition: ExportMP3.cpp:117
#define QUALITY_3
Definition: ExportMP3.cpp:120
#define QUALITY_9
Definition: ExportMP3.cpp:126
#define QUALITY_5
Definition: ExportMP3.cpp:122
#define QUALITY_4
Definition: ExportMP3.cpp:121
#define QUALITY_1
Definition: ExportMP3.cpp:118
#define QUALITY_6
Definition: ExportMP3.cpp:123

Definition at line 171 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().