Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
ExportMP3Options Class Referencefinal
Inheritance diagram for ExportMP3Options:
[legend]
Collaboration diagram for ExportMP3Options:
[legend]

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 (const TranslatableStrings &choices)
 
- 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 TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Attributes

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

Detailed Description

Definition at line 224 of file ExportMP3.cpp.

Constructor & Destructor Documentation

◆ ExportMP3Options()

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

Definition at line 275 of file ExportMP3.cpp.

276: wxPanelWrapper(parent, wxID_ANY)
277{
278 mSetRate = gPrefs->Read(wxT("/FileFormats/MP3SetRate"), PRESET_STANDARD);
279 mVbrRate = gPrefs->Read(wxT("/FileFormats/MP3VbrRate"), QUALITY_2);
280 mAbrRate = gPrefs->Read(wxT("/FileFormats/MP3AbrRate"), 192);
281 mCbrRate = gPrefs->Read(wxT("/FileFormats/MP3CbrRate"), 192);
282
285
287}
wxT("CloseDown"))
@ QUALITY_2
Definition: ExportMP3.cpp:115
@ PRESET_STANDARD
Definition: ExportMP3.cpp:122
FileConfig * gPrefs
Definition: Prefs.cpp:70
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
#define S(N)
Definition: ToChars.cpp:64
bool TransferDataToWindow() override
Definition: ExportMP3.cpp:455
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportMP3.cpp:328
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:625

References eIsCreatingFromPrefs, gPrefs, PRESET_STANDARD, QUALITY_2, S, and wxT().

Here is the call graph for this function:

◆ ~ExportMP3Options()

ExportMP3Options::~ExportMP3Options ( )
virtual

Definition at line 289 of file ExportMP3.cpp.

290{
292}
bool TransferDataFromWindow() override
Definition: ExportMP3.cpp:460

References TransferDataFromWindow().

Here is the call graph for this function:

Member Function Documentation

◆ LoadNames()

void ExportMP3Options::LoadNames ( const TranslatableStrings choices)

Definition at line 570 of file ExportMP3.cpp.

571{
572 mRate->Clear();
573 for (const auto &name : names)
574 mRate->Append( name.Translation() );
575}
const TranslatableString name
Definition: Distortion.cpp:76
static TranslatableStrings names
Definition: TagsEditor.cpp:152
wxChoice * mRate
Definition: ExportMP3.cpp:253
wxString Translation() const

References mRate, name, names, and TranslatableString::Translation().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnABR()

void ExportMP3Options::OnABR ( wxCommandEvent &  evt)

Definition at line 521 of file ExportMP3.cpp.

522{
524
525 mRate->SetSelection(ValidateIndex(fixRateValues, mAbrRate, 10));
526 mRate->Refresh();
527 //mMode->Enable(false);
528}
static const TranslatableStrings fixRateNames
Definition: ExportMP3.cpp:129
static const std::vector< int > fixRateValues
Definition: ExportMP3.cpp:150
void LoadNames(const TranslatableStrings &choices)
Definition: ExportMP3.cpp:570
int ValidateIndex(const std::vector< int > &values, int value, int defaultIndex)
Definition: ExportMP3.cpp:488

References fixRateNames, fixRateValues, LoadNames(), mAbrRate, mRate, and anonymous_namespace{ExportMP3.cpp}::ValidateIndex().

Here is the call graph for this function:

◆ OnCBR()

void ExportMP3Options::OnCBR ( wxCommandEvent &  evt)

Definition at line 532 of file ExportMP3.cpp.

533{
535
536 mRate->SetSelection(ValidateIndex(fixRateValues, mCbrRate, 10));
537 mRate->Refresh();
538 //mMode->Enable(false);
539}

References fixRateNames, fixRateValues, LoadNames(), mCbrRate, mRate, and anonymous_namespace{ExportMP3.cpp}::ValidateIndex().

Here is the call graph for this function:

◆ OnMono()

void ExportMP3Options::OnMono ( wxCommandEvent &  evt)

Definition at line 559 of file ExportMP3.cpp.

560{
561 bool mono = false;
562 mono = mMono->GetValue();
563 mJoint->Enable(!mono);
564 mStereo->Enable(!mono);
565
566 gPrefs->Write(wxT("/FileFormats/MP3ForceMono"), mono);
567 gPrefs->Flush();
568}
wxRadioButton * mStereo
Definition: ExportMP3.cpp:246
wxCheckBox * mMono
Definition: ExportMP3.cpp:248
wxRadioButton * mJoint
Definition: ExportMP3.cpp:247
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143

References FileConfig::Flush(), gPrefs, mJoint, mMono, mStereo, and wxT().

Here is the call graph for this function:

◆ OnQuality()

void ExportMP3Options::OnQuality ( wxCommandEvent &  evt)

Definition at line 541 of file ExportMP3.cpp.

542{
543 int sel = mRate->GetSelection();
544
545 if (mSET->GetValue()) {
546 mSetRate = sel;
547 }
548 else if (mVBR->GetValue()) {
549 mVbrRate = sel;
550 }
551 else if (mABR->GetValue()) {
552 mAbrRate = fixRateValues[ sel ];
553 }
554 else {
555 mCbrRate = fixRateValues[ sel ];
556 }
557}
wxRadioButton * mABR
Definition: ExportMP3.cpp:251
wxRadioButton * mVBR
Definition: ExportMP3.cpp:250
wxRadioButton * mSET
Definition: ExportMP3.cpp:249

References fixRateValues, mABR, mAbrRate, mCbrRate, mRate, mSET, mSetRate, mVBR, and mVbrRate.

◆ OnSET()

void ExportMP3Options::OnSET ( wxCommandEvent &  evt)

Definition at line 499 of file ExportMP3.cpp.

500{
502
503 mRate->SetSelection(ValidateValue(setRateNames.size(), mSetRate, 2));
504 mRate->Refresh();
505 //mMode->Enable(true);
506}
static const TranslatableStrings setRateNames
Definition: ExportMP3.cpp:189
int ValidateValue(const std::vector< int > &values, int value, int defaultValue)
Definition: ExportMP3.cpp:481

References LoadNames(), mRate, mSetRate, setRateNames, and anonymous_namespace{ExportMP3.cpp}::ValidateValue().

Here is the call graph for this function:

◆ OnVBR()

void ExportMP3Options::OnVBR ( wxCommandEvent &  evt)

Definition at line 510 of file ExportMP3.cpp.

511{
513
514 mRate->SetSelection(ValidateValue(varRateNames.size(), mVbrRate, 2));
515 mRate->Refresh();
516 //mMode->Enable(true);
517}
static const TranslatableStrings varRateNames
Definition: ExportMP3.cpp:171

References LoadNames(), mRate, mVbrRate, anonymous_namespace{ExportMP3.cpp}::ValidateValue(), and varRateNames.

Here is the call graph for this function:

◆ PopulateOrExchange()

void ExportMP3Options::PopulateOrExchange ( ShuttleGui S)

Definition at line 328 of file ExportMP3.cpp.

329{
330 bool mono = false;
331 gPrefs->Read(wxT("/FileFormats/MP3ForceMono"), &mono, 0);
332
333 const TranslatableStrings *choices = nullptr;
334 const std::vector< int > *codes = nullptr;
335 //bool enable;
336 int defrate;
337
338 S.StartVerticalLay();
339 {
340 S.StartHorizontalLay(wxCENTER);
341 {
342 S.StartMultiColumn(2, wxCENTER);
343 {
344 S.SetStretchyCol(1);
345 S.StartTwoColumn();
346 {
347 S.AddPrompt(XXO("Bit Rate Mode:"));
348
349 // Bug 2692: Place button group in panel so tabbing will work and,
350 // on the Mac, VoiceOver will announce as radio buttons.
351 S.StartPanel();
352 {
353 S.StartHorizontalLay();
354 {
355 S.StartRadioButtonGroup(MP3RateModeSetting);
356 {
357 mSET = S.Id(ID_SET).TieRadioButton();
358 mVBR = S.Id(ID_VBR).TieRadioButton();
359 mABR = S.Id(ID_ABR).TieRadioButton();
360 mCBR = S.Id(ID_CBR).TieRadioButton();
361 }
362 S.EndRadioButtonGroup();
363 }
364 S.EndHorizontalLay();
365 }
366 S.EndPanel();
367
368 /* PRL: unfortunately this bit of procedural code must
369 interrupt the mostly-declarative dialog description, until
370 we find a better solution. Because when shuttling values
371 from the dialog, we must shuttle out the MP3RateModeSetting
372 first. */
373
374 switch( MP3RateModeSetting.ReadEnum() ) {
375 case MODE_SET:
376 choices = &setRateNames;
377 //enable = true;
378 defrate = mSetRate;
379 break;
380
381 case MODE_VBR:
382 choices = &varRateNames;
383 //enable = true;
384 defrate = mVbrRate;
385 break;
386
387 case MODE_ABR:
388 choices = &fixRateNames;
389 codes = &fixRateValues;
390 //enable = false;
391 defrate = mAbrRate;
392 break;
393
394 case MODE_CBR:
395 default:
396 choices = &fixRateNames;
397 codes = &fixRateValues;
398 //enable = false;
399 defrate = mCbrRate;
400 break;
401 }
402
403 IntSetting Setting{ L"/FileFormats/MP3Bitrate", defrate };
404
405 mRate = S.Id(ID_QUALITY).TieNumberAsChoice(
406 XXO("Quality"),
407 Setting,
408 *choices,
409 codes
410 );
411 /*
412 mMode = S.Disable(!enable)
413 .TieNumberAsChoice(
414 XXO("Variable Speed:"),
415 { wxT("/FileFormats/MP3VarMode"), ROUTINE_FAST },
416 varModeNames );
417 */
418 S.AddPrompt(XXO("Channel Mode:"));
419 S.StartMultiColumn(2, wxEXPAND);
420 {
421 // Bug 2692: Place button group in panel so tabbing will work and,
422 // on the Mac, VoiceOver will announce as radio buttons.
423 S.StartPanel();
424 {
425 S.StartHorizontalLay();
426 {
427 S.StartRadioButtonGroup(MP3ChannelModeSetting);
428 {
429 mJoint = S.Disable(mono)
430 .TieRadioButton();
431 mStereo = S.Disable(mono)
432 .TieRadioButton();
433 }
434 S.EndRadioButtonGroup();
435 }
436 S.EndHorizontalLay();
437 }
438 S.EndPanel();
439
440 mMono = S.Id(ID_MONO).AddCheckBox(XXO("Force export to mono"), mono);
441 }
442 S.EndMultiColumn();
443 }
444 S.EndTwoColumn();
445 }
446 S.EndMultiColumn();
447 }
448 S.EndHorizontalLay();
449 }
450 S.EndVerticalLay();
451}
#define ID_VBR
Definition: ExportMP3.cpp:218
#define ID_ABR
Definition: ExportMP3.cpp:219
EnumSetting< MP3RateMode > MP3RateModeSetting
Definition: ExportMP3.cpp:294
static EnumSetting< MP3ChannelMode > MP3ChannelModeSetting
Definition: ExportMP3.cpp:311
#define ID_MONO
Definition: ExportMP3.cpp:222
#define ID_SET
Definition: ExportMP3.cpp:217
#define ID_QUALITY
Definition: ExportMP3.cpp:221
#define ID_CBR
Definition: ExportMP3.cpp:220
@ MODE_SET
Definition: ExportMP3.h:19
@ MODE_ABR
Definition: ExportMP3.h:21
@ MODE_VBR
Definition: ExportMP3.h:20
@ MODE_CBR
Definition: ExportMP3.h:22
XXO("&Cut/Copy/Paste Toolbar")
std::vector< TranslatableString > TranslatableStrings
wxRadioButton * mCBR
Definition: ExportMP3.cpp:252
Specialization of Setting for int.
Definition: Prefs.h:349
Definition: Prefs.h:173

References fixRateNames, fixRateValues, gPrefs, ID_ABR, ID_CBR, ID_MONO, ID_QUALITY, ID_SET, ID_VBR, mABR, mAbrRate, mCBR, mCbrRate, mJoint, mMono, MODE_ABR, MODE_CBR, MODE_SET, MODE_VBR, MP3ChannelModeSetting, MP3RateModeSetting, mRate, mSET, mSetRate, mStereo, mVBR, mVbrRate, S, setRateNames, varRateNames, wxT(), and XXO().

Referenced by TransferDataFromWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransferDataFromWindow()

bool ExportMP3Options::TransferDataFromWindow ( )
override

Definition at line 460 of file ExportMP3.cpp.

461{
464
465 gPrefs->Write(wxT("/FileFormats/MP3SetRate"), mSetRate);
466 gPrefs->Write(wxT("/FileFormats/MP3VbrRate"), mVbrRate);
467 gPrefs->Write(wxT("/FileFormats/MP3AbrRate"), mAbrRate);
468 gPrefs->Write(wxT("/FileFormats/MP3CbrRate"), mCbrRate);
469 gPrefs->Flush();
470
471 return true;
472}
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47

References eIsSavingToPrefs, FileConfig::Flush(), gPrefs, mAbrRate, mCbrRate, mSetRate, mVbrRate, PopulateOrExchange(), S, and wxT().

Referenced by ~ExportMP3Options().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransferDataToWindow()

bool ExportMP3Options::TransferDataToWindow ( )
override

Definition at line 455 of file ExportMP3.cpp.

456{
457 return true;
458}

Member Data Documentation

◆ mABR

wxRadioButton* ExportMP3Options::mABR
private

Definition at line 251 of file ExportMP3.cpp.

Referenced by OnQuality(), and PopulateOrExchange().

◆ mAbrRate

long ExportMP3Options::mAbrRate
private

Definition at line 258 of file ExportMP3.cpp.

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

◆ mCBR

wxRadioButton* ExportMP3Options::mCBR
private

Definition at line 252 of file ExportMP3.cpp.

Referenced by PopulateOrExchange().

◆ mCbrRate

long ExportMP3Options::mCbrRate
private

Definition at line 259 of file ExportMP3.cpp.

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

◆ mJoint

wxRadioButton* ExportMP3Options::mJoint
private

Definition at line 247 of file ExportMP3.cpp.

Referenced by OnMono(), and PopulateOrExchange().

◆ mMono

wxCheckBox* ExportMP3Options::mMono
private

Definition at line 248 of file ExportMP3.cpp.

Referenced by OnMono(), and PopulateOrExchange().

◆ mRate

wxChoice* ExportMP3Options::mRate
private

Definition at line 253 of file ExportMP3.cpp.

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

◆ mSET

wxRadioButton* ExportMP3Options::mSET
private

Definition at line 249 of file ExportMP3.cpp.

Referenced by OnQuality(), and PopulateOrExchange().

◆ mSetRate

long ExportMP3Options::mSetRate
private

Definition at line 256 of file ExportMP3.cpp.

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

◆ mStereo

wxRadioButton* ExportMP3Options::mStereo
private

Definition at line 246 of file ExportMP3.cpp.

Referenced by OnMono(), and PopulateOrExchange().

◆ mVBR

wxRadioButton* ExportMP3Options::mVBR
private

Definition at line 250 of file ExportMP3.cpp.

Referenced by OnQuality(), and PopulateOrExchange().

◆ mVbrRate

long ExportMP3Options::mVbrRate
private

Definition at line 257 of file ExportMP3.cpp.

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


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