/// Creates the dialog and its contents. void LibraryPrefs::Populate() { //------------------------- Main section -------------------- // Now construct the GUI itself. // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); // ----------------------- End of main section -------------- // Set the MP3 Version string. SetMP3VersionText(); SetFFmpegVersionText(); }
void FileFormatPrefs::OnMP3FindButton(wxCommandEvent& evt) { wxString oldPath = gPrefs->Read("/MP3/MP3LibPath", ""); gPrefs->Write("/MP3/MP3LibPath", wxString("")); if (GetMP3Exporter()->FindLibrary(this)) SetMP3VersionText(); else { gPrefs->Write("/MP3/MP3LibPath", oldPath); } if(GetMP3Exporter()->GetConfigurationCaps() & MP3CONFIG_BITRATE) mMP3Bitrate->Enable(GetMP3Exporter()->ValidLibraryLoaded()); }
void FileFormatPrefs::OnMP3FindButton(wxCommandEvent& evt) { wxString oldPath = gPrefs->Read("/MP3/MP3LibPath", ""); gPrefs->Write("/MP3/MP3LibPath", wxString("")); //Create dummy exporter to extract info from. MP3Exporter * tmpExporter = new PlatformMP3Exporter(GetActiveProject(),0.0,0.0,true,44100,2,0,0); if (tmpExporter->FindLibrary(this)) SetMP3VersionText(); else { gPrefs->Write("/MP3/MP3LibPath", oldPath); } if(tmpExporter->GetConfigurationCaps() & MP3CONFIG_BITRATE) mMP3Bitrate->Enable(tmpExporter->ValidLibraryLoaded()); delete tmpExporter; }
FileFormatPrefs::FileFormatPrefs(wxWindow * parent): PrefsPanel(parent) { mAudacity = GetActiveProject(); /* Read existing config... */ wxString copyEdit = gPrefs->Read("/FileFormats/CopyOrEditUncompressedData", "edit"); int copyEditPos = 1; // Fall back to edit if it doesn't match anything else if (copyEdit.IsSameAs("copy", false)) copyEditPos = 0; long mp3Bitrate = gPrefs->Read("/FileFormats/MP3Bitrate", 128); wxString mp3BitrateString = wxString::Format("%ld", mp3Bitrate); mFormat = ReadExportFormatPref(); wxString lossyFormat = gPrefs->Read("/FileFormats/LossyExportFormat", "MP3"); long oggQuality = gPrefs->Read("/FileFormats/OggExportQuality", 50)/10; /* Begin layout code... */ topSizer = new wxBoxSizer( wxVERTICAL ); { wxStaticBoxSizer *copyOrEditSizer = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("When importing uncompressed audio files into Audacity")), wxVERTICAL ); mCopyOrEdit[0] = new wxRadioButton( this, -1, _("Make a copy of the file before editing (safer)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); copyOrEditSizer->Add( mCopyOrEdit[0], 0, wxGROW|wxLEFT | wxRIGHT, RADIO_BUTTON_BORDER ); mCopyOrEdit[1] = new wxRadioButton( this, -1, _("Read directly from the original file (faster)"), wxDefaultPosition, wxDefaultSize, 0 ); mCopyOrEdit[0]->SetValue(false); mCopyOrEdit[1]->SetValue(false); copyOrEditSizer->Add( mCopyOrEdit[1], 0, wxGROW|wxLEFT | wxRIGHT, RADIO_BUTTON_BORDER ); topSizer->Add( copyOrEditSizer, 0, wxGROW|wxALL, TOP_LEVEL_BORDER ); } { wxStaticBoxSizer *defFormatSizer = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("Uncompressed Export Format")), wxVERTICAL); int numSimpleFormats = sf_num_simple_formats(); int sel = numSimpleFormats; wxString *formatStrings = new wxString[numSimpleFormats+1]; for(int i=0; i<numSimpleFormats; i++) { formatStrings[i] = sf_simple_format(i)->name; if (mFormat == sf_simple_format(i)->format) sel = i; } formatStrings[numSimpleFormats] = _("Other..."); #ifdef __WXMAC__ // This is just to work around a wxChoice auto-sizing bug mDefaultExportFormat = new wxChoice( this, ID_FORMAT_CHOICE, wxDefaultPosition, wxSize(200,-1), numSimpleFormats+1, formatStrings); #else mDefaultExportFormat = new wxChoice( this, ID_FORMAT_CHOICE, wxDefaultPosition, wxDefaultSize, numSimpleFormats+1, formatStrings); #endif mDefaultExportFormat->SetSelection(sel); delete[] formatStrings; mFormatText = new wxStaticText(this, -1, "CAPITAL LETTERS"); SetFormatText(); defFormatSizer->Add(mDefaultExportFormat, 0, wxALL, GENERIC_CONTROL_BORDER); defFormatSizer->Add(mFormatText, 0, wxALL, GENERIC_CONTROL_BORDER); topSizer->Add( defFormatSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, TOP_LEVEL_BORDER ); } { wxStaticBoxSizer *vOGGFormatSizer = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("OGG Export Setup")), wxVERTICAL); wxBoxSizer *hOGGQualitySizer = new wxBoxSizer(wxHORIZONTAL); mOGGQuality = new wxSlider(this, -1, oggQuality, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_LABELS); hOGGQualitySizer->Add(new wxStaticText(this, -1, _("OGG Quality:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, GENERIC_CONTROL_BORDER); hOGGQualitySizer->Add(mOGGQuality, 1, wxALL|wxGROW, GENERIC_CONTROL_BORDER); vOGGFormatSizer->Add(hOGGQualitySizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0); mOGGEnabled = new wxCheckBox(this, -1, _("Use OGG instead of MP3")); mOGGEnabled->SetValue((lossyFormat == "OGG")); vOGGFormatSizer->Add(mOGGEnabled, 0, wxALL, GENERIC_CONTROL_BORDER); topSizer->Add( vOGGFormatSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, TOP_LEVEL_BORDER ); } { wxStaticBoxSizer *mp3SetupSizer = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("MP3 Export Setup")), wxVERTICAL); { wxFlexGridSizer *mp3InfoSizer = new wxFlexGridSizer(0, 3, 0, 0); mp3InfoSizer->AddGrowableCol(1); mp3InfoSizer->Add( new wxStaticText(this, -1, _("MP3 Library Version:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, GENERIC_CONTROL_BORDER); mMP3Version = new wxStaticText(this, -1, "CAPITAL LETTERS"); SetMP3VersionText(); mp3InfoSizer->Add(mMP3Version, 0, wxALIGN_CENTER_VERTICAL|wxALL, GENERIC_CONTROL_BORDER); mMP3FindButton = new wxButton(this, ID_MP3_FIND_BUTTON, _("Find Library")); mp3InfoSizer->Add(mMP3FindButton, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, GENERIC_CONTROL_BORDER); //Create dummy exporter to extract info from. MP3Exporter * tmpExporter = new PlatformMP3Exporter(GetActiveProject(),0.0,0.0,true,44100,2,0,0); if(tmpExporter->GetConfigurationCaps() & MP3CONFIG_BITRATE) { mp3InfoSizer->Add( new wxStaticText(this, -1, _("Bit Rate:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, GENERIC_CONTROL_BORDER); wxString bitrates[] = { "16", "24", "32", "40", "48", "56", "64", "80", "96", "112", "128", "160", "192", "224", "256", "320" }; int numBitrates = 16; #ifdef __WXMAC__ // This is just to work around a wxChoice auto-sizing bug mMP3Bitrate = new wxChoice( this, -1, wxDefaultPosition, wxSize(120,-1), numBitrates, bitrates); #else mMP3Bitrate = new wxChoice( this, -1, wxDefaultPosition, wxDefaultSize, numBitrates, bitrates); #endif mp3InfoSizer->Add(mMP3Bitrate, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, GENERIC_CONTROL_BORDER); mMP3Bitrate->SetStringSelection(mp3BitrateString); if(mMP3Bitrate->GetSelection() == -1) mMP3Bitrate->SetStringSelection("128"); if(!tmpExporter->ValidLibraryLoaded()) mMP3Bitrate->Enable(false); delete tmpExporter; } mp3SetupSizer->Add( mp3InfoSizer, 0, wxGROW|wxALL, 0); } topSizer->Add( mp3SetupSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, TOP_LEVEL_BORDER); } outSizer = new wxBoxSizer( wxVERTICAL ); outSizer->Add(topSizer, 0, wxGROW|wxALL, TOP_LEVEL_BORDER); SetAutoLayout(true); SetSizer(outSizer); outSizer->Fit(this); outSizer->SetSizeHints(this); /* set controls to match existing configuration... */ mCopyOrEdit[copyEditPos]->SetValue(true); }
/// Opens a file-finder dialog so that the user can /// tell us where the MP3 library is. void LibraryPrefs::OnMP3FindButton(wxCommandEvent & WXUNUSED(event)) { SetMP3VersionText(true); }
/// Opens a file-finder dialog so that the user can /// tell us where the MP3 library is. void LibraryPrefs::OnMP3FindButton(wxCommandEvent & e) { SetMP3VersionText(true); }