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

📄 fileformatprefs.cpp

📁 Audacity是一款用於錄音和編輯聲音的、免費的開放源碼軟體。它可以執行於Mac OS X、Microsoft Windows、GNU/Linux和其它作業系統
💻 CPP
📖 第 1 页 / 共 2 页
字号:
   formatString = sf_header_name(mFormat & SF_FORMAT_TYPEMASK);   formatString += wxT(", ") + sf_encoding_name(mFormat & SF_FORMAT_SUBMASK);   mFormatText->SetLabel(formatString);}void FileFormatPrefs::OnFormatChoice(wxCommandEvent& evt){   int sel = mDefaultExportFormat->GetSelection();   int numSimpleFormats = sf_num_simple_formats();   if (sel == numSimpleFormats) {      Other();   }   else {      mFormat = sf_simple_format(sel)->format;   }   SetFormatText();}         void FileFormatPrefs::OnMP3FindButton(wxCommandEvent& evt){   wxString oldPath = gPrefs->Read(wxT("/MP3/MP3LibPath"), wxT(""));    gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT("")));      if (GetMP3Exporter()->FindLibrary(this))      SetMP3VersionText();   else {      gPrefs->Write(wxT("/MP3/MP3LibPath"), oldPath);   }      if(GetMP3Exporter()->GetConfigurationCaps() & MP3CONFIG_BITRATE)      mMP3Bitrate->Enable(GetMP3Exporter()->ValidLibraryLoaded());}bool FileFormatPrefs::Apply(){   int originalExportFormat = ReadExportFormatPref();   WriteExportFormatPref(mFormat);      gPrefs->SetPath(wxT("/FileFormats"));   wxString copyEditString[] = { wxT("copy"), wxT("edit") };   int pos = mCopyOrEdit[0]->GetValue() ? 0 : 1;   wxString copyOrEdit = copyEditString[pos];   gPrefs->Write(wxT("CopyOrEditUncompressedData"), copyOrEdit);   if(GetMP3Exporter()->GetConfigurationCaps() & MP3CONFIG_BITRATE) {      long bitrate;      mMP3Bitrate->GetStringSelection().ToLong(&bitrate);      gPrefs->Write(wxT("MP3Bitrate"), bitrate);   }   gPrefs->SetPath(wxT("/"));         if (originalExportFormat != mFormat)      gMenusDirty++;   wxString lossyFormat = wxT("MP3");      #if 0 // dmazzoni   if(mOGGEnabled->GetValue()) lossyFormat = wxT("OGG");   #endif   long oggQuality = mOGGQuality->GetValue();   gPrefs->Write(wxT("/FileFormats/LossyExportFormat"), lossyFormat);   gPrefs->Write(wxT("/FileFormats/OggExportQuality"), (long)(oggQuality * 10));   // Tell all open projects to modify their menu bar to reflect   // the new export formats.   for(unsigned int i = 0; i < gAudacityProjects.GetCount(); i++)   {      if(gAudacityProjects[i])         gAudacityProjects[i]->ModifyExportMenus();   }   return true;}FileFormatPrefs::~FileFormatPrefs(){}#define ID_HEADER_CHOICE           7101#define ID_BITS_CHOICE             7102#define ID_ENCODING_CHOICE         7103class OtherFormatDialog:public wxDialog { public:   // constructors and destructors   OtherFormatDialog(wxWindow * parent, wxWindowID id,                     unsigned int format);public:   void OnChoice(wxCommandEvent & event);   void OnOk(wxCommandEvent & event);   void OnCancel(wxCommandEvent & event);   void ValidateChoices();   unsigned int  mFormat;   wxButton   *mOK;   wxChoice   *mHeaderChoice;   wxChoice   *mBitsChoice;   wxChoice   *mEncodingChoice;   DECLARE_EVENT_TABLE()};BEGIN_EVENT_TABLE(OtherFormatDialog, wxDialog)   EVT_CHOICE(ID_HEADER_CHOICE,   OtherFormatDialog::OnChoice)   EVT_CHOICE(ID_BITS_CHOICE,     OtherFormatDialog::OnChoice)   EVT_CHOICE(ID_ENCODING_CHOICE, OtherFormatDialog::OnChoice)   EVT_BUTTON(wxID_OK,            OtherFormatDialog::OnOk)   EVT_BUTTON(wxID_CANCEL,        OtherFormatDialog::OnCancel)END_EVENT_TABLE()OtherFormatDialog::OtherFormatDialog(wxWindow * parent, wxWindowID id,                                     unsigned int format):   wxDialog(parent, id,            _("File Format"),            wxDefaultPosition, wxDefaultSize){   mFormat = format;   wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);   wxControl *item;   item = new wxStaticText(this, -1,                           _("(Not all combinations of headers\nand encodings are possible.)"),                           wxDefaultPosition, wxDefaultSize, 0);   mainSizer->Add(item, 0, wxALIGN_LEFT | wxALL, 5);   /***/      wxFlexGridSizer *gridSizer = new wxFlexGridSizer(2, 0, 0);   item = new wxStaticText(this, -1, _("Header: "),                        wxDefaultPosition, wxDefaultSize, 0);   gridSizer->Add(item, 0,                  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5);   int i;   int selection=0;   wxString *headerStrings = new wxString[sf_num_headers()];   for(i=0; i<sf_num_headers(); i++) {      headerStrings[i] = sf_header_index_name(i);      if ((mFormat & SF_FORMAT_TYPEMASK) == sf_header_index_to_type(i))         selection = i;   }   mHeaderChoice =       new wxChoice(this, ID_HEADER_CHOICE,                   wxDefaultPosition, wxDefaultSize,                   sf_num_headers(), headerStrings);   mHeaderChoice->SetSelection(selection);   gridSizer->Add(mHeaderChoice, 1, wxEXPAND | wxALL, 5);   /***/   item = new wxStaticText(this, -1, _("Encoding: "),                           wxDefaultPosition, wxDefaultSize, 0);   gridSizer->Add(item, 0,                  wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5);   wxString *encodingStrings = new wxString[sf_num_encodings()];   selection = 0;   for(i=0; i<sf_num_encodings(); i++) {      encodingStrings[i] = sf_encoding_index_name(i);      if ((mFormat & SF_FORMAT_SUBMASK) == sf_encoding_index_to_subtype(i))         selection = i;   }   mEncodingChoice =       new wxChoice(this, ID_ENCODING_CHOICE,                   wxDefaultPosition, wxDefaultSize,                   sf_num_encodings(), encodingStrings);   mEncodingChoice->SetSelection(selection);                                           gridSizer->Add(mEncodingChoice, 1, wxEXPAND | wxALL, 5);   /***/   mainSizer->Add(gridSizer, 0, wxALIGN_CENTRE | wxALL, 5);      /***/      wxBoxSizer *okSizer = new wxBoxSizer(wxHORIZONTAL);   wxButton *cancel =       new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition,                    wxDefaultSize, 0);   okSizer->Add(cancel, 0, wxALIGN_CENTRE | wxALL, 5);   mOK =        new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition,                    wxDefaultSize, 0);   mOK->SetDefault();   mOK->SetFocus();   okSizer->Add(mOK, 0, wxALIGN_CENTRE | wxALL, 5);   mainSizer->Add(okSizer, 0, wxALIGN_CENTRE | wxALL, 5);   SetAutoLayout(TRUE);   SetSizer(mainSizer);   mainSizer->Fit(this);   mainSizer->SetSizeHints(this);}void OtherFormatDialog::ValidateChoices(){   SF_INFO info =    {44100, 1, 2, mFormat, 1, 1};      if (sf_format_check(&info))      mOK->Enable(true);   else      mOK->Enable(false);}void OtherFormatDialog::OnChoice(wxCommandEvent & event){   int h = mHeaderChoice->GetSelection();   int e = mEncodingChoice->GetSelection();   mFormat = sf_header_index_to_type(h) | sf_encoding_index_to_subtype(e);   ValidateChoices();}void OtherFormatDialog::OnOk(wxCommandEvent & event){   EndModal(true);}void OtherFormatDialog::OnCancel(wxCommandEvent & event){   EndModal(false);}void FileFormatPrefs::Other(){   OtherFormatDialog dlog(this, -1,                          mFormat);   dlog.CentreOnParent();   dlog.ShowModal();   if (dlog.GetReturnCode()) {      mFormat = dlog.mFormat;   }}// Indentation settings for Vim and Emacs and unique identifier for Arch, a// version control system. Please do not modify past this point.//// Local Variables:// c-basic-offset: 3// indent-tabs-mode: nil// End://// vim: et sts=3 sw=3// arch-tag: 427b9e64-3fc6-40ef-bbf8-e6fff1d442f0

⌨️ 快捷键说明

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