69#include <wx/checkbox.h>
73#include <wx/mimetype.h>
74#include <wx/radiobut.h>
75#include <wx/stattext.h>
76#include <wx/textctrl.h>
84#include "../ProjectSettings.h"
85#include "../ProjectWindow.h"
172 XO(
"220-260 kbps (Best Quality)"),
181 XO(
"45-85 kbps (Smaller files)"),
191 XO(
"Insane, 320 kbps"),
192 XO(
"Extreme, 220-260 kbps"),
193 XO(
"Standard, 170-210 kbps"),
194 XO(
"Medium, 145-185 kbps"),
221#define ID_QUALITY 7004
235 void OnSET(wxCommandEvent& evt);
236 void OnVBR(wxCommandEvent& evt);
237 void OnABR(wxCommandEvent& evt);
238 void OnCBR(wxCommandEvent& evt);
240 void OnMono(wxCommandEvent& evt);
261 DECLARE_EVENT_TABLE()
280 mAbrRate =
gPrefs->Read(
wxT(
"/FileFormats/MP3AbrRate"), 192);
281 mCbrRate =
gPrefs->Read(
wxT(
"/FileFormats/MP3CbrRate"), 192);
284 PopulateOrExchange(
S);
286 TransferDataToWindow();
295 wxT(
"/FileFormats/MP3RateModeChoice"),
297 {
wxT(
"SET"),
XXO(
"Preset") },
298 {
wxT(
"VBR"),
XXO(
"Variable") },
299 {
wxT(
"ABR"),
XXO(
"Average") },
300 {
wxT(
"CBR"),
XXO(
"Constant") },
308 wxT(
"/FileFormats/MP3RateMode"),
312 wxT(
"/FileFormats/MP3ChannelModeChoice"),
323 wxT(
"/FileFormats/MP3ChannelMode"),
331 gPrefs->Read(
wxT(
"/FileFormats/MP3ForceMono"), &mono, 0);
334 const std::vector< int > *codes =
nullptr;
338 S.StartVerticalLay();
340 S.StartHorizontalLay(wxCENTER);
342 S.StartMultiColumn(2, wxCENTER);
347 S.AddPrompt(
XXO(
"Bit Rate Mode:"));
353 S.StartHorizontalLay();
362 S.EndRadioButtonGroup();
364 S.EndHorizontalLay();
418 S.AddPrompt(
XXO(
"Channel Mode:"));
419 S.StartMultiColumn(2, wxEXPAND);
425 S.StartHorizontalLay();
434 S.EndRadioButtonGroup();
436 S.EndHorizontalLay();
448 S.EndHorizontalLay();
478 return (value >= 0 && value < nValues) ? value : defaultValue;
484 iter = std::find( start, finish, value );
485 return ( iter != finish ) ? value : defaultValue;
491 iter = std::find( start, finish, value );
492 return ( iter != finish ) ?
static_cast<int>( iter - start ) : defaultIndex;
543 int sel =
mRate->GetSelection();
545 if (
mSET->GetValue()) {
548 else if (
mVBR->GetValue()) {
551 else if (
mABR->GetValue()) {
562 mono =
mMono->GetValue();
566 gPrefs->Write(
wxT(
"/FileFormats/MP3ForceMono"), mono);
581#define ID_BROWSE 5000
588#ifndef DISABLE_DYNAMIC_LOADING_LAME
601 mTypes = std::move( types );
611 S.StartVerticalLay(
true);
614 XO(
"Audacity needs the file %s to create MP3s.")
618 S.StartHorizontalLay(wxALIGN_LEFT,
true);
622 S.EndHorizontalLay();
624 S.StartMultiColumn(2, wxEXPAND);
627 if (
mLibPath.GetFullPath().empty()) {
630 wxString::Format(
_(
"To find %s, click here -->"),
mName), 0);
638 XO(
"To get a free copy of LAME, click here -->"),
true);
640 S.Id(
ID_DLOAD).AddButton(
XXO(
"Download"), wxALIGN_RIGHT);
644 S.AddStandardButtons();
650 SetMinSize(GetSize());
661 auto question =
XO(
"Where is %s?").Format(
mName );
663 wxString path =
SelectFile(FileNames::Operation::_None,
669 wxFD_OPEN | wxRESIZE_BORDER,
691#ifndef DISABLE_DYNAMIC_LOADING_LAME
701 DECLARE_EVENT_TABLE()
704#ifndef DISABLE_DYNAMIC_LOADING_LAME
715#ifndef DISABLE_DYNAMIC_LOADING_LAME
726 unsigned char * mp3buf,
727 const int mp3buf_size);
733 unsigned char * mp3buf,
734 const int mp3buf_size);
738 unsigned char* mp3buf,
761#if defined(__WXMSW__)
795 BYTE btReserved[125];
813#ifndef DISABLE_DYNAMIC_LOADING_LAME
846 int EncodeBuffer(
float inbuffer[],
unsigned char outbuffer[]);
848 unsigned char outbuffer[]);
852 unsigned char outbuffer[]);
857 bool PutInfoTag(wxFFile & f, wxFileOffset off);
862#ifndef DISABLE_DYNAMIC_LOADING_LAME
868#if defined(__WXMSW__)
879#ifndef DISABLE_DYNAMIC_LOADING_LAME
904#if defined(__WXMSW__)
930#ifdef MP3_EXPORT_BUILT_IN
936#ifndef DISABLE_DYNAMIC_LOADING_LAME
942#ifndef DISABLE_DYNAMIC_LOADING_LAME
960#ifndef DISABLE_DYNAMIC_LOADING_LAME
982 if (fd.ShowModal() == wxID_CANCEL) {
988 if (!::wxFileExists(path)) {
1005#if defined(__WXMSW__)
1016 wxLogMessage(
wxT(
"Attempting to load LAME from previously defined path"));
1022 wxLogMessage(
wxT(
"Attempting to load LAME from system search paths"));
1029 wxLogMessage(
wxT(
"Attempting to load LAME from builtin path"));
1037 wxLogMessage(
wxT(
"(Maybe) ask user for library"));
1045#if defined(__WXMSW__)
1050 wxLogMessage(
wxT(
"Failed to locate LAME library"));
1055 wxLogMessage(
wxT(
"LAME library successfully loaded"));
1095 wxLogMessage(
wxT(
"Using internal LAME"));
1099#ifdef MP3_EXPORT_BUILT_IN
1128#if defined(__WXMSW__)
1147 wxLogMessage(
wxT(
"Loading LAME from %s"), libpath);
1149#ifndef DISABLE_DYNAMIC_LOADING_LAME
1150 if (!
lame_lib.Load(libpath, wxDL_LAZY)) {
1151 wxLogMessage(
wxT(
"load failed"));
1155 wxLogMessage(
wxT(
"Actual LAME path %s"),
1165 lame_lib.GetSymbol(
wxT(
"lame_encode_buffer_ieee_float"));
1167 lame_lib.GetSymbol(
wxT(
"lame_encode_buffer_interleaved_ieee_float"));
1174 lame_lib.GetSymbol(
wxT(
"lame_set_in_samplerate"));
1176 lame_lib.GetSymbol(
wxT(
"lame_set_out_samplerate"));
1188 lame_lib.GetSymbol(
wxT(
"lame_set_VBR_min_bitrate_kbps"));
1194 lame_lib.GetSymbol(
wxT(
"lame_set_error_protection"));
1196 lame_lib.GetSymbol(
wxT(
"lame_set_disable_reservoir"));
1202 lame_lib.GetSymbol(
wxT(
"lame_get_lametag_frame"));
1205#if defined(__WXMSW__)
1232 wxLogMessage(
wxT(
"Failed to find a required symbol in the LAME library."));
1233#if defined(__WXMSW__)
1239"You are linking to lame_enc.dll v%d.%d. This version is not compatible with Audacity %d.%d.%d.\nPlease download the latest version of 'LAME for Audacity'.")
1269#ifndef DISABLE_DYNAMIC_LOADING_LAME
1278#ifndef DISABLE_DYNAMIC_LOADING_LAME
1289#ifndef DISABLE_DYNAMIC_LOADING_LAME
1367 mode = JOINT_STEREO;
1408 unsigned char outbuffer[])
1429 unsigned char outbuffer[])
1449#if defined(DISABLE_DYNAMIC_LOADING_LAME)
1470 if ( !f.Seek(off, wxFromStart))
1475#if defined(__WXMSW__)
1495#if defined(__WXMSW__)
1500 wxRegKey
reg(
wxT(
"HKEY_LOCAL_MACHINE\\Software\\Lame for Audacity"));
1504 wxLogMessage(
wxT(
"LAME registry key exists."));
1505 reg.QueryValue(
wxT(
"InstallPath"), path);
1508 wxLogMessage(
wxT(
"LAME registry key does not exist."));
1511 wxLogMessage(
wxT(
"Library path is: ") + path);
1518 return wxT(
"lame_enc.dll");
1524 {
XO(
"Only lame_enc.dll"), {
wxT(
"lame_enc.dll") } },
1530#elif defined(__WXMAC__)
1537 path =
wxT(
"/Library/Application Support/audacity/libs");
1543 path =
wxT(
"/usr/local/lib/audacity");
1549 return wxT(
"/Library/Application Support/audacity/libs");
1554 if (
sizeof(
void*) == 8)
1555 return wxT(
"libmp3lame64bit.dylib");
1556 return wxT(
"libmp3lame.dylib");
1562 (
sizeof(
void*) == 8)
1564 XO(
"Only libmp3lame64bit.dylib"), {
wxT(
"libmp3lame64bit.dylib") }
1567 XO(
"Only libmp3lame.dylib"), {
wxT(
"libmp3lame.dylib") }
1585 return wxT(
"libmp3lame.so.0");
1591 {
XO(
"Only libmp3lame.so.0"), {
wxT(
"libmp3lame.so.0") } },
1592 {
XO(
"Primary shared object files"), {
wxT(
"so") },
true },
1593 {
XO(
"Extended libraries"), {
wxT(
"so*") },
true },
1603 wxPrintf(
wxT(
"\n\nLame_enc configuration options:\n"));
1604 wxPrintf(
wxT(
"==========================================================\n"));
1606 wxPrintf(
wxT(
"version =%d\n"),lame_get_version( gfp ) );
1607 wxPrintf(
wxT(
"Layer =3\n"));
1608 wxPrintf(
wxT(
"mode ="));
1609 switch ( lame_get_mode( gfp ) )
1611 case STEREO: wxPrintf(
wxT(
"Stereo\n" ));
break;
1612 case JOINT_STEREO: wxPrintf(
wxT(
"Joint-Stereo\n" ));
break;
1613 case DUAL_CHANNEL: wxPrintf(
wxT(
"Forced Stereo\n" ));
break;
1614 case MONO: wxPrintf(
wxT(
"Mono\n" ));
break;
1616 default: wxPrintf(
wxT(
"Error (unknown)\n" ));
break;
1619 wxPrintf(
wxT(
"Input sample rate =%.1f kHz\n"), lame_get_in_samplerate( gfp ) /1000.0 );
1620 wxPrintf(
wxT(
"Output sample rate =%.1f kHz\n"), lame_get_out_samplerate( gfp ) /1000.0 );
1622 wxPrintf(
wxT(
"bitrate =%d kbps\n"), lame_get_brate( gfp ) );
1623 wxPrintf(
wxT(
"Quality Setting =%d\n"), lame_get_quality( gfp ) );
1625 wxPrintf(
wxT(
"Low pass frequency =%d\n"), lame_get_lowpassfreq( gfp ) );
1626 wxPrintf(
wxT(
"Low pass width =%d\n"), lame_get_lowpasswidth( gfp ) );
1628 wxPrintf(
wxT(
"High pass frequency =%d\n"), lame_get_highpassfreq( gfp ) );
1629 wxPrintf(
wxT(
"High pass width =%d\n"), lame_get_highpasswidth( gfp ) );
1631 wxPrintf(
wxT(
"No short blocks =%d\n"), lame_get_no_short_blocks( gfp ) );
1632 wxPrintf(
wxT(
"Force short blocks =%d\n"), lame_get_force_short_blocks( gfp ) );
1634 wxPrintf(
wxT(
"de-emphasis =%d\n"), lame_get_emphasis( gfp ) );
1635 wxPrintf(
wxT(
"private flag =%d\n"), lame_get_extension( gfp ) );
1637 wxPrintf(
wxT(
"copyright flag =%d\n"), lame_get_copyright( gfp ) );
1638 wxPrintf(
wxT(
"original flag =%d\n"), lame_get_original( gfp ) );
1639 wxPrintf(
wxT(
"CRC =%s\n"), lame_get_error_protection( gfp ) ?
wxT(
"on") :
wxT(
"off") );
1640 wxPrintf(
wxT(
"Fast mode =%s\n"), ( lame_get_quality( gfp ) )?
wxT(
"enabled") :
wxT(
"disabled") );
1641 wxPrintf(
wxT(
"Force mid/side stereo =%s\n"), ( lame_get_force_ms( gfp ) )?
wxT(
"enabled"):
wxT(
"disabled") );
1642 wxPrintf(
wxT(
"Padding Type =%d\n"), (
int) lame_get_padding_type( gfp ) );
1643 wxPrintf(
wxT(
"Disable Reservoir =%d\n"), lame_get_disable_reservoir( gfp ) );
1644 wxPrintf(
wxT(
"Allow diff-short =%d\n"), lame_get_allow_diff_short( gfp ) );
1645 wxPrintf(
wxT(
"Interchannel masking =%d\n"), lame_get_interChRatio( gfp ) );
1646 wxPrintf(
wxT(
"Strict ISO Encoding =%s\n"), ( lame_get_strict_ISO( gfp ) ) ?
wxT(
"Yes"):
wxT(
"No"));
1647 wxPrintf(
wxT(
"Scale =%5.2f\n"), lame_get_scale( gfp ) );
1649 wxPrintf(
wxT(
"VBR =%s, VBR_q =%d, VBR method ="),
1650 ( lame_get_VBR( gfp ) !=vbr_off ) ?
wxT(
"enabled"):
wxT(
"disabled"),
1651 lame_get_VBR_q( gfp ) );
1653 switch ( lame_get_VBR( gfp ) )
1655 case vbr_off: wxPrintf(
wxT(
"vbr_off\n" ));
break;
1656 case vbr_mt : wxPrintf(
wxT(
"vbr_mt \n" ));
break;
1657 case vbr_rh : wxPrintf(
wxT(
"vbr_rh \n" ));
break;
1658 case vbr_mtrh: wxPrintf(
wxT(
"vbr_mtrh \n" ));
break;
1660 wxPrintf(
wxT(
"vbr_abr (average bitrate %d kbps)\n"), lame_get_VBR_mean_bitrate_kbps( gfp ) );
1663 wxPrintf(
wxT(
"error, unknown VBR setting\n"));
1667 wxPrintf(
wxT(
"Vbr Min bitrate =%d kbps\n"), lame_get_VBR_min_bitrate_kbps( gfp ) );
1668 wxPrintf(
wxT(
"Vbr Max bitrate =%d kbps\n"), lame_get_VBR_max_bitrate_kbps( gfp ) );
1670 wxPrintf(
wxT(
"Write VBR Header =%s\n"), ( lame_get_bWriteVbrTag( gfp ) ) ?
wxT(
"Yes"):
wxT(
"No"));
1671 wxPrintf(
wxT(
"VBR Hard min =%d\n"), lame_get_VBR_hard_min( gfp ) );
1673 wxPrintf(
wxT(
"ATH Only =%d\n"), lame_get_ATHonly( gfp ) );
1674 wxPrintf(
wxT(
"ATH short =%d\n"), lame_get_ATHshort( gfp ) );
1675 wxPrintf(
wxT(
"ATH no =%d\n"), lame_get_noATH( gfp ) );
1676 wxPrintf(
wxT(
"ATH type =%d\n"), lame_get_ATHtype( gfp ) );
1677 wxPrintf(
wxT(
"ATH lower =%f\n"), lame_get_ATHlower( gfp ) );
1678 wxPrintf(
wxT(
"ATH aa =%d\n"), lame_get_athaa_type( gfp ) );
1679 wxPrintf(
wxT(
"ATH aa loudapprox =%d\n"), lame_get_athaa_loudapprox( gfp ) );
1680 wxPrintf(
wxT(
"ATH aa sensitivity =%f\n"), lame_get_athaa_sensitivity( gfp ) );
1682 wxPrintf(
wxT(
"Experimental nspsytune =%d\n"), lame_get_exp_nspsytune( gfp ) );
1683 wxPrintf(
wxT(
"Experimental X =%d\n"), lame_get_experimentalX( gfp ) );
1684 wxPrintf(
wxT(
"Experimental Y =%d\n"), lame_get_experimentalY( gfp ) );
1685 wxPrintf(
wxT(
"Experimental Z =%d\n"), lame_get_experimentalZ( gfp ) );
1704 std::unique_ptr<BasicUI::ProgressDialog> &pDialog,
1711 const Tags *metadata = NULL,
1712 int subformat = 0)
override;
1716 int AskResample(
int bitrate,
int rate,
int lowrate,
int highrate);
1719 void AddFrame(
struct id3_tag *tp,
const wxString & n,
const wxString & v,
const char *
name);
1737#ifndef DISABLE_DYNAMIC_LOADING_LAME
1742 gPrefs->Write(
wxT(
"/MP3/MP3LibPath"), wxString(
wxT(
"")));
1755 gPrefs->Read(
wxT(
"/FileFormats/MP3ForceMono"), &mono, 0);
1757 return (mono)? 1 : -1;
1762 std::unique_ptr<BasicUI::ProgressDialog> &pDialog,
1769 const Tags *metadata,
1770 int WXUNUSED(subformat))
1773#ifndef DISABLE_DYNAMIC_LOADING_LAME
1779#ifdef DISABLE_DYNAMIC_LOADING_LAME
1782 gPrefs->Write(
wxT(
"/MP3/MP3LibPath"), wxString(
wxT(
"")));
1790 gPrefs->Write(
wxT(
"/MP3/MP3LibPath"), wxString(
wxT(
"")));
1798 gPrefs->Write(
wxT(
"/MP3/MP3LibPath"), wxString(
wxT(
"")));
1806 int highrate = 48000;
1813 gPrefs->Read(
wxT(
"/FileFormats/MP3Bitrate"), &brate, 128);
1817 gPrefs->Read(
wxT(
"/FileFormats/MP3ForceMono"), &forceMono, 0);
1837 if (bitrate > 160) {
1840 else if (bitrate < 32 || bitrate == 144) {
1850 if (bitrate > 160) {
1853 else if (bitrate < 32 || bitrate == 144) {
1860 (rate < lowrate) || (rate > highrate)) {
1864 auto const bestRateIt = std::lower_bound(
sampRates.begin(),
1866 rate = (bestRateIt ==
sampRates.end()) ? highrate : *bestRateIt;
1868 if (rate < lowrate) {
1871 else if (rate > highrate) {
1878 (rate < lowrate) || (rate > highrate)) {
1879 rate =
AskResample(bitrate, rate, lowrate, highrate);
1900 if (((
int)inSamples) < 0) {
1906 if (metadata == NULL)
1910 wxFFile outFile(fName.GetFullPath(),
wxT(
"w+b"));
1911 if (!outFile.IsOpened()) {
1918 unsigned long id3len =
AddTags(project, id3buffer, &endOfFile, metadata);
1919 if (id3len && !endOfFile) {
1920 if (id3len > outFile.Write(id3buffer.get(), id3len)) {
1927 wxFileOffset pos = outFile.Tell();
1932 if (bufferSize <= 0) {
1944 channels, inSamples,
true,
1949 title = (selectionOnly ?
1950 XO(
"Exporting selected audio with %s preset") :
1951 XO(
"Exporting the audio with %s preset"))
1955 title = (selectionOnly ?
1956 XO(
"Exporting selected audio with VBR quality %s") :
1957 XO(
"Exporting the audio with VBR quality %s"))
1961 title = (selectionOnly ?
1962 XO(
"Exporting selected audio at %d Kbps") :
1963 XO(
"Exporting the audio at %d Kbps"))
1968 auto &progress = *pDialog;
1971 auto blockLen = mixer->Process();
1975 float *mixed = (
float *)mixer->GetBuffer();
1977 if ((
int)blockLen < inSamples) {
1995 auto msg =
XO(
"Error %ld returned from MP3 encoder")
2002 if (bytes > (
int)outFile.Write(buffer.get(), bytes)) {
2009 updateResult = progress.Poll(mixer->MixGetCurrentTime() - t0, t1 - t0);
2014 updateResult == ProgressResult::Stopped ) {
2024 if (bytes > (
int)outFile.Write(buffer.get(), bytes)) {
2032 if (id3len > 0 && endOfFile) {
2033 if (bytes > (
int)outFile.Write(id3buffer.get(), id3len)) {
2055 return updateResult;
2072 S.StartVerticalLay();
2075 S.StartStatic(
XO(
"Resample"));
2077 S.StartHorizontalLay(wxALIGN_CENTER,
false);
2082"The project sample rate (%d) is not supported by the MP3\nfile format. ")
2085"The project sample rate (%d) and bit rate (%d kbps) combination is not\nsupported by the MP3 file format. ")
2086 .
Format( rate, bitrate ))
2087 +
XO(
"You may resample to one of the rates below.")
2090 S.EndHorizontalLay();
2092 S.StartHorizontalLay(wxALIGN_CENTER,
false);
2094 choice =
S.AddChoice(
XXO(
"Sample Rates"),
2097 for (
size_t ii = 0, nn =
sampRates.size(); ii < nn; ++ii) {
2098 int label = sampRates[ii];
2099 if (label >= lowrate && label <= highrate) {
2100 choices.push_back( Verbatim(
"%d" ).Format( label ) );
2107 std::max( 0, selected )
2110 S.EndHorizontalLay();
2114 S.AddStandardButtons();
2120 d.SetMinSize(d.GetSize());
2123 if (d.ShowModal() == wxID_CANCEL) {
2127 return wxAtoi(choice->GetStringSelection());
2131struct id3_tag_deleter {
2132 void operator () (id3_tag *p)
const {
if (p) id3_tag_delete(p); }
2134using id3_tag_holder = std::unique_ptr<id3_tag, id3_tag_deleter>;
2141 id3_tag_holder tp { id3_tag_new() };
2143 for (
const auto &pair : tags->
GetRange()) {
2144 const auto &n = pair.first;
2145 const auto &v = pair.second;
2146 const char *
name =
"TXXX";
2149 name = ID3_FRAME_TITLE;
2152 name = ID3_FRAME_ARTIST;
2155 name = ID3_FRAME_ALBUM;
2157 else if (n.CmpNoCase(
TAG_YEAR) == 0) {
2160 AddFrame(tp.get(), n, v,
"TYER");
2161 name = ID3_FRAME_YEAR;
2164 name = ID3_FRAME_GENRE;
2167 name = ID3_FRAME_COMMENT;
2170 name = ID3_FRAME_TRACK;
2173 AddFrame(tp.get(), n, v,
name);
2176 tp->options &= (~ID3_TAG_OPTION_COMPRESSION);
2181 #ifdef ID3_TAG_HAS_TAG_OPTION_ID3V2_3
2182 tp->options |= ID3_TAG_OPTION_ID3V2_3;
2189 len = id3_tag_render(tp.get(), 0);
2191 len = id3_tag_render(tp.get(), (id3_byte_t *)buffer.get());
2200void ExportMP3::AddFrame(
struct id3_tag *tp,
const wxString & n,
const wxString & v,
const char *
name)
2202 struct id3_frame *frame = id3_frame_new(
name);
2204 if (!n.IsAscii() || !v.IsAscii()) {
2205 id3_field_settextencoding(id3_frame_field(frame, 0), ID3_FIELD_TEXTENCODING_UTF_16);
2208 id3_field_settextencoding(id3_frame_field(frame, 0), ID3_FIELD_TEXTENCODING_ISO_8859_1);
2212 id3_utf8_ucs4duplicate((id3_utf8_t *) (
const char *) v.mb_str(wxConvUTF8)) };
2214 if (strcmp(
name, ID3_FRAME_COMMENT) == 0) {
2220 struct id3_frame *frame2 = id3_frame_new(
name);
2221 id3_field_setfullstring(id3_frame_field(frame2, 3), ucs4.get());
2222 id3_field *f2 = id3_frame_field(frame2, 1);
2223 memset(f2->immediate.value, 0,
sizeof(f2->immediate.value));
2224 id3_tag_attachframe(tp, frame2);
2226 id3_field_setfullstring(id3_frame_field(frame, 3), ucs4.get());
2228 else if (strcmp(
name,
"TXXX") == 0) {
2229 id3_field_setstring(id3_frame_field(frame, 2), ucs4.get());
2231 ucs4.reset(id3_utf8_ucs4duplicate((id3_utf8_t *) (
const char *) n.mb_str(wxConvUTF8)));
2233 id3_field_setstring(id3_frame_field(frame, 1), ucs4.get());
2236 auto addr = ucs4.get();
2237 id3_field_setstrings(id3_frame_field(frame, 1), 1, &addr);
2240 id3_tag_attachframe(tp, frame);
2245 []{
return std::make_unique< ExportMP3 >(); }
2255 auto versionString =
XO(
"MP3 export library not found");
2257#ifndef DISABLE_DYNAMIC_LOADING_LAME
2265#ifdef MP3_EXPORT_BUILT_IN
2266 versionString.Join(
XO(
"(Built-in)"),
" " );
2269#ifndef DISABLE_DYNAMIC_LOADING_LAME
2273 return versionString;
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
const TranslatableString name
void ShowExportErrorDialog(wxString ErrorCode, TranslatableString message, const TranslatableString &caption, bool allowReporting)
void ShowDiskFullExportErrorDialog(const wxFileNameWrapper &fileName)
int lame_set_VBR_t(lame_global_flags *, vbr_mode)
int lame_set_bWriteVbrTag_t(lame_global_flags *, int)
static const std::vector< int > sampRates
int CDECL lame_encode_buffer_interleaved_ieee_float_t(lame_t gfp, const float pcm[], const int nsamples, unsigned char *mp3buf, const int mp3buf_size)
static const TranslatableStrings varRateNames
static const TranslatableStrings fixRateNames
const char * get_lame_version_t(void)
int lame_set_VBR_q_t(lame_global_flags *, int)
static const std::vector< int > fixRateValues
int lame_set_in_samplerate_t(lame_global_flags *, int)
int lame_close_t(lame_global_flags *)
TranslatableString n_kbps(int n)
EnumSetting< MP3RateMode > MP3RateModeSetting
TranslatableString GetMP3Version(wxWindow *parent, bool prompt)
static Exporter::RegisteredExportPlugin sRegisteredPlugin
void lame_mp3_tags_fid_t(lame_global_flags *, FILE *)
int lame_set_VBR_min_bitrate_kbps_t(lame_global_flags *, int)
int CDECL lame_encode_buffer_ieee_float_t(lame_t gfp, const float pcm_l[], const float pcm_r[], const int nsamples, unsigned char *mp3buf, const int mp3buf_size)
int lame_set_error_protection_t(lame_global_flags *, int)
static EnumSetting< MP3ChannelMode > MP3ChannelModeSetting
unsigned long beWriteInfoTag_t(lame_global_flags *, char *)
static const TranslatableStrings setRateNames
int lame_set_out_samplerate_t(lame_global_flags *, int)
int lame_set_quality_t(lame_global_flags *, int)
void beVersion_t(be_version *)
int lame_set_preset_t(lame_global_flags *, int)
size_t lame_get_lametag_frame_t(const lame_global_flags *, unsigned char *buffer, size_t size)
static const TranslatableStrings setRateNamesShort
int lame_set_disable_reservoir_t(lame_global_flags *, int)
lame_global_flags * lame_init_t(void)
int lame_encode_flush_t(lame_global_flags *gf, unsigned char *mp3buf, int size)
int lame_set_num_channels_t(lame_global_flags *, int)
int lame_set_mode_t(lame_global_flags *, MPEG_mode)
int lame_set_brate_t(lame_global_flags *, int)
int lame_init_params_t(lame_global_flags *)
XXO("&Cut/Copy/Paste Toolbar")
std::unique_ptr< Character[], freer > MallocString
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
an object holding per-project preferred sample rate
EffectReverbSettings preset
FilePath SelectFile(FileNames::Operation op, const TranslatableString &message, const FilePath &default_path, const FilePath &default_filename, const FileExtension &default_extension, const FileTypes &fileTypes, int flags, wxWindow *parent)
declares abstract base class Track, TrackList, and iterators over TrackList
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
std::vector< TranslatableString > TranslatableStrings
void reinit(Integral count, bool initialize=false)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Adapts EnumSettingBase to a particular enumeration type.
int SetNumExportChannels() override
Exporter plug-ins may override this to specify the number of channels in exported file....
unsigned long AddTags(AudacityProject *project, ArrayOf< char > &buffer, bool *endOfFile, const Tags *tags)
bool CheckFileName(wxFileName &filename, int format) override
int AskResample(int bitrate, int rate, int lowrate, int highrate)
ProgressResult Export(AudacityProject *project, std::unique_ptr< BasicUI::ProgressDialog > &pDialog, unsigned channels, const wxFileNameWrapper &fName, bool selectedOnly, double t0, double t1, MixerSpec *mixerSpec=NULL, const Tags *metadata=NULL, int subformat=0) override
called to export audio into a file.
void OptionsCreate(ShuttleGui &S, int format) override
ExportMP3Options(wxWindow *parent, int format)
virtual ~ExportMP3Options()
void OnVBR(wxCommandEvent &evt)
bool TransferDataToWindow() override
bool TransferDataFromWindow() override
void OnABR(wxCommandEvent &evt)
void OnSET(wxCommandEvent &evt)
void PopulateOrExchange(ShuttleGui &S)
void OnCBR(wxCommandEvent &evt)
void OnQuality(wxCommandEvent &evt)
void LoadNames(const TranslatableStrings &choices)
void OnMono(wxCommandEvent &evt)
void AddExtension(const FileExtension &extension, int index)
int AddFormat()
Add a NEW entry to the list of formats this plug-in can export.
static void InitProgress(std::unique_ptr< BasicUI::ProgressDialog > &pDialog, const TranslatableString &title, const TranslatableString &message)
void SetFormat(const wxString &format, int index)
std::unique_ptr< Mixer > CreateMixer(const TrackList &tracks, bool selectionOnly, double startTime, double stopTime, unsigned numOutChannels, size_t outBufferSize, bool outInterleaved, double outRate, sampleFormat outFormat, MixerSpec *mixerSpec)
void SetDescription(const TranslatableString &description, int index)
void SetCanMetaData(bool canmetadata, int index)
void SetMaxChannels(unsigned maxchannels, unsigned index)
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
std::vector< FileType > FileTypes
FILES_API const FileType AllFiles
FILES_API const FileType DynamicLibraries
void OnBrowse(wxCommandEvent &WXUNUSED(event))
FindDialog(wxWindow *parent, wxString path, wxString name, FileNames::FileTypes types)
FileNames::FileTypes mTypes
void PopulateOrExchange(ShuttleGui &S)
void OnDownload(wxCommandEvent &WXUNUSED(event))
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Specialization of Setting for int.
Class used to export MP3 files.
lame_set_VBR_q_t * lame_set_VBR_q
static const int mOutBufferSize
lame_set_in_samplerate_t * lame_set_in_samplerate
wxString GetLibraryVersion()
bool InitLibraryExternal(wxString libpath)
int EncodeBufferMono(float inbuffer[], unsigned char outbuffer[])
lame_set_disable_reservoir_t * lame_set_disable_reservoir
int EncodeRemainderMono(float inbuffer[], int nSamples, unsigned char outbuffer[])
bool PutInfoTag(wxFFile &f, wxFileOffset off)
lame_mp3_tags_fid_t * lame_mp3_tags_fid
unsigned char mInfoTagBuf[2880]
void SetBitrate(int rate)
bool ValidLibraryLoaded()
lame_set_brate_t * lame_set_brate
lame_encode_buffer_ieee_float_t * lame_encode_buffer_ieee_float
lame_encode_buffer_interleaved_ieee_float_t * lame_encode_buffer_interleaved_ieee_float
lame_get_lametag_frame_t * lame_get_lametag_frame
lame_set_num_channels_t * lame_set_num_channels
int EncodeBuffer(float inbuffer[], unsigned char outbuffer[])
get_lame_version_t * get_lame_version
static const int mSamplesPerChunk
bool FindLibrary(wxWindow *parent)
bool LoadLibrary(wxWindow *parent, AskUser askuser)
wxString GetLibraryName()
lame_set_VBR_t * lame_set_VBR
FileNames::FileTypes GetLibraryTypes()
void SetChannel(int mode)
wxDynamicLibrary lame_lib
bool InitLibrary(wxString libpath)
wxString GetLibraryPath()
lame_close_t * lame_close
int FinishStream(unsigned char outbuffer[])
lame_set_quality_t * lame_set_quality
beWriteInfoTag_t * beWriteInfoTag
lame_encode_flush_t * lame_encode_flush
int InitializeStream(unsigned channels, int sampleRate)
lame_set_error_protection_t * lame_set_error_protection
lame_set_VBR_min_bitrate_kbps_t * lame_set_VBR_min_bitrate_kbps
bool InitLibraryInternal()
int EncodeRemainder(float inbuffer[], int nSamples, unsigned char outbuffer[])
lame_set_out_samplerate_t * lame_set_out_samplerate
lame_set_mode_t * lame_set_mode
TranslatableString mBladeVersion
lame_set_bWriteVbrTag_t * lame_set_bWriteVbrTag
lame_init_params_t * lame_init_params
lame_set_preset_t * lame_set_preset
A matrix of booleans, one row per input channel, column per output.
static ProjectRate & Get(AudacityProject &project)
static ProjectWindow * Find(AudacityProject *pProject)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
static TrackList & Get(AudacityProject &project)
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
struct with zillion of control parameters that control lame export (MP3 Conversion DLL).
void SetName(const TranslatableString &title)
FILES_API FilePath PathFromAddr(void *addr)
BuiltinCommandsModule::Registration< CompareAudioCommand > reg
int ValidateIndex(const std::vector< int > &values, int value, int defaultIndex)
int ValidateValue(const std::vector< int > &values, int value, int defaultValue)