⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileformatprefs.cpp

📁 Audacity是一款用於錄音和編輯聲音的、免費的開放源碼軟體。它可以執行於Mac OS X、Microsoft Windows、GNU/Linux和其它作業系統
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/**********************************************************************  Audacity: A Digital Audio Editor  FileFormatPrefs.cpp  Joshua Haberman  Dominic Mazzoni**********************************************************************/#include <wx/defs.h>#include <wx/statbox.h>#include <wx/sizer.h>#include <wx/stattext.h>#include <wx/button.h>#include <wx/radiobut.h>#include <wx/checkbox.h>#include <wx/choice.h>#include <wx/intl.h>#include <wx/slider.h>#include "sndfile.h"#include "../export/ExportMP3.h"#include "../FileFormats.h"#include "../Prefs.h"#include "FileFormatPrefs.h"#define ID_MP3_FIND_BUTTON         7001#define ID_EXPORT_OPTIONS_BUTTON   7002#define ID_FORMAT_CHOICE           7003BEGIN_EVENT_TABLE(FileFormatPrefs, wxPanel)   EVT_BUTTON(ID_MP3_FIND_BUTTON, FileFormatPrefs::OnMP3FindButton)   EVT_CHOICE(ID_FORMAT_CHOICE,   FileFormatPrefs::OnFormatChoice)END_EVENT_TABLE()FileFormatPrefs::FileFormatPrefs(wxWindow * parent):PrefsPanel(parent){   mAudacity = GetActiveProject();   /* Read existing config... */   wxString copyEdit =       gPrefs->Read(wxT("/FileFormats/CopyOrEditUncompressedData"), wxT("edit"));   int copyEditPos = 1; // Fall back to edit if it doesn't match anything else   if (copyEdit.IsSameAs(wxT("copy"), false))      copyEditPos = 0;   long mp3Bitrate = gPrefs->Read(wxT("/FileFormats/MP3Bitrate"), 128);   wxString mp3BitrateString = wxString::Format(wxT("%ld"), mp3Bitrate);   mFormat = ReadExportFormatPref();   wxString lossyFormat = gPrefs->Read(wxT("/FileFormats/LossyExportFormat"), wxT("MP3"));   long oggQuality = gPrefs->Read(wxT("/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] = wxString(sf_simple_format(i)->name, wxConvISO8859_1);         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, wxT("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);      // dmazzoni: Ogg is now always in the File menu...      #if 0      mOGGEnabled = new wxCheckBox(this, -1, _("Use OGG instead of MP3"));      mOGGEnabled->SetValue((lossyFormat == wxT("OGG")));      vOGGFormatSizer->Add(mOGGEnabled, 0,                           wxALL, GENERIC_CONTROL_BORDER);      #endif            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, wxT("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);         if(GetMP3Exporter()->GetConfigurationCaps() & MP3CONFIG_BITRATE) {            mp3InfoSizer->Add(               new wxStaticText(this, -1, _("Bit Rate:")), 0,               wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, GENERIC_CONTROL_BORDER);            wxString bitrates[] = { wxT("16"), wxT("24"), wxT("32"), wxT("40"), wxT("48"), wxT("56"), wxT("64"),                                    wxT("80"), wxT("96"), wxT("112"), wxT("128"), wxT("160"),                                    wxT("192"), wxT("224"), wxT("256"), wxT("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(wxT("128"));            if(!GetMP3Exporter()->ValidLibraryLoaded())               mMP3Bitrate->Enable(false);         }         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);}void FileFormatPrefs::SetMP3VersionText(){   wxString versionString;   bool doMP3 = true;      doMP3 = GetMP3Exporter()->LoadLibrary();   if (doMP3)      doMP3 = GetMP3Exporter()->ValidLibraryLoaded();   if(doMP3)      versionString = GetMP3Exporter()->GetLibraryVersion();   else      versionString = _("MP3 exporting plugin not found");      mMP3Version->SetLabel(versionString);}void FileFormatPrefs::SetFormatText(){   wxString formatString;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -