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 const wxChar *const varRatesNumbers []
 
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 229 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

#define ID_BROWSE   5000

Definition at line 576 of file ExportMP3.cpp.

Referenced by FindDialog::PopulateOrExchange().

#define ID_CBR   7003

Definition at line 230 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

#define ID_DLOAD   5001

Definition at line 577 of file ExportMP3.cpp.

Referenced by FindDialog::PopulateOrExchange().

#define ID_MONO   7005

Definition at line 232 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

#define ID_QUALITY   7004

Definition at line 231 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

#define ID_SET   7000

Definition at line 227 of file ExportMP3.cpp.

Referenced by ExportMP3Options::PopulateOrExchange().

#define ID_VBR   7001

Definition at line 228 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 715 of file ExportMP3.cpp.

typedef int lame_close_t(lame_global_flags *)

Definition at line 737 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 725 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 717 of file ExportMP3.cpp.

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

Definition at line 732 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 753 of file ExportMP3.cpp.

typedef int lame_init_params_t(lame_global_flags *)

Definition at line 714 of file ExportMP3.cpp.

typedef lame_global_flags* lame_init_t(void)

Definition at line 713 of file ExportMP3.cpp.

typedef void lame_mp3_tags_fid_t(lame_global_flags *, FILE *)

Definition at line 754 of file ExportMP3.cpp.

typedef int lame_set_brate_t(lame_global_flags *, int)

Definition at line 743 of file ExportMP3.cpp.

typedef int lame_set_bWriteVbrTag_t(lame_global_flags *, int)

Definition at line 752 of file ExportMP3.cpp.

typedef int lame_set_disable_reservoir_t(lame_global_flags *, int)

Definition at line 750 of file ExportMP3.cpp.

typedef int lame_set_error_protection_t(lame_global_flags *, int)

Definition at line 749 of file ExportMP3.cpp.

typedef int lame_set_in_samplerate_t(lame_global_flags *, int)

Definition at line 739 of file ExportMP3.cpp.

typedef int lame_set_mode_t(lame_global_flags *, MPEG_mode)

Definition at line 747 of file ExportMP3.cpp.

typedef int lame_set_num_channels_t(lame_global_flags *, int)

Definition at line 741 of file ExportMP3.cpp.

typedef int lame_set_out_samplerate_t(lame_global_flags *, int)

Definition at line 740 of file ExportMP3.cpp.

typedef int lame_set_padding_type_t(lame_global_flags *, Padding_type)

Definition at line 751 of file ExportMP3.cpp.

typedef int lame_set_preset_t(lame_global_flags *, int)

Definition at line 748 of file ExportMP3.cpp.

typedef int lame_set_quality_t(lame_global_flags *, int)

Definition at line 742 of file ExportMP3.cpp.

typedef int lame_set_VBR_min_bitrate_kbps_t(lame_global_flags *, int)

Definition at line 746 of file ExportMP3.cpp.

typedef int lame_set_VBR_q_t(lame_global_flags *, int)

Definition at line 745 of file ExportMP3.cpp.

typedef int lame_set_VBR_t(lame_global_flags *, vbr_mode)

Definition at line 744 of file ExportMP3.cpp.

Function Documentation

wxString GetMP3Version ( wxWindow *  parent,
bool  prompt 
)

Definition at line 2170 of file ExportMP3.cpp.

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

Referenced by LibraryPrefs::SetMP3VersionText().

2171 {
2172  MP3Exporter exporter;
2173  wxString versionString = _("MP3 export library not found");
2174 
2175 #ifndef DISABLE_DYNAMIC_LOADING_LAME
2176  if (prompt) {
2177  exporter.FindLibrary(parent);
2178  }
2179 
2180  if (exporter.LoadLibrary(parent, prompt ? MP3Exporter::Yes : MP3Exporter::No)) {
2181 #endif // DISABLE_DYNAMIC_LOADING_LAME
2182  versionString = exporter.GetLibraryVersion();
2183 #ifndef DISABLE_DYNAMIC_LOADING_LAME
2184  }
2185 #endif // DISABLE_DYNAMIC_LOADING_LAME
2186 
2187  return versionString;
2188 }
bool LoadLibrary(wxWindow *parent, AskUser askuser)
Definition: ExportMP3.cpp:981
wxString GetLibraryVersion()
Definition: ExportMP3.cpp:1198
_("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
bool FindLibrary(wxWindow *parent)
Definition: ExportMP3.cpp:946
Class used to export MP3 files.
Definition: ExportMP3.cpp:797
static void InitMP3_Statics ( )
static

Definition at line 234 of file ExportMP3.cpp.

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

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

235 {
236  for (size_t i=0; i < WXSIZEOF(fixRates); i++)
237  fixRates[i].name = wxString::Format(_("%d kbps"), fixRates[i].label);
238 
239  varRates[0].name = wxString::Format(
240  _("%s kbps (Best Quality)"), varRatesNumbers[0] );
241 
242  for (size_t i = 1; i < WXSIZEOF(varRates) - 1; i++)
243  varRates[i].name = wxString::Format( _("%s kbps"), varRatesNumbers[i] );
244 
245  varRates[9].name = wxString::Format(
246  _("%s kbps (Smaller files)"), varRatesNumbers[9] );
247 
248  varModes[0].name = _("Fast");
249  varModes[1].name = _("Standard");
250 
251  /* i18n-hint: Slightly humorous - as in use an insane precision with MP3.*/
252  setRates[0].name = _("Insane, 320 kbps");
253  setRates[1].name = _("Extreme, 220-260 kbps");
254  setRates[2].name = _("Standard, 170-210 kbps");
255  setRates[3].name = _("Medium, 145-185 kbps");
256 
257  for (size_t i=0; i < WXSIZEOF(sampRates); i++)
258  sampRates[i].name = wxString::Format( wxT("%d"), sampRates[i].label );
259 }
static CHOICES varRates[]
Definition: ExportMP3.cpp:171
static CHOICES sampRates[]
Definition: ExportMP3.cpp:214
static CHOICES varModes[]
Definition: ExportMP3.cpp:200
_("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
const wxChar * name
Definition: Distortion.cpp:94
static CHOICES setRates[]
Definition: ExportMP3.cpp:206
static CHOICES fixRates[]
Definition: ExportMP3.cpp:148
wxString name
Definition: ExportMP3.cpp:144
static const wxChar *const varRatesNumbers[]
Definition: ExportMP3.cpp:185
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 2161 of file ExportMP3.cpp.

Referenced by Exporter::Exporter().

2162 {
2163  return make_movable<ExportMP3>();
2164 }

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 214 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 206 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 200 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().

const wxChar* const varRatesNumbers[]
static
Initial value:
= {
wxT("220-260"),
wxT("200-250"),
wxT("170-210"),
wxT("155-195"),
wxT("145-185"),
wxT("110-150"),
wxT("95-135"),
wxT("80-120"),
wxT("65-105"),
wxT("45-85")
}

Definition at line 185 of file ExportMP3.cpp.

Referenced by InitMP3_Statics().