mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
Corrects a problem with the stereo mode affecting the output file even though it is disabled in the dialog. Windows was the only platform whre the stereo mode would be disabled for presets and it was a holdover from the Blade API days. After discussing with Gale, I removed the code that disabled those options and it now acts the same for all platforms.
In addition, while changing from mode to mode, the Quality dropdown no longer resets to a default value and it remembers how you had them set from session to session.
This commit is contained in:
parent
c1cf9b4a76
commit
8fe322f633
@ -215,6 +215,7 @@ static CHOICES sampRates[] =
|
|||||||
#define ID_VBR 7001
|
#define ID_VBR 7001
|
||||||
#define ID_ABR 7002
|
#define ID_ABR 7002
|
||||||
#define ID_CBR 7003
|
#define ID_CBR 7003
|
||||||
|
#define ID_QUALITY 7004
|
||||||
|
|
||||||
void InitMP3_Statics()
|
void InitMP3_Statics()
|
||||||
{
|
{
|
||||||
@ -273,9 +274,12 @@ public:
|
|||||||
void OnVBR(wxCommandEvent& evt);
|
void OnVBR(wxCommandEvent& evt);
|
||||||
void OnABR(wxCommandEvent& evt);
|
void OnABR(wxCommandEvent& evt);
|
||||||
void OnCBR(wxCommandEvent& evt);
|
void OnCBR(wxCommandEvent& evt);
|
||||||
|
void OnQuality(wxCommandEvent& evt);
|
||||||
|
|
||||||
void LoadNames(CHOICES *choices, int count);
|
void LoadNames(CHOICES *choices, int count);
|
||||||
wxArrayString GetNames(CHOICES *choices, int count);
|
wxArrayString GetNames(CHOICES *choices, int count);
|
||||||
wxArrayInt GetLabels(CHOICES *choices, int count);
|
wxArrayInt GetLabels(CHOICES *choices, int count);
|
||||||
|
int FindIndex(CHOICES *choices, int cnt, int needle, int def);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -288,6 +292,11 @@ private:
|
|||||||
wxChoice *mRate;
|
wxChoice *mRate;
|
||||||
wxChoice *mMode;
|
wxChoice *mMode;
|
||||||
|
|
||||||
|
long mSetRate;
|
||||||
|
long mVbrRate;
|
||||||
|
long mAbrRate;
|
||||||
|
long mCbrRate;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -296,6 +305,7 @@ BEGIN_EVENT_TABLE(ExportMP3Options, wxDialog)
|
|||||||
EVT_RADIOBUTTON(ID_VBR, ExportMP3Options::OnVBR)
|
EVT_RADIOBUTTON(ID_VBR, ExportMP3Options::OnVBR)
|
||||||
EVT_RADIOBUTTON(ID_ABR, ExportMP3Options::OnABR)
|
EVT_RADIOBUTTON(ID_ABR, ExportMP3Options::OnABR)
|
||||||
EVT_RADIOBUTTON(ID_CBR, ExportMP3Options::OnCBR)
|
EVT_RADIOBUTTON(ID_CBR, ExportMP3Options::OnCBR)
|
||||||
|
EVT_CHOICE(wxID_ANY, ExportMP3Options::OnQuality)
|
||||||
EVT_BUTTON(wxID_OK, ExportMP3Options::OnOK)
|
EVT_BUTTON(wxID_OK, ExportMP3Options::OnOK)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
@ -306,6 +316,12 @@ ExportMP3Options::ExportMP3Options(wxWindow *parent)
|
|||||||
wxString(_("Specify MP3 Options")))
|
wxString(_("Specify MP3 Options")))
|
||||||
{
|
{
|
||||||
InitMP3_Statics();
|
InitMP3_Statics();
|
||||||
|
|
||||||
|
mSetRate = gPrefs->Read(wxT("/FileFormats/MP3SetRate"), PRESET_STANDARD);
|
||||||
|
mVbrRate = gPrefs->Read(wxT("/FileFormats/MP3VbrRate"), QUALITY_4);
|
||||||
|
mAbrRate = gPrefs->Read(wxT("/FileFormats/MP3AbrRate"), 128);
|
||||||
|
mCbrRate = gPrefs->Read(wxT("/FileFormats/MP3CbrRate"), 128);
|
||||||
|
|
||||||
ShuttleGui S(this, eIsCreatingFromPrefs);
|
ShuttleGui S(this, eIsCreatingFromPrefs);
|
||||||
|
|
||||||
PopulateOrExchange(S);
|
PopulateOrExchange(S);
|
||||||
@ -342,40 +358,38 @@ void ExportMP3Options::PopulateOrExchange(ShuttleGui & S)
|
|||||||
int cnt;
|
int cnt;
|
||||||
bool enable;
|
bool enable;
|
||||||
int defrate;
|
int defrate;
|
||||||
bool preset = false;
|
|
||||||
|
|
||||||
if (mSET->GetValue()) {
|
if (mSET->GetValue()) {
|
||||||
choices = setRates;
|
choices = setRates;
|
||||||
cnt = WXSIZEOF(setRates);
|
cnt = WXSIZEOF(setRates);
|
||||||
enable = true;
|
enable = true;
|
||||||
defrate = PRESET_STANDARD;
|
defrate = mSetRate;
|
||||||
preset = true;
|
|
||||||
}
|
}
|
||||||
else if (mVBR->GetValue()) {
|
else if (mVBR->GetValue()) {
|
||||||
choices = varRates;
|
choices = varRates;
|
||||||
cnt = WXSIZEOF(varRates);
|
cnt = WXSIZEOF(varRates);
|
||||||
enable = true;
|
enable = true;
|
||||||
defrate = QUALITY_4;
|
defrate = mVbrRate;
|
||||||
}
|
}
|
||||||
else if (mABR->GetValue()) {
|
else if (mABR->GetValue()) {
|
||||||
choices = fixRates;
|
choices = fixRates;
|
||||||
cnt = WXSIZEOF(fixRates);
|
cnt = WXSIZEOF(fixRates);
|
||||||
enable = false;
|
enable = false;
|
||||||
defrate = 128;
|
defrate = mAbrRate;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mCBR->SetValue(true);
|
mCBR->SetValue(true);
|
||||||
choices = fixRates;
|
choices = fixRates;
|
||||||
cnt = WXSIZEOF(fixRates);
|
cnt = WXSIZEOF(fixRates);
|
||||||
enable = false;
|
enable = false;
|
||||||
defrate = 128;
|
defrate = mCbrRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
mRate = S.TieChoice(_("Quality"),
|
mRate = S.Id(ID_QUALITY).TieChoice(_("Quality"),
|
||||||
wxT("/FileFormats/MP3Bitrate"),
|
wxT("/FileFormats/MP3Bitrate"),
|
||||||
defrate,
|
defrate,
|
||||||
GetNames(choices, cnt),
|
GetNames(choices, cnt),
|
||||||
GetLabels(choices, cnt));
|
GetLabels(choices, cnt));
|
||||||
|
|
||||||
mMode = S.TieChoice(_("Variable Speed:"),
|
mMode = S.TieChoice(_("Variable Speed:"),
|
||||||
wxT("/FileFormats/MP3VarMode"),
|
wxT("/FileFormats/MP3VarMode"),
|
||||||
@ -387,14 +401,10 @@ void ExportMP3Options::PopulateOrExchange(ShuttleGui & S)
|
|||||||
S.AddPrompt(_("Channel Mode:"));
|
S.AddPrompt(_("Channel Mode:"));
|
||||||
S.StartTwoColumn();
|
S.StartTwoColumn();
|
||||||
{
|
{
|
||||||
S.StartRadioButtonGroup(wxT("/FileFormats/MP3ChannelMode"), CHANNEL_STEREO);
|
S.StartRadioButtonGroup(wxT("/FileFormats/MP3ChannelMode"), CHANNEL_JOINT);
|
||||||
{
|
{
|
||||||
mJoint = S.TieRadioButton(_("Joint Stereo"), CHANNEL_JOINT);
|
mJoint = S.TieRadioButton(_("Joint Stereo"), CHANNEL_JOINT);
|
||||||
mStereo = S.TieRadioButton(_("Stereo"), CHANNEL_STEREO);
|
mStereo = S.TieRadioButton(_("Stereo"), CHANNEL_STEREO);
|
||||||
#if defined(__WXMSW__)
|
|
||||||
mJoint->Enable(!preset);
|
|
||||||
mStereo->Enable(!preset);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
S.EndRadioButtonGroup();
|
S.EndRadioButtonGroup();
|
||||||
}
|
}
|
||||||
@ -425,6 +435,11 @@ void ExportMP3Options::OnOK(wxCommandEvent& event)
|
|||||||
ShuttleGui S(this, eIsSavingToPrefs);
|
ShuttleGui S(this, eIsSavingToPrefs);
|
||||||
PopulateOrExchange(S);
|
PopulateOrExchange(S);
|
||||||
|
|
||||||
|
gPrefs->Write(wxT("/FileFormats/MP3SetRate"), mSetRate);
|
||||||
|
gPrefs->Write(wxT("/FileFormats/MP3VbrRate"), mVbrRate);
|
||||||
|
gPrefs->Write(wxT("/FileFormats/MP3AbrRate"), mAbrRate);
|
||||||
|
gPrefs->Write(wxT("/FileFormats/MP3CbrRate"), mCbrRate);
|
||||||
|
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -436,13 +451,9 @@ void ExportMP3Options::OnSET(wxCommandEvent& evt)
|
|||||||
{
|
{
|
||||||
LoadNames(setRates, WXSIZEOF(setRates));
|
LoadNames(setRates, WXSIZEOF(setRates));
|
||||||
|
|
||||||
mRate->SetSelection(2);
|
mRate->SetSelection(FindIndex(setRates, WXSIZEOF(setRates), mSetRate, 2));
|
||||||
mRate->Refresh();
|
mRate->Refresh();
|
||||||
mMode->Enable(true);
|
mMode->Enable(true);
|
||||||
#if defined(__WXMSW__)
|
|
||||||
mJoint->Enable(false);
|
|
||||||
mStereo->Enable(false);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -451,13 +462,9 @@ void ExportMP3Options::OnVBR(wxCommandEvent& evt)
|
|||||||
{
|
{
|
||||||
LoadNames(varRates, WXSIZEOF(varRates));
|
LoadNames(varRates, WXSIZEOF(varRates));
|
||||||
|
|
||||||
mRate->SetSelection(2);
|
mRate->SetSelection(FindIndex(varRates, WXSIZEOF(varRates), mVbrRate, 2));
|
||||||
mRate->Refresh();
|
mRate->Refresh();
|
||||||
mMode->Enable(true);
|
mMode->Enable(true);
|
||||||
#if defined(__WXMSW__)
|
|
||||||
mJoint->Enable(true);
|
|
||||||
mStereo->Enable(true);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -466,13 +473,9 @@ void ExportMP3Options::OnABR(wxCommandEvent& evt)
|
|||||||
{
|
{
|
||||||
LoadNames(fixRates, WXSIZEOF(fixRates));
|
LoadNames(fixRates, WXSIZEOF(fixRates));
|
||||||
|
|
||||||
mRate->SetSelection(10);
|
mRate->SetSelection(FindIndex(fixRates, WXSIZEOF(fixRates), mAbrRate, 10));
|
||||||
mRate->Refresh();
|
mRate->Refresh();
|
||||||
mMode->Enable(false);
|
mMode->Enable(false);
|
||||||
#if defined(__WXMSW__)
|
|
||||||
mJoint->Enable(true);
|
|
||||||
mStereo->Enable(true);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -481,13 +484,27 @@ void ExportMP3Options::OnCBR(wxCommandEvent& evt)
|
|||||||
{
|
{
|
||||||
LoadNames(fixRates, WXSIZEOF(fixRates));
|
LoadNames(fixRates, WXSIZEOF(fixRates));
|
||||||
|
|
||||||
mRate->SetSelection(10);
|
mRate->SetSelection(FindIndex(fixRates, WXSIZEOF(fixRates), mCbrRate, 10));
|
||||||
mRate->Refresh();
|
mRate->Refresh();
|
||||||
mMode->Enable(false);
|
mMode->Enable(false);
|
||||||
#if defined(__WXMSW__)
|
}
|
||||||
mJoint->Enable(true);
|
|
||||||
mStereo->Enable(true);
|
void ExportMP3Options::OnQuality(wxCommandEvent& evt)
|
||||||
#endif
|
{
|
||||||
|
int sel = mRate->GetSelection();
|
||||||
|
|
||||||
|
if (mSET->GetValue()) {
|
||||||
|
mSetRate = setRates[sel].label;
|
||||||
|
}
|
||||||
|
else if (mVBR->GetValue()) {
|
||||||
|
mVbrRate = varRates[sel].label;
|
||||||
|
}
|
||||||
|
else if (mABR->GetValue()) {
|
||||||
|
mAbrRate = fixRates[sel].label;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mCbrRate = fixRates[sel].label;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportMP3Options::LoadNames(CHOICES *choices, int count)
|
void ExportMP3Options::LoadNames(CHOICES *choices, int count)
|
||||||
@ -522,6 +539,17 @@ wxArrayInt ExportMP3Options::GetLabels(CHOICES *choices, int count)
|
|||||||
return labels;
|
return labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ExportMP3Options::FindIndex(CHOICES *choices, int cnt, int needle, int def)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < cnt; i++) {
|
||||||
|
if (choices[i].label == needle) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// FindDialog
|
// FindDialog
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user