Audacity  2.2.2
Public Member Functions | Private Attributes | List of all members
ExportMP3Options Class Referencefinal
Inheritance diagram for ExportMP3Options:
wxPanelWrapper wxTabTraversalWrapper< wxPanel >

Public Member Functions

 ExportMP3Options (wxWindow *parent, int format)
 
virtual ~ExportMP3Options ()
 
void PopulateOrExchange (ShuttleGui &S)
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
void OnSET (wxCommandEvent &evt)
 
void OnVBR (wxCommandEvent &evt)
 
void OnABR (wxCommandEvent &evt)
 
void OnCBR (wxCommandEvent &evt)
 
void OnQuality (wxCommandEvent &evt)
 
void OnMono (wxCommandEvent &evt)
 
void LoadNames (CHOICES *choices, int count)
 
wxArrayString GetNames (CHOICES *choices, int count)
 
std::vector< int > GetLabels (CHOICES *choices, int count)
 
int FindIndex (CHOICES *choices, int cnt, int needle, int def)
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&...args)
 

Private Attributes

wxRadioButton * mStereo
 
wxRadioButton * mJoint
 
wxCheckBox * mMono
 
wxRadioButton * mSET
 
wxRadioButton * mVBR
 
wxRadioButton * mABR
 
wxRadioButton * mCBR
 
wxChoice * mRate
 
wxChoice * mMode
 
long mSetRate
 
long mVbrRate
 
long mAbrRate
 
long mCbrRate
 

Detailed Description

Definition at line 261 of file ExportMP3.cpp.

Constructor & Destructor Documentation

ExportMP3Options::ExportMP3Options ( wxWindow *  parent,
int  format 
)

Definition at line 315 of file ExportMP3.cpp.

References eIsCreatingFromPrefs, gPrefs, InitMP3_Statics(), PRESET_STANDARD, and QUALITY_2.

316 : wxPanelWrapper(parent, wxID_ANY)
317 {
318  InitMP3_Statics();
319 
320  mSetRate = gPrefs->Read(wxT("/FileFormats/MP3SetRate"), PRESET_STANDARD);
321  mVbrRate = gPrefs->Read(wxT("/FileFormats/MP3VbrRate"), QUALITY_2);
322  mAbrRate = gPrefs->Read(wxT("/FileFormats/MP3AbrRate"), 192);
323  mCbrRate = gPrefs->Read(wxT("/FileFormats/MP3CbrRate"), 192);
324 
327 
329 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
#define QUALITY_2
Definition: ExportMP3.cpp:119
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
static void InitMP3_Statics()
Definition: ExportMP3.cpp:234
#define PRESET_STANDARD
Definition: ExportMP3.cpp:133
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportMP3.cpp:338
bool TransferDataToWindow() override
Definition: ExportMP3.cpp:437
ExportMP3Options::~ExportMP3Options ( )
virtual

Definition at line 331 of file ExportMP3.cpp.

References TransferDataFromWindow().

332 {
334 }
bool TransferDataFromWindow() override
Definition: ExportMP3.cpp:442

Member Function Documentation

int ExportMP3Options::FindIndex ( CHOICES choices,
int  cnt,
int  needle,
int  def 
)

Definition at line 561 of file ExportMP3.cpp.

References label.

Referenced by OnABR(), OnCBR(), OnSET(), and OnVBR().

562 {
563  for (int i = 0; i < cnt; i++) {
564  if (choices[i].label == needle) {
565  return i;
566  }
567  }
568 
569  return def;
570 }
wxString label
Definition: Tags.cpp:727
std::vector< int > ExportMP3Options::GetLabels ( CHOICES choices,
int  count 
)

Definition at line 550 of file ExportMP3.cpp.

References label.

Referenced by PopulateOrExchange().

551 {
552  std::vector<int> labels;
553 
554  for (int i = 0; i < count; i++) {
555  labels.push_back(choices[i].label);
556  }
557 
558  return labels;
559 }
wxString label
Definition: Tags.cpp:727
wxArrayString ExportMP3Options::GetNames ( CHOICES choices,
int  count 
)

Definition at line 539 of file ExportMP3.cpp.

References name, and names().

Referenced by PopulateOrExchange().

540 {
541  wxArrayString names;
542 
543  for (int i = 0; i < count; i++) {
544  names.Add(choices[i].name);
545  }
546 
547  return names;
548 }
static wxArrayString names()
Definition: Tags.cpp:697
const wxChar * name
Definition: Distortion.cpp:94
void ExportMP3Options::LoadNames ( CHOICES choices,
int  count 
)

Definition at line 529 of file ExportMP3.cpp.

References mRate, and name.

Referenced by OnABR(), OnCBR(), OnSET(), and OnVBR().

530 {
531  mRate->Clear();
532 
533  for (int i = 0; i < count; i++)
534  {
535  mRate->Append(choices[i].name);
536  }
537 }
wxChoice * mRate
Definition: ExportMP3.cpp:293
const wxChar * name
Definition: Distortion.cpp:94
void ExportMP3Options::OnABR ( wxCommandEvent &  evt)

Definition at line 480 of file ExportMP3.cpp.

References FindIndex(), LoadNames(), mAbrRate, mMode, and mRate.

481 {
482  LoadNames(fixRates, WXSIZEOF(fixRates));
483 
484  mRate->SetSelection(FindIndex(fixRates, WXSIZEOF(fixRates), mAbrRate, 10));
485  mRate->Refresh();
486  mMode->Enable(false);
487 }
void LoadNames(CHOICES *choices, int count)
Definition: ExportMP3.cpp:529
int FindIndex(CHOICES *choices, int cnt, int needle, int def)
Definition: ExportMP3.cpp:561
wxChoice * mRate
Definition: ExportMP3.cpp:293
static CHOICES fixRates[]
Definition: ExportMP3.cpp:148
wxChoice * mMode
Definition: ExportMP3.cpp:294
void ExportMP3Options::OnCBR ( wxCommandEvent &  evt)

Definition at line 491 of file ExportMP3.cpp.

References FindIndex(), LoadNames(), mCbrRate, mMode, and mRate.

492 {
493  LoadNames(fixRates, WXSIZEOF(fixRates));
494 
495  mRate->SetSelection(FindIndex(fixRates, WXSIZEOF(fixRates), mCbrRate, 10));
496  mRate->Refresh();
497  mMode->Enable(false);
498 }
void LoadNames(CHOICES *choices, int count)
Definition: ExportMP3.cpp:529
int FindIndex(CHOICES *choices, int cnt, int needle, int def)
Definition: ExportMP3.cpp:561
wxChoice * mRate
Definition: ExportMP3.cpp:293
static CHOICES fixRates[]
Definition: ExportMP3.cpp:148
wxChoice * mMode
Definition: ExportMP3.cpp:294
void ExportMP3Options::OnMono ( wxCommandEvent &  evt)

Definition at line 518 of file ExportMP3.cpp.

References gPrefs, mJoint, mMono, and mStereo.

519 {
520  bool mono = false;
521  mono = mMono->GetValue();
522  mJoint->Enable(!mono);
523  mStereo->Enable(!mono);
524 
525  gPrefs->Write(wxT("/FileFormats/MP3ForceMono"), mono);
526  gPrefs->Flush();
527 }
wxRadioButton * mStereo
Definition: ExportMP3.cpp:286
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
wxCheckBox * mMono
Definition: ExportMP3.cpp:288
wxRadioButton * mJoint
Definition: ExportMP3.cpp:287
void ExportMP3Options::OnQuality ( wxCommandEvent &  evt)

Definition at line 500 of file ExportMP3.cpp.

References CHOICES::label, mABR, mAbrRate, mCbrRate, mRate, mSET, mSetRate, mVBR, and mVbrRate.

501 {
502  int sel = mRate->GetSelection();
503 
504  if (mSET->GetValue()) {
505  mSetRate = setRates[sel].label;
506  }
507  else if (mVBR->GetValue()) {
508  mVbrRate = varRates[sel].label;
509  }
510  else if (mABR->GetValue()) {
511  mAbrRate = fixRates[sel].label;
512  }
513  else {
514  mCbrRate = fixRates[sel].label;
515  }
516 }
wxRadioButton * mVBR
Definition: ExportMP3.cpp:290
static CHOICES varRates[]
Definition: ExportMP3.cpp:171
wxChoice * mRate
Definition: ExportMP3.cpp:293
static CHOICES setRates[]
Definition: ExportMP3.cpp:206
static CHOICES fixRates[]
Definition: ExportMP3.cpp:148
wxRadioButton * mSET
Definition: ExportMP3.cpp:289
wxRadioButton * mABR
Definition: ExportMP3.cpp:291
int label
Definition: ExportMP3.cpp:145
void ExportMP3Options::OnSET ( wxCommandEvent &  evt)

Definition at line 458 of file ExportMP3.cpp.

References FindIndex(), LoadNames(), mMode, mRate, and mSetRate.

459 {
460  LoadNames(setRates, WXSIZEOF(setRates));
461 
462  mRate->SetSelection(FindIndex(setRates, WXSIZEOF(setRates), mSetRate, 2));
463  mRate->Refresh();
464  mMode->Enable(true);
465 }
void LoadNames(CHOICES *choices, int count)
Definition: ExportMP3.cpp:529
int FindIndex(CHOICES *choices, int cnt, int needle, int def)
Definition: ExportMP3.cpp:561
wxChoice * mRate
Definition: ExportMP3.cpp:293
static CHOICES setRates[]
Definition: ExportMP3.cpp:206
wxChoice * mMode
Definition: ExportMP3.cpp:294
void ExportMP3Options::OnVBR ( wxCommandEvent &  evt)

Definition at line 469 of file ExportMP3.cpp.

References FindIndex(), LoadNames(), mMode, mRate, and mVbrRate.

470 {
471  LoadNames(varRates, WXSIZEOF(varRates));
472 
473  mRate->SetSelection(FindIndex(varRates, WXSIZEOF(varRates), mVbrRate, 2));
474  mRate->Refresh();
475  mMode->Enable(true);
476 }
void LoadNames(CHOICES *choices, int count)
Definition: ExportMP3.cpp:529
static CHOICES varRates[]
Definition: ExportMP3.cpp:171
int FindIndex(CHOICES *choices, int cnt, int needle, int def)
Definition: ExportMP3.cpp:561
wxChoice * mRate
Definition: ExportMP3.cpp:293
wxChoice * mMode
Definition: ExportMP3.cpp:294
void ExportMP3Options::PopulateOrExchange ( ShuttleGui S)

Definition at line 338 of file ExportMP3.cpp.

References _(), ShuttleGuiBase::AddCheckBox(), ShuttleGuiBase::AddPrompt(), CHANNEL_JOINT, CHANNEL_STEREO, ShuttleGuiBase::EndHorizontalLay(), ShuttleGuiBase::EndMultiColumn(), ShuttleGuiBase::EndRadioButtonGroup(), ShuttleGuiBase::EndTwoColumn(), ShuttleGuiBase::EndVerticalLay(), fixRates, GetLabels(), GetNames(), gPrefs, ShuttleGui::Id(), ID_ABR, ID_CBR, ID_MONO, ID_QUALITY, ID_SET, ID_VBR, mABR, mAbrRate, mCBR, mCbrRate, mJoint, mMode, mMono, MODE_ABR, MODE_CBR, MODE_SET, MODE_VBR, mRate, mSET, mSetRate, mStereo, mVBR, mVbrRate, ROUTINE_FAST, setRates, ShuttleGuiBase::SetStretchyCol(), ShuttleGuiBase::StartHorizontalLay(), ShuttleGuiBase::StartMultiColumn(), ShuttleGuiBase::StartRadioButtonGroup(), ShuttleGuiBase::StartTwoColumn(), ShuttleGuiBase::StartVerticalLay(), ShuttleGuiBase::TieChoice(), ShuttleGuiBase::TieRadioButton(), and varRates.

Referenced by TransferDataFromWindow().

339 {
340  S.StartVerticalLay();
341  {
342  S.StartHorizontalLay(wxCENTER);
343  {
344  S.StartMultiColumn(2, wxCENTER);
345  {
346  S.SetStretchyCol(1);
347  S.StartTwoColumn();
348  {
349  S.AddPrompt(_("Bit Rate Mode:"));
350  S.StartHorizontalLay();
351  {
352  S.StartRadioButtonGroup(wxT("/FileFormats/MP3RateMode"), MODE_SET);
353  {
354  mSET = S.Id(ID_SET).TieRadioButton(_("Preset"), MODE_SET);
355  mVBR = S.Id(ID_VBR).TieRadioButton(_("Variable"), MODE_VBR);
356  mABR = S.Id(ID_ABR).TieRadioButton(_("Average"), MODE_ABR);
357  mCBR = S.Id(ID_CBR).TieRadioButton(_("Constant"), MODE_CBR);
358  }
360  }
361  S.EndHorizontalLay();
362 
363  CHOICES *choices;
364  int cnt;
365  bool enable;
366  int defrate;
367 
368  if (mSET->GetValue()) {
369  choices = setRates;
370  cnt = WXSIZEOF(setRates);
371  enable = true;
372  defrate = mSetRate;
373  }
374  else if (mVBR->GetValue()) {
375  choices = varRates;
376  cnt = WXSIZEOF(varRates);
377  enable = true;
378  defrate = mVbrRate;
379  }
380  else if (mABR->GetValue()) {
381  choices = fixRates;
382  cnt = WXSIZEOF(fixRates);
383  enable = false;
384  defrate = mAbrRate;
385  }
386  else {
387  mCBR->SetValue(true);
388  choices = fixRates;
389  cnt = WXSIZEOF(fixRates);
390  enable = false;
391  defrate = mCbrRate;
392  }
393 
394  mRate = S.Id(ID_QUALITY).TieChoice(_("Quality"),
395  wxT("/FileFormats/MP3Bitrate"),
396  defrate,
397  GetNames(choices, cnt),
398  GetLabels(choices, cnt));
399 
400  mMode = S.TieChoice(_("Variable Speed:"),
401  wxT("/FileFormats/MP3VarMode"),
402  ROUTINE_FAST,
403  GetNames(varModes, WXSIZEOF(varModes)),
404  GetLabels(varModes, WXSIZEOF(varModes)));
405  mMode->Enable(enable);
406 
407  S.AddPrompt(_("Channel Mode:"));
408  S.StartMultiColumn(3, wxEXPAND);
409  {
410  bool mono = false;
411  gPrefs->Read(wxT("/FileFormats/MP3ForceMono"), &mono, 0);
412 
413  S.StartRadioButtonGroup(wxT("/FileFormats/MP3ChannelMode"), CHANNEL_JOINT);
414  {
415  mJoint = S.TieRadioButton(_("Joint Stereo"), CHANNEL_JOINT);
416  mStereo = S.TieRadioButton(_("Stereo"), CHANNEL_STEREO);
417  mJoint->Enable(!mono);
418  mStereo->Enable(!mono);
419  }
421 
422  mMono = S.Id(ID_MONO).AddCheckBox(_("Force export to mono"), mono? wxT("true") : wxT("false"));
423  }
424  S.EndTwoColumn();
425  }
426  S.EndTwoColumn();
427  }
428  S.EndMultiColumn();
429  }
430  S.EndHorizontalLay();
431  }
432  S.EndVerticalLay();
433 }
wxChoice * TieChoice(const wxString &Prompt, WrappedType &WrappedRef, const wxArrayString *pChoices)
wxRadioButton * mStereo
Definition: ExportMP3.cpp:286
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
void EndRadioButtonGroup()
#define ID_SET
Definition: ExportMP3.cpp:227
wxRadioButton * mVBR
Definition: ExportMP3.cpp:290
#define CHANNEL_JOINT
Definition: ExportMP3.cpp:113
void EndMultiColumn()
#define MODE_VBR
Definition: ExportMP3.cpp:109
static CHOICES varRates[]
Definition: ExportMP3.cpp:171
void EndHorizontalLay()
void AddPrompt(const wxString &Prompt)
Right aligned text string.
Definition: ShuttleGui.cpp:239
void EndVerticalLay()
wxCheckBox * AddCheckBox(const wxString &Prompt, const wxString &Selected)
Definition: ShuttleGui.cpp:298
wxRadioButton * mCBR
Definition: ExportMP3.cpp:292
wxCheckBox * mMono
Definition: ExportMP3.cpp:288
void StartTwoColumn()
Definition: ShuttleGui.h:136
std::vector< int > GetLabels(CHOICES *choices, int count)
Definition: ExportMP3.cpp:550
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
ShuttleGui & Id(int id)
static CHOICES varModes[]
Definition: ExportMP3.cpp:200
#define ID_VBR
Definition: ExportMP3.cpp:228
#define MODE_ABR
Definition: ExportMP3.cpp:110
wxChoice * mRate
Definition: ExportMP3.cpp:293
wxRadioButton * TieRadioButton(const wxString &Prompt, WrappedType &WrappedRef)
#define ID_ABR
Definition: ExportMP3.cpp:229
#define ROUTINE_FAST
Definition: ExportMP3.cpp:128
#define MODE_SET
Definition: ExportMP3.cpp:108
_("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
#define CHANNEL_STEREO
Definition: ExportMP3.cpp:114
#define ID_CBR
Definition: ExportMP3.cpp:230
#define MODE_CBR
Definition: ExportMP3.cpp:111
wxArrayString GetNames(CHOICES *choices, int count)
Definition: ExportMP3.cpp:539
static CHOICES setRates[]
Definition: ExportMP3.cpp:206
#define ID_QUALITY
Definition: ExportMP3.cpp:231
static CHOICES fixRates[]
Definition: ExportMP3.cpp:148
wxRadioButton * mJoint
Definition: ExportMP3.cpp:287
#define ID_MONO
Definition: ExportMP3.cpp:232
wxRadioButton * mSET
Definition: ExportMP3.cpp:289
wxRadioButton * mABR
Definition: ExportMP3.cpp:291
void EndTwoColumn()
Definition: ShuttleGui.h:137
void StartRadioButtonGroup(const wxString &SettingName)
void SetStretchyCol(int i)
Used to modify an already placed FlexGridSizer to make a column stretchy.
Definition: ShuttleGui.cpp:203
wxChoice * mMode
Definition: ExportMP3.cpp:294
void StartVerticalLay(int iProp=1)
bool ExportMP3Options::TransferDataFromWindow ( )
override

Definition at line 442 of file ExportMP3.cpp.

References eIsSavingToPrefs, gPrefs, mAbrRate, mCbrRate, mSetRate, mVbrRate, and PopulateOrExchange().

Referenced by ~ExportMP3Options().

443 {
444  ShuttleGui S(this, eIsSavingToPrefs);
446 
447  gPrefs->Write(wxT("/FileFormats/MP3SetRate"), mSetRate);
448  gPrefs->Write(wxT("/FileFormats/MP3VbrRate"), mVbrRate);
449  gPrefs->Write(wxT("/FileFormats/MP3AbrRate"), mAbrRate);
450  gPrefs->Write(wxT("/FileFormats/MP3CbrRate"), mCbrRate);
451  gPrefs->Flush();
452 
453  return true;
454 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportMP3.cpp:338
bool ExportMP3Options::TransferDataToWindow ( )
override

Definition at line 437 of file ExportMP3.cpp.

438 {
439  return true;
440 }

Member Data Documentation

wxRadioButton* ExportMP3Options::mABR
private

Definition at line 291 of file ExportMP3.cpp.

Referenced by OnQuality(), and PopulateOrExchange().

long ExportMP3Options::mAbrRate
private

Definition at line 298 of file ExportMP3.cpp.

Referenced by OnABR(), OnQuality(), PopulateOrExchange(), and TransferDataFromWindow().

wxRadioButton* ExportMP3Options::mCBR
private

Definition at line 292 of file ExportMP3.cpp.

Referenced by PopulateOrExchange().

long ExportMP3Options::mCbrRate
private

Definition at line 299 of file ExportMP3.cpp.

Referenced by OnCBR(), OnQuality(), PopulateOrExchange(), and TransferDataFromWindow().

wxRadioButton* ExportMP3Options::mJoint
private

Definition at line 287 of file ExportMP3.cpp.

Referenced by OnMono(), and PopulateOrExchange().

wxChoice* ExportMP3Options::mMode
private

Definition at line 294 of file ExportMP3.cpp.

Referenced by OnABR(), OnCBR(), OnSET(), OnVBR(), and PopulateOrExchange().

wxCheckBox* ExportMP3Options::mMono
private

Definition at line 288 of file ExportMP3.cpp.

Referenced by OnMono(), and PopulateOrExchange().

wxChoice* ExportMP3Options::mRate
private

Definition at line 293 of file ExportMP3.cpp.

Referenced by LoadNames(), OnABR(), OnCBR(), OnQuality(), OnSET(), OnVBR(), and PopulateOrExchange().

wxRadioButton* ExportMP3Options::mSET
private

Definition at line 289 of file ExportMP3.cpp.

Referenced by OnQuality(), and PopulateOrExchange().

long ExportMP3Options::mSetRate
private

Definition at line 296 of file ExportMP3.cpp.

Referenced by OnQuality(), OnSET(), PopulateOrExchange(), and TransferDataFromWindow().

wxRadioButton* ExportMP3Options::mStereo
private

Definition at line 286 of file ExportMP3.cpp.

Referenced by OnMono(), and PopulateOrExchange().

wxRadioButton* ExportMP3Options::mVBR
private

Definition at line 290 of file ExportMP3.cpp.

Referenced by OnQuality(), and PopulateOrExchange().

long ExportMP3Options::mVbrRate
private

Definition at line 297 of file ExportMP3.cpp.

Referenced by OnQuality(), OnVBR(), PopulateOrExchange(), and TransferDataFromWindow().


The documentation for this class was generated from the following file: